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

CI: Really run fuzzer for 5 minutes (#1338)

上级 780bd7a3
......@@ -37,4 +37,6 @@ jobs:
- name: invoke -r worker fuzzer
run: invoke -r worker fuzzer
# We don't run mediasoup-worker-fuzzer (maybe in the future).
# Run mediasoup-worker-fuzzer for 5 minutes.
- name: run-fuzzer.sh 300
run: cd worker && ./scripts/run-fuzzer.sh 300
......@@ -28,6 +28,9 @@ ENV CXX="clang++"
ENV MEDIASOUP_LOCAL_DEV="true"
ENV KEEP_BUILD_ARTIFACTS="1"
# Disable liburing due to this bug:
# https://github.com/versatica/mediasoup/issues/1334
ENV MESON_ARGS="-Dms_disable_liburing=true"
WORKDIR /mediasoup
......
......@@ -11,6 +11,9 @@ ENV CXX="g++"
ENV MEDIASOUP_LOCAL_DEV="true"
ENV KEEP_BUILD_ARTIFACTS="1"
# Disable liburing due to this bug:
# https://github.com/versatica/mediasoup/issues/1334
ENV MESON_ARGS="-Dms_disable_liburing=true"
WORKDIR /mediasoup
......
#!/usr/bin/env bash
WORKER_PWD=${PWD}
DURATION_SEC=$1
current_dir_name=${WORKER_PWD##*/}
if [ "${current_dir_name}" != "worker" ] ; then
echo "run-fuzzer.sh [ERROR] $(basename $0) must be called from mediasoup/worker directory" >&2
exit 1
fi
if [ "$#" -eq 0 ] ; then
echo "run-fuzzer.sh [ERROR] duration (in seconds) must be fiven as argument" >&2
exit 1
fi
invoke fuzzer-run-all &
MEDIASOUP_WORKER_FUZZER_PID=$!
i=${DURATION_SEC}
until [ ${i} -eq 0 ]
do
echo "run-fuzzer.sh [INFO] ${i} seconds left"
if ! kill -0 ${MEDIASOUP_WORKER_FUZZER_PID} &> /dev/null ; then
echo "run-fuzzer.sh [ERROR] mediasoup-worker-fuzzer died" >&2
exit 1
else
((i=i-1))
sleep 1
fi
done
echo "run-fuzzer.sh [INFO] mediasoup-worker-fuzzer is still running after given ${DURATION_SEC} seconds so no fuzzer issues so far"
kill -SIGTERM ${MEDIASOUP_WORKER_FUZZER_PID} &> /dev/null
exit 0
......@@ -23,7 +23,7 @@ import os;
import inspect;
import shutil;
# We import this from a custom location and pylint doesn't know.
from invoke import task; # pylint: disable=import-error
from invoke import task, call; # pylint: disable=import-error
MEDIASOUP_BUILDTYPE = os.getenv('MEDIASOUP_BUILDTYPE') or 'Release';
WORKER_DIR = os.path.dirname(os.path.abspath(
......@@ -135,14 +135,14 @@ def meson_ninja(ctx):
@task(pre=[meson_ninja])
def setup(ctx):
def setup(ctx, meson_args=MESON_ARGS):
"""
Run meson setup
"""
if MEDIASOUP_BUILDTYPE == 'Release':
with ctx.cd(f'"{WORKER_DIR}"'):
ctx.run(
f'"{MESON}" setup --prefix "{MEDIASOUP_INSTALL_DIR}" --bindir "" --libdir "" --buildtype release -Db_ndebug=true {MESON_ARGS} "{BUILD_DIR}"',
f'"{MESON}" setup --prefix "{MEDIASOUP_INSTALL_DIR}" --bindir "" --libdir "" --buildtype release -Db_ndebug=true {meson_args} "{BUILD_DIR}"',
echo=True,
pty=PTY_SUPPORTED,
shell=SHELL
......@@ -150,7 +150,7 @@ def setup(ctx):
elif MEDIASOUP_BUILDTYPE == 'Debug':
with ctx.cd(f'"{WORKER_DIR}"'):
ctx.run(
f'"{MESON}" setup --prefix "{MEDIASOUP_INSTALL_DIR}" --bindir "" --libdir "" --buildtype debug {MESON_ARGS} "{BUILD_DIR}"',
f'"{MESON}" setup --prefix "{MEDIASOUP_INSTALL_DIR}" --bindir "" --libdir "" --buildtype debug {meson_args} "{BUILD_DIR}"',
echo=True,
pty=PTY_SUPPORTED,
shell=SHELL
......@@ -158,7 +158,7 @@ def setup(ctx):
else:
with ctx.cd(f'"{WORKER_DIR}"'):
ctx.run(
f'"{MESON}" setup --prefix "{MEDIASOUP_INSTALL_DIR}" --bindir "" --libdir "" --buildtype {MEDIASOUP_BUILDTYPE} -Db_ndebug=if-release {MESON_ARGS} "{BUILD_DIR}"',
f'"{MESON}" setup --prefix "{MEDIASOUP_INSTALL_DIR}" --bindir "" --libdir "" --buildtype {MEDIASOUP_BUILDTYPE} -Db_ndebug=if-release {meson_args} "{BUILD_DIR}"',
echo=True,
pty=PTY_SUPPORTED,
shell=SHELL
......@@ -464,11 +464,15 @@ def tidy(ctx):
);
@task(pre=[setup, flatc])
@task(pre=[call(setup, meson_args=MESON_ARGS + ' -Db_sanitize=address'), flatc])
def fuzzer(ctx):
"""
Build the mediasoup-worker-fuzzer binary (which uses libFuzzer)
"""
# NOTE: We need to pass '-Db_sanitize=address' to enable fuzzer in all Meson
# subprojects, so we pass it to the setup() task.
with ctx.cd(f'"{WORKER_DIR}"'):
ctx.run(
f'"{MESON}" compile -C "{BUILD_DIR}" -j {NUM_CORES} mediasoup-worker-fuzzer',
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论