diff --git a/.github/workflows/mediasoup-worker-fuzzer.yaml b/.github/workflows/mediasoup-worker-fuzzer.yaml index 5f4e5d953e..1aa021e149 100644 --- a/.github/workflows/mediasoup-worker-fuzzer.yaml +++ b/.github/workflows/mediasoup-worker-fuzzer.yaml @@ -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 2 minutes. + - name: ./scripts/run-fuzzer.sh 120 + run: ./scripts/run-fuzzer.sh 120 diff --git a/worker/scripts/run-fuzzer.sh b/worker/scripts/run-fuzzer.sh new file mode 100755 index 0000000000..2c888dfed9 --- /dev/null +++ b/worker/scripts/run-fuzzer.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +WORKER_PWD=${PWD} +DURATION_SEC=$1 + +current_dir_name=${WORKER_PWD##*/} +if [ "${current_dir_name}" != "worker" ] ; then + echo ">>> [ERROR] $(basename $0) must be called from mediasoup/worker directory" >&2 + exit 1 +fi + +if [ "$#" -eq 0 ]; then + echo ">>> [ERROR] duration (in seconds) must be fiven as argument" >&2 + exit 1 +fi + +# Run mediasoup-worker-fuzzer in background, get its pid, wait for given +# duration and then kill mediasoup-worker-fuzzer. If still running, kill +# will return status code 0, otherwise 1 (which means that the +# mediasoup-worker-fuzzer binary already exited due to some fuzzer or other +# error). +make fuzzer-run-all & +MEDIASOUP_WORKER_FUZZER_PID=$! +sleep ${DURATION_SEC} +kill ${MEDIASOUP_WORKER_FUZZER_PID} +status=$?; + +if [ "${status}" -eq 0 ]; then + echo ">>> [INFO] mediasoup-worker-fuzzer still running so no fuzzer issue so far" + exit 0 +else + echo ">>> [ERROR] mediasoup-worker-fuzzer not running so it existed already" >&2 + exit ${status} +fi