Add --slow (and --fast) options to validate
[ghc-hetmet.git] / validate
1 #!/bin/sh
2
3 # Flags:
4 #   --no-clean:       don't make clean first, just carry on from
5 #                     a previous interrupted validation run
6 #   --testsuite-only: don't build the compiler, just run
7 #                     the test suite
8 #   --hpc:            build stage2 with -fhpc, and see how much of the
9 #                     compiler the test suite covers.
10 #                     2008-07-01: 63% slower than the default.
11 #   --fast:           Default. Opposite to --slow.
12 #   --slow:           Build stage2 with -DDEBUG.
13 #                     2008-07-01: 14% slower than the default.
14
15 set -e
16
17 no_clean=0
18 testsuite_only=0
19 hpc=NO
20 slow=NO
21
22 while [ $# -gt 0 ]
23 do
24     case "$1" in
25     --no-clean)
26         no_clean=1
27         ;;
28     --testsuite-only)
29         testsuite_only=1
30         ;;
31     --hpc)
32         hpc=YES
33         ;;
34     --slow)
35         slow=YES
36         ;;
37     --fast)
38         slow=NO
39         ;;
40     *)
41         echo "Bad argument: $1" >&2
42         exit 1;;
43     esac
44     shift
45 done
46
47 if [ $testsuite_only -eq 0 ]; then
48
49 if [ $no_clean -eq 0 ] && [ -f mk/config.mk ]; then
50     make distclean
51 fi
52
53 case $OSTYPE in
54     cygwin|msys) config_args=--build=i386-unknown-mingw32
55         if [ -f c:/mingw/bin/gcc.exe ]
56         then
57             config_args="$config_args --with-gcc=c:/mingw/bin/gcc"
58         fi
59         ;;
60 esac
61
62 if [ "$CPUS" = "" ]; then
63     threads=2
64 else
65     threads=`expr $CPUS + 1`
66 fi
67
68 sh boot
69 ./configure "--prefix=`pwd`/inst" $config_args
70
71 thisdir=`utils/pwd/pwd forwardslash`
72
73 make Validating=YES -j$threads ValidateHpc=$hpc ValidateSlow=$slow
74 fi # testsuite-only
75
76 if [ "$hpc" = YES ]
77 then
78     # XXX With threads we'd need to give a different tix file to each thread
79     #     and then sum them up at the end
80     threads=1
81     HPCTIXFILE=$thisdir/testsuite/hpc_output/ghc.tix
82     export HPCTIXFILE
83     rm -f $HPCTIXFILE
84 fi
85
86 make Validating=YES -C testsuite/tests/ghc-regress fast stage=2 CLEANUP=1 THREADS=$threads 2>&1 | tee testlog
87
88 if [ "$hpc" = YES ]
89 then
90     utils/hpc/hpc markup --hpcdir=. --srcdir=compiler --srcdir=testsuite/hpc_output --destdir=testsuite/hpc_output testsuite/hpc_output/ghc.tix
91 fi
92
93 echo "-------------------------------------------------------------------"
94 if
95     grep '\<0 caused framework failures' testlog >/dev/null 2>/dev/null &&
96     grep '\<0 unexpected passes' testlog >/dev/null 2>/dev/null &&
97     grep '\<0 unexpected failures' testlog >/dev/null 2>/dev/null ; then
98     if [ $testsuite_only -eq 0 ] && [ $no_clean -eq 0 ]
99     then
100         cat <<EOF
101 Congratulations!  This tree has passed minimal testing.
102
103 NOTE: If you have made changes that may cause failures not tested for by
104 the minimal testing procedure, please do further testing as necessary.
105
106 When you are satisfied that you haven't broken anything, go ahead and
107 push/send your patches.
108 EOF
109     else
110         cat <<EOF
111 I didn't find any problems, but this wasn't a complete validate run,
112 so be careful!
113
114 NOTE: If you have made changes that may cause failures not tested for by
115 the minimal testing procedure, please do further testing as necessary.
116 EOF
117    fi
118 else
119     cat <<EOF
120 Oops!  Looks like you have some unexpected test results or framework failures.
121 Please fix them before pushing/sending patches.
122 EOF
123 fi
124 echo "-------------------------------------------------------------------"
125