File: diff-all

package info (click to toggle)
bro 2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 78,640 kB
  • sloc: ansic: 126,302; cpp: 95,205; yacc: 2,528; lex: 1,819; sh: 793; python: 700; makefile: 134
file content (45 lines) | stat: -rwxr-xr-x 1,277 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#! /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" ]]; then

        if [[ "$i" == "reporter.log" ]]; then
            # Do not diff the reporter.log if it only complains about missing
            # GeoIP support.
            if ! egrep -v "^#|Bro was not configured for GeoIP support" $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