Use "set -e" in validate, so "sh validate" still has it set
[ghc-hetmet.git] / validate
1 #!/bin/sh
2
3 set -e
4
5 if [ -f mk/config.mk ]; then
6    make distclean
7 fi
8
9 if [ -f mk/build.mk ]; then
10    mv mk/build.mk mk/build.mk.bak
11 fi
12
13 # The default is a "quick" build
14 echo BuildFlavour=quick >mk/build.mk
15 cat mk/build.mk.sample >>mk/build.mk
16
17 # You can override the default validate settings using mk/validate.mk
18 # e.g. you could add GhcLibWays=p to test profiling.
19 echo '-include $(TOP)/mk/validate.mk' >>mk/build.mk
20
21 case $OSTYPE in
22   cygwin|msys) config_args=--build=i386-unknown-mingw32
23                if [ -f c:/mingw/bin/gcc.exe ]; then
24                    config_args="$config_args --with-gcc=c:/mingw/bin/gcc"
25                fi
26                ;;
27 esac
28
29 if [ "$CPUS" = "" ]; then
30    # ToDo: make -j doesn't work in libraries/ on Windows (see #1559)
31    case $OSTYPE in
32        cygwin|msys) threads=1;;
33        *)           threads=2;;
34    esac
35 else
36    threads=`expr $CPUS + 1`
37 fi
38
39 sh boot
40 ./configure $config_args
41
42 make -j$threads
43
44 # ToDo: use THREADS=$threads, see #1558
45 make -C testsuite/tests/ghc-regress fast stage=2 CLEANUP=1 2>&1 | tee testlog
46
47 if
48     grep '\<0 caused framework failures' testlog >/dev/null 2>/dev/null &&
49     grep '\<0 unexpected passes' testlog >/dev/null 2>/dev/null &&
50     grep '\<0 unexpected failures' testlog >/dev/null 2>/dev/null ; then
51    echo "-------------------------------------------------------------------"
52    echo "Congratulations!  This tree is has passed minimal testing."
53    echo
54    echo "NOTE: If you have made changes that may cause failures not tested"
55    echo "for by the minimal testing procedure, please do further testing"
56    echo "as necessary."
57    echo
58    echo "When you are satisfied that you haven't broken anything, go ahead"
59    echo "and push/send your patches".
60    echo "-------------------------------------------------------------------"
61 else
62    echo "-------------------------------------------------------------------"
63    echo "Oops!  Looks like you have some unexpected test results or"
64    echo "framework failures."
65    echo "Please fix them before pushing/sending patches."
66    echo "-------------------------------------------------------------------"
67 fi