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