mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00

All changes in this patch were performed automatically with `shfmt` with configuration flags specified in `.pre-commit-config.yaml`. In addition to fixing whitespace the roundtrip through shfmt's AST also transforms command substitutions `cmd` # becomes $(cmd) and some redirects >&2 echo "msg" # becomes echo >&2 "msg"
45 lines
1.3 KiB
Bash
Executable file
45 lines
1.3 KiB
Bash
Executable file
#! /usr/bin/env bash
|
|
#
|
|
# Runs btest-diff on $@ and fails if any fails. If $@ contains globs, we expand
|
|
# them relative to *both* the current directory and the test's baseline
|
|
# directory so that we spot missing files. Note that you will need to quote
|
|
# the globals in the TEST-EXEC line as otherwise they will have been expanded relative
|
|
# to the current directory already when this scripts runs.
|
|
|
|
diag=$TEST_DIAGNOSTICS
|
|
|
|
export TEST_DIAGNOSTICS=$diag.tmp
|
|
|
|
if [ "$diag" = "" ]; then
|
|
diag=/dev/stdout
|
|
else
|
|
rm -f $diag
|
|
fi
|
|
|
|
rc=0
|
|
|
|
files_cwd=$(ls $@)
|
|
files_baseline=$(cd $TEST_BASELINE && ls $@)
|
|
|
|
for i in $(echo $files_cwd $files_baseline | sort | uniq); do
|
|
if [[ "$i" != "loaded_scripts.log" && "$i" != "prof.log" && "$i" != "debug.log" && "$i" != "stats.log" && "$i" != broker_*.log ]]; then
|
|
|
|
if [[ "$i" == "reporter.log" ]]; then
|
|
# Do not diff the reporter.log if it only complains about missing
|
|
# GeoIP support or database.
|
|
if ! egrep -v "^#|Zeek was not configured for GeoIP support|Failed to open GeoIP" $i; then
|
|
continue
|
|
fi
|
|
fi
|
|
|
|
if ! btest-diff $i; then
|
|
echo "" >>$diag
|
|
echo "#### btest-diff $i" >>$diag
|
|
echo "" >>$diag
|
|
cat $diag.tmp >>$diag
|
|
rc=1
|
|
fi
|
|
fi
|
|
done
|
|
|
|
exit $rc
|