1852358da6a1be84262b1eb2156a64f1b52bba7b
[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     threads=2
31 else
32     threads=`expr $CPUS + 1`
33 fi
34
35 sh boot
36 ./configure $config_args
37
38 make -j$threads
39
40 # ToDo: use THREADS=$threads, see #1558
41 make -C testsuite/tests/ghc-regress fast stage=2 CLEANUP=1 2>&1 | tee testlog
42
43 if
44     grep '\<0 caused framework failures' testlog >/dev/null 2>/dev/null &&
45     grep '\<0 unexpected passes' testlog >/dev/null 2>/dev/null &&
46     grep '\<0 unexpected failures' testlog >/dev/null 2>/dev/null ; then
47    echo "-------------------------------------------------------------------"
48    echo "Congratulations!  This tree is has passed minimal testing."
49    echo
50    echo "NOTE: If you have made changes that may cause failures not tested"
51    echo "for by the minimal testing procedure, please do further testing"
52    echo "as necessary."
53    echo
54    echo "When you are satisfied that you haven't broken anything, go ahead"
55    echo "and push/send your patches".
56    echo "-------------------------------------------------------------------"
57 else
58    echo "-------------------------------------------------------------------"
59    echo "Oops!  Looks like you have some unexpected test results or"
60    echo "framework failures."
61    echo "Please fix them before pushing/sending patches."
62    echo "-------------------------------------------------------------------"
63 fi