Files
releases/build/time-bound.sh
T
Patrick East 2cd46e0f1f Add periodic fuzzer job and required tooling
This adds the tooling from:

https://github.com/tsandall/fuzz-opa

plus some new helper scripts and make targets to use it as a pass/fail
CI step.

The script will (as of now) run the fuzzing for an hour and raise an
error if any crashers were found. We can adjust the timing as needed,
this initial setting is pretty arbitrary.

Signed-off-by: Patrick East <east.patrick@gmail.com>
2020-07-14 15:11:55 -07:00

24 lines
355 B
Bash
Executable File

#!/usr/bin/env bash
usage() {
echo "time-bound.sh <time> -- <command>"
}
TIMEOUT=${1}
shift
trap 'kill -INT -$PID' INT
timeout --signal int ${TIMEOUT} "${@}" &
PID=$!
wait $PID
RC=$?
# It's expected for the command to have timed out.
if [[ $RC == 124 ]]; then
echo ""
echo "Successfully stopped after ${TIMEOUT} seconds"
exit 0
fi
exit $RC