Make some error strings more generic
[pgsql.git] / src / tools / pgtest
blob080cf6ae761ef5b6ce4c7910594da8e27b11891f
1 #!/bin/sh
3 # src/tools/pgtest [-n] [...]
5 # This runs a build/initdb/regression test suite
7 # This will start a temporary postmaster, so you have to
8 # have enough kernel resources to run two postmasters or
9 # stop your main postmaster before running this script.
11 # Use -n to prevent 'make clean'
13 MAKE="make"
15 [ ! -d src ] && echo "This must be run from the top of the PostgreSQL source tree" 1>&2 && exit 1
17 trap "ret=$?; rm -rf /tmp/$$; exit $ret" 0 1 2 3 15
18 mkdir /tmp/$$
19 TMP="/tmp/$$"
21 if [ "$1" != "-n" ]
22 then CLEAN="Y"
23 else CLEAN="N"
24 shift
27 rm -f tmp_install/log/install.log
29 # Run "make check" and store return code in $TMP/ret.
30 # Display output but also capture it in $TMP/0.
32 if [ "$CLEAN" = 'Y' ]
33 then $MAKE "$@" clean 2>&1
34 echo "$?" > "$TMP"/ret
36 if [ "$(cat "$TMP"/ret)" -eq 0 ]
37 then $MAKE "$@" 2>&1 && $MAKE "$@" check 2>&1
38 echo "$?" > "$TMP"/ret
40 ) | tee "$TMP"/0
42 # Grab possible warnings from install.log
43 [ -e tmp_install/log/install.log ] && cat tmp_install/log/install.log >> "$TMP"/0
45 # If success, display warnings
46 if [ "$(cat "$TMP"/ret)" -eq 0 ]
47 then cat "$TMP"/0 |
48 # The following grep's have to be adjusted for your setup because
49 # certain warnings are acceptable.
50 grep -i warning |
51 grep -v setproctitle |
52 grep -v find_rule |
53 grep -v yy_flex_realloc
56 # return original make error code
57 exit "$(cat "$TMP"/ret)"