Unverified 提交 73be1dd8 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo 提交者: GitHub

CI: Run worker tests with Address Sanitizer (only Linux) (disabled for now) (#1416)

上级 f641b6c2
......@@ -96,3 +96,24 @@ jobs:
run: invoke -r worker test
# TODO: Maybe fix this one day.
if: runner.os != 'Windows'
# TODO: Uncomment once https://github.com/versatica/mediasoup/issues/1417
# is fixed.
# - name: invoke -r worker test-asan-address
# run: invoke -r worker test-asan-address
# # Address Sanitizer only works on Linux.
# if: runner.os == 'Linux'
# TODO: Uncomment once https://github.com/versatica/mediasoup/issues/1417
# is fixed.
# - name: invoke -r worker test-asan-undefined
# run: invoke -r worker test-asan-undefined
# # Address Sanitizer only works on Linux.
# if: runner.os == 'Linux'
# TODO: Uncomment once https://github.com/versatica/mediasoup/issues/1417
# is fixed.
# - name: invoke -r worker test-asan-thread
# run: invoke -r worker test-asan-thread
# # Address Sanitizer only works on Linux.
# if: runner.os == 'Linux'
......@@ -188,9 +188,17 @@ 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.
### `invoke test-asan`
### `invoke test-asan-address`
Run test with Address Sanitizer.
Run test with Address Sanitizer with `-fsanitize=address`.
### `invoke test-asan-undefined`
Run test with Address Sanitizer with `-fsanitize=undefined`.
### `invoke test-asan-thread`
Run test with Address Sanitizer with `-fsanitize=thread`.
### `invoke tidy`
......
......@@ -32,7 +32,9 @@ endif
lint \
format \
test \
test-asan \
test-asan-address \
test-asan-undefined \
test-asan-thread \
tidy \
fuzzer \
fuzzer-run-all \
......@@ -96,8 +98,14 @@ format: invoke
test: invoke
"$(PYTHON)" -m invoke test
test-asan: invoke
"$(PYTHON)" -m invoke test-asan
test-asan-address: invoke
"$(PYTHON)" -m invoke test-asan-address
test-asan-undefined: invoke
"$(PYTHON)" -m invoke test-asan-undefined
test-asan-thread: invoke
"$(PYTHON)" -m invoke test-asan-thread
tidy: invoke
"$(PYTHON)" -m invoke tidy
......
......@@ -393,11 +393,11 @@ test(
workdir: meson.project_source_root(),
)
mediasoup_worker_test_asan = executable(
'mediasoup-worker-test-asan',
mediasoup_worker_test_asan_address = executable(
'mediasoup-worker-test-asan-address',
build_by_default: false,
install: true,
install_tag: 'mediasoup-worker-test-asan',
install_tag: 'mediasoup-worker-test-asan-address',
dependencies: dependencies + [
catch2_proj.get_variable('catch2_dep'),
],
......@@ -417,8 +417,66 @@ mediasoup_worker_test_asan = executable(
)
test(
'mediasoup-worker-test-asan',
mediasoup_worker_test_asan,
'mediasoup-worker-test-asan-address',
mediasoup_worker_test_asan_address,
workdir: meson.project_source_root(),
)
mediasoup_worker_test_asan_undefined = executable(
'mediasoup-worker-test-asan-undefined',
build_by_default: false,
install: true,
install_tag: 'mediasoup-worker-test-asan-undefined',
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=undefined',
],
link_args: [
'-fsanitize=undefined',
],
)
test(
'mediasoup-worker-test-asan-undefined',
mediasoup_worker_test_asan_undefined,
workdir: meson.project_source_root(),
)
mediasoup_worker_test_asan_thread = executable(
'mediasoup-worker-test-asan-thread',
build_by_default: false,
install: true,
install_tag: 'mediasoup-worker-test-asan-thread',
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=thread',
],
link_args: [
'-fsanitize=thread',
],
)
test(
'mediasoup-worker-test-asan-thread',
mediasoup_worker_test_asan_thread,
workdir: meson.project_source_root(),
)
......
[wrap-file]
directory = Catch2-3.5.3
source_url = https://github.com/catchorg/Catch2/archive/v3.5.3.tar.gz
source_filename = Catch2-3.5.3.tar.gz
source_hash = 8d723b0535c94860ef8cf6231580fa47d67a3416757ecb10639e40d748ab6c71
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/catch2_3.5.3-1/Catch2-3.5.3.tar.gz
wrapdb_version = 3.5.3-1
directory = Catch2-3.6.0
source_url = https://github.com/catchorg/Catch2/archive/v3.6.0.tar.gz
source_filename = Catch2-3.6.0.tar.gz
source_hash = 485932259a75c7c6b72d4b874242c489ea5155d17efa345eb8cc72159f49f356
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/catch2_3.6.0-1/Catch2-3.6.0.tar.gz
wrapdb_version = 3.6.0-1
[provide]
catch2 = catch2_dep
......
[wrap-file]
directory = liburing-liburing-2.4
source_url = https://github.com/axboe/liburing/archive/refs/tags/liburing-2.4.tar.gz
source_filename = liburing-2.4.tar.gz
source_hash = 2398ec82d967a6f903f3ae1fd4541c754472d3a85a584dc78c5da2fabc90706b
patch_filename = liburing_2.4-2_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/liburing_2.4-2/get_patch
patch_hash = 0435ae1012065fa96a22e1068c2e39e2f7c7c03b58a812774434a6e7455d7f20
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/liburing_2.4-2/liburing-2.4.tar.gz
wrapdb_version = 2.4-2
directory = liburing-liburing-2.5
source_url = https://github.com/axboe/liburing/archive/refs/tags/liburing-2.5.tar.gz
source_filename = liburing-2.5.tar.gz
source_hash = 456f5f882165630f0dc7b75e8fd53bd01a955d5d4720729b4323097e6e9f2a98
patch_filename = liburing_2.5-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/liburing_2.5-1/get_patch
patch_hash = d72f651e0edd8102535af575d682ce86c3fc2fdabb40b8faa2659d0f7d437f44
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/liburing_2.5-1/liburing-2.5.tar.gz
wrapdb_version = 2.5-1
[provide]
dependency_names = liburing
......@@ -389,21 +389,83 @@ def test(ctx):
);
@task(pre=[setup, flatc])
def test_asan(ctx):
@task(pre=[call(setup, meson_args=MESON_ARGS + ' -Db_sanitize=address'), flatc])
def test_asan_address(ctx):
"""
Run worker test with Address Sanitizer with '-fsanitize=address'
"""
with ctx.cd(f'"{WORKER_DIR}"'):
ctx.run(
f'"{MESON}" compile -C "{BUILD_DIR}" -j {NUM_CORES} mediasoup-worker-test-asan-address',
echo=True,
pty=PTY_SUPPORTED,
shell=SHELL
);
with ctx.cd(f'"{WORKER_DIR}"'):
ctx.run(
f'"{MESON}" install -C "{BUILD_DIR}" --no-rebuild --tags mediasoup-worker-test-asan-address',
echo=True,
pty=PTY_SUPPORTED,
shell=SHELL
);
mediasoup_test_tags = os.getenv('MEDIASOUP_TEST_TAGS') or '';
with ctx.cd(f'"{WORKER_DIR}"'):
ctx.run(
f'ASAN_OPTIONS=detect_leaks=1 "{BUILD_DIR}/mediasoup-worker-test-asan-address" --invisibles {mediasoup_test_tags}',
echo=True,
pty=PTY_SUPPORTED,
shell=SHELL
);
@task(pre=[call(setup, meson_args=MESON_ARGS + ' -Db_sanitize=undefined'), flatc])
def test_asan_undefined(ctx):
"""
Run worker test with undefined Sanitizer with -fsanitize=undefined
"""
with ctx.cd(f'"{WORKER_DIR}"'):
ctx.run(
f'"{MESON}" compile -C "{BUILD_DIR}" -j {NUM_CORES} mediasoup-worker-test-asan-undefined',
echo=True,
pty=PTY_SUPPORTED,
shell=SHELL
);
with ctx.cd(f'"{WORKER_DIR}"'):
ctx.run(
f'"{MESON}" install -C "{BUILD_DIR}" --no-rebuild --tags mediasoup-worker-test-asan-undefined',
echo=True,
pty=PTY_SUPPORTED,
shell=SHELL
);
mediasoup_test_tags = os.getenv('MEDIASOUP_TEST_TAGS') or '';
with ctx.cd(f'"{WORKER_DIR}"'):
ctx.run(
f'ASAN_OPTIONS=detect_leaks=1 "{BUILD_DIR}/mediasoup-worker-test-asan-undefined" --invisibles {mediasoup_test_tags}',
echo=True,
pty=PTY_SUPPORTED,
shell=SHELL
);
@task(pre=[call(setup, meson_args=MESON_ARGS + ' -Db_sanitize=thread'), flatc])
def test_asan_thread(ctx):
"""
Run worker test with Address Sanitizer
Run worker test with thread Sanitizer with -fsanitize=thread
"""
with ctx.cd(f'"{WORKER_DIR}"'):
ctx.run(
f'"{MESON}" compile -C "{BUILD_DIR}" -j {NUM_CORES} mediasoup-worker-test-asan',
f'"{MESON}" compile -C "{BUILD_DIR}" -j {NUM_CORES} mediasoup-worker-test-asan-thread',
echo=True,
pty=PTY_SUPPORTED,
shell=SHELL
);
with ctx.cd(f'"{WORKER_DIR}"'):
ctx.run(
f'"{MESON}" install -C "{BUILD_DIR}" --no-rebuild --tags mediasoup-worker-test-asan',
f'"{MESON}" install -C "{BUILD_DIR}" --no-rebuild --tags mediasoup-worker-test-asan-thread',
echo=True,
pty=PTY_SUPPORTED,
shell=SHELL
......@@ -413,7 +475,7 @@ def test_asan(ctx):
with ctx.cd(f'"{WORKER_DIR}"'):
ctx.run(
f'ASAN_OPTIONS=detect_leaks=1 "{BUILD_DIR}/mediasoup-worker-test-asan" --invisibles --use-colour=yes {mediasoup_test_tags}',
f'ASAN_OPTIONS=detect_leaks=1 "{BUILD_DIR}/mediasoup-worker-test-asan-thread" --invisibles {mediasoup_test_tags}',
echo=True,
pty=PTY_SUPPORTED,
shell=SHELL
......
......@@ -526,6 +526,7 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
// clang-format on
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论