mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-20 15:31:14 -06:00
2cd46e0f1f
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>
24 lines
355 B
Bash
Executable File
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
|