zeek/testing/external/scripts/diff-all
Robin Sommer 3c2fa085d4 Adapting diff-all so that it expands globs in both current and
baseline directory.

This way, it now spots if a Baseline file isn't produced anymore.

Closes #677.
2011-12-07 10:03:44 -08:00

36 lines
944 B
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" ]]; then
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