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