Unverified 提交 15cdc143 authored 作者: satoren's avatar satoren 提交者: GitHub

add test with ASAN (#1118)

上级 af5a515e
...@@ -154,6 +154,11 @@ Rewrites mediasoup-worker C++ files using [clang-format](https://clang.llvm.org/ ...@@ -154,6 +154,11 @@ Rewrites mediasoup-worker C++ files using [clang-format](https://clang.llvm.org/
Builds and runs the `mediasoup-worker-test` binary at `worker/out/Release/` (or at `worker/out/Debug/` if the "MEDIASOUP_BUILDTYPE" environment variable is set to "Debug"), which uses [Catch2](https://github.com/catchorg/Catch2) to run test units located at `worker/test/` folder. Builds and runs the `mediasoup-worker-test` binary at `worker/out/Release/` (or at `worker/out/Debug/` if the "MEDIASOUP_BUILDTYPE" environment variable is set to "Debug"), which uses [Catch2](https://github.com/catchorg/Catch2) to run test units located at `worker/test/` folder.
### 'make test-asan'
Run test with Address Sanitizer.
### `make tidy` ### `make tidy`
Runs [clang-tidy](http://clang.llvm.org/extra/clang-tidy/) and performs C++ code checks following `worker/.clang-tidy` rules. Runs [clang-tidy](http://clang.llvm.org/extra/clang-tidy/) and performs C++ code checks following `worker/.clang-tidy` rules.
......
...@@ -81,6 +81,7 @@ endif ...@@ -81,6 +81,7 @@ endif
lint \ lint \
format \ format \
test \ test \
test-asan \
tidy \ tidy \
fuzzer \ fuzzer \
fuzzer-run-all \ fuzzer-run-all \
...@@ -225,6 +226,11 @@ else ...@@ -225,6 +226,11 @@ else
$(BUILD_DIR)/mediasoup-worker-test --invisibles --use-colour=yes $(MEDIASOUP_TEST_TAGS) $(BUILD_DIR)/mediasoup-worker-test --invisibles --use-colour=yes $(MEDIASOUP_TEST_TAGS)
endif endif
test-asan: setup
$(MESON) compile -C $(BUILD_DIR) -j $(CORES) mediasoup-worker-test-asan
$(MESON) install -C $(BUILD_DIR) --no-rebuild --tags mediasoup-worker-test-asan
ASAN_OPTIONS=detect_leaks=1 $(BUILD_DIR)/mediasoup-worker-test-asan --invisibles --use-colour=yes $(MEDIASOUP_TEST_TAGS)
tidy: tidy:
$(PYTHON) ./scripts/clang-tidy.py \ $(PYTHON) ./scripts/clang-tidy.py \
-clang-tidy-binary=./scripts/node_modules/.bin/clang-tidy \ -clang-tidy-binary=./scripts/node_modules/.bin/clang-tidy \
......
...@@ -280,15 +280,7 @@ executable( ...@@ -280,15 +280,7 @@ executable(
cpp_args: cpp_args + ['-DMS_EXECUTABLE'], cpp_args: cpp_args + ['-DMS_EXECUTABLE'],
) )
mediasoup_worker_test = executable( test_sources = [
'mediasoup-worker-test',
build_by_default: false,
install: true,
install_tag: 'mediasoup-worker-test',
dependencies: dependencies + [
catch2_proj.get_variable('catch2_dep'),
],
sources: common_sources + [
'test/src/tests.cpp', 'test/src/tests.cpp',
'test/src/PayloadChannel/TestPayloadChannelNotification.cpp', 'test/src/PayloadChannel/TestPayloadChannelNotification.cpp',
'test/src/PayloadChannel/TestPayloadChannelRequest.cpp', 'test/src/PayloadChannel/TestPayloadChannelRequest.cpp',
...@@ -333,7 +325,17 @@ mediasoup_worker_test = executable( ...@@ -333,7 +325,17 @@ mediasoup_worker_test = executable(
'test/src/Utils/TestJson.cpp', 'test/src/Utils/TestJson.cpp',
'test/src/Utils/TestString.cpp', 'test/src/Utils/TestString.cpp',
'test/src/Utils/TestTime.cpp', 'test/src/Utils/TestTime.cpp',
]
mediasoup_worker_test = executable(
'mediasoup-worker-test',
build_by_default: false,
install: true,
install_tag: 'mediasoup-worker-test',
dependencies: dependencies + [
catch2_proj.get_variable('catch2_dep'),
], ],
sources: common_sources + test_sources,
include_directories: include_directories( include_directories: include_directories(
'include', 'include',
'test/include', 'test/include',
...@@ -350,6 +352,35 @@ test( ...@@ -350,6 +352,35 @@ test(
workdir: meson.project_source_root(), workdir: meson.project_source_root(),
) )
mediasoup_worker_test_asan = executable(
'mediasoup-worker-test-asan',
build_by_default: false,
install: true,
install_tag: 'mediasoup-worker-test-asan',
dependencies: dependencies + [
catch2_proj.get_variable('catch2_dep'),
],
sources: common_sources + test_sources,
include_directories: include_directories(
'include',
'test/include',
),
cpp_args: cpp_args + [
'-DMS_LOG_STD',
'-DMS_TEST',
'-fsanitize=address',
],
link_args: [
'-fsanitize=address',
],
)
test(
'mediasoup-worker-test-asan',
mediasoup_worker_test_asan,
workdir: meson.project_source_root(),
)
executable( executable(
'mediasoup-worker-fuzzer', 'mediasoup-worker-fuzzer',
build_by_default: false, build_by_default: false,
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论