Skip to content
Newer
Older
100755 225 lines (191 sloc) 5.97 KB
83331f7 @igfoo Use "set -e" in validate, so "sh validate" still has it set
igfoo authored Jul 29, 2007
1 #!/bin/sh
2
7a7b51a Add comments explaining flags
simonpj@microsoft.com authored Feb 28, 2008
3 # Flags:
3a26865 @igfoo Fix typo
igfoo authored Mar 2, 2008
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
8df3ac7 @igfoo Make a "validate --hpc"; shows how much of the compiler the testsuite…
igfoo authored Jul 1, 2008
8 # --hpc: build stage2 with -fhpc, and see how much of the
982f6e5 @igfoo Add --slow (and --fast) options to validate
igfoo authored Jul 1, 2008
9 # compiler the test suite covers.
10 # 2008-07-01: 63% slower than the default.
69adcec @igfoo Add a comment in validate saying where the hpc HTML is put
igfoo authored Jul 7, 2008
11 # HTML generated here: testsuite/hpc_output/hpc_index.html
1bbb89f @simonmar Make the --fast option to validate faster, and add --normal
simonmar authored Nov 16, 2011
12 # --normal: Default settings
13 # --fast: Omit dyn way, omit binary distribution
982f6e5 @igfoo Add --slow (and --fast) options to validate
igfoo authored Jul 1, 2008
14 # --slow: Build stage2 with -DDEBUG.
15 # 2008-07-01: 14% slower than the default.
7a7b51a Add comments explaining flags
simonpj@microsoft.com authored Feb 28, 2008
16
83331f7 @igfoo Use "set -e" in validate, so "sh validate" still has it set
igfoo authored Jul 29, 2007
17 set -e
8ce457c Add first cut of the validate script
Simon Marlow authored Jul 4, 2007
18
81553ff @igfoo Allow skipping "make clean" or only re-running the testsuite in validate
igfoo authored Feb 10, 2008
19 no_clean=0
20 testsuite_only=0
982f6e5 @igfoo Add --slow (and --fast) options to validate
igfoo authored Jul 1, 2008
21 hpc=NO
1bbb89f @simonmar Make the --fast option to validate faster, and add --normal
simonmar authored Nov 16, 2011
22 speed=NORMAL
81553ff @igfoo Allow skipping "make clean" or only re-running the testsuite in validate
igfoo authored Feb 10, 2008
23
24 while [ $# -gt 0 ]
25 do
26 case "$1" in
27 --no-clean)
28 no_clean=1
29 ;;
30 --testsuite-only)
31 testsuite_only=1
32 ;;
8df3ac7 @igfoo Make a "validate --hpc"; shows how much of the compiler the testsuite…
igfoo authored Jul 1, 2008
33 --hpc)
982f6e5 @igfoo Add --slow (and --fast) options to validate
igfoo authored Jul 1, 2008
34 hpc=YES
35 ;;
36 --slow)
1bbb89f @simonmar Make the --fast option to validate faster, and add --normal
simonmar authored Nov 16, 2011
37 speed=SLOW
982f6e5 @igfoo Add --slow (and --fast) options to validate
igfoo authored Jul 1, 2008
38 ;;
39 --fast)
1bbb89f @simonmar Make the --fast option to validate faster, and add --normal
simonmar authored Nov 16, 2011
40 speed=FAST
41 ;;
42 --normal)
43 speed=NORMAL
8df3ac7 @igfoo Make a "validate --hpc"; shows how much of the compiler the testsuite…
igfoo authored Jul 1, 2008
44 ;;
81553ff @igfoo Allow skipping "make clean" or only re-running the testsuite in validate
igfoo authored Feb 10, 2008
45 *)
46 echo "Bad argument: $1" >&2
47 exit 1;;
48 esac
49 shift
50 done
51
83e4c1e @igfoo validate now checks that the testsuite exists first; trac #5089
igfoo authored Jul 14, 2011
52 if ! [ -d testsuite ]
53 then
54 echo 'You need the testsuite to validate' >&2
55 echo 'Run "./sync-all --testsuite get" to get it' >&2
56 exit 1
57 fi
58
15f7bc3 @igfoo Allow specifying $threads directly when validating
igfoo authored Mar 21, 2010
59 if [ "$THREADS" = "" ]; then
60 if [ "$CPUS" = "" ]; then
61 threads=2
62 else
63 threads=$(($CPUS + 1)) # `expr $CPUS + 1`
64 fi
ea195ee @igfoo Don't boot/configure if we are validating --no-clean
igfoo authored Aug 4, 2008
65 else
15f7bc3 @igfoo Allow specifying $threads directly when validating
igfoo authored Mar 21, 2010
66 threads="$THREADS"
ea195ee @igfoo Don't boot/configure if we are validating --no-clean
igfoo authored Aug 4, 2008
67 fi
68
619f670 @igfoo In validate, use gmake if available; based on a patch from Gabor PALI
igfoo authored May 17, 2010
69 if type gmake > /dev/null 2> /dev/null
70 then
71 make="gmake"
72 else
73 make="make"
74 fi
75
81553ff @igfoo Allow skipping "make clean" or only re-running the testsuite in validate
igfoo authored Feb 10, 2008
76 if [ $testsuite_only -eq 0 ]; then
77
1935abf @igfoo Ooops; lack of mk/confi.mk doesn't mean validate shouldn't run config…
igfoo authored Aug 6, 2008
78 if [ $no_clean -eq 0 ]; then
619f670 @igfoo In validate, use gmake if available; based on a patch from Gabor PALI
igfoo authored May 17, 2010
79 $make maintainer-clean NO_CLEAN_GMP=YES
8ce457c Add first cut of the validate script
Simon Marlow authored Jul 4, 2007
80
34cc75e @igfoo GHC new build system megapatch
igfoo authored Apr 26, 2009
81 INSTDIR=`pwd`/inst
82 if [ "$OSTYPE" = "cygwin" ]
83 then
84 INSTDIR=`cygpath -m "$INSTDIR"`
85 fi
2924c4b make validate work on Windows
Simon Marlow authored Jul 25, 2007
86
a91df48 @igfoo Make the boot script complain if mk/build.mk doesn't exist
igfoo authored Apr 14, 2011
87 /usr/bin/perl -w boot --validate --required-tag=dph
34cc75e @igfoo GHC new build system megapatch
igfoo authored Apr 26, 2009
88 ./configure --prefix="$INSTDIR" $config_args
2924c4b make validate work on Windows
Simon Marlow authored Jul 25, 2007
89 fi
90
6bb8d64 @igfoo For bindists, build ghc-pwd with stage 1
igfoo authored Nov 21, 2010
91 thisdir=`utils/ghc-pwd/dist-boot/ghc-pwd`
8df3ac7 @igfoo Make a "validate --hpc"; shows how much of the compiler the testsuite…
igfoo authored Jul 1, 2008
92
b60992f @igfoo Record ValidateSpeed and ValidateHpc in mk/are-validating.mk
igfoo authored Nov 26, 2011
93 echo "Validating=YES" > mk/are-validating.mk
94 echo "ValidateSpeed=$speed" >> mk/are-validating.mk
95 echo "ValidateHpc=$hpc" >> mk/are-validating.mk
6594f91 @igfoo Change how we know whether or not we are validating
igfoo authored Aug 17, 2008
96
b60992f @igfoo Record ValidateSpeed and ValidateHpc in mk/are-validating.mk
igfoo authored Nov 26, 2011
97 $make -j$threads
3b545c4 @simonpj Add a comment about how to do validate while capturing a debug log,
simonpj authored Jun 20, 2011
98 # For a "debug make", add "--debug=b --debug=m"
e454ee6 @igfoo Don't remake the bindist when validating with --testsuite-only
igfoo authored Oct 9, 2009
99
1bbb89f @simonmar Make the --fast option to validate faster, and add --normal
simonmar authored Nov 16, 2011
100 # -----------------------------------------------------------------------------
101 # Build and test a binary distribution (not --fast)
102
103 if [ $speed != "FAST" ]; then
104
105 $make binary-dist-prep
106 $make test_bindist TEST_PREP=YES
107
d7d6c42 @igfoo Fix validating with HADDOCK_DOCS=YES
igfoo authored Feb 22, 2012
108 #
109 # Install the mtl package into the bindist, because it is used by some
110 # tests. It isn't essential that we do this (the failing tests will
111 # be treated as expected failures), but we get a bit more test
112 # coverage, and also verify that we can install a package into the
113 # bindist with Cabal.
114 #
115 bindistdir="bindisttest/install dir"
116
62494e7 @igfoo Add a hack to make validating with HADDOCK_DOCS=NO work
igfoo authored Feb 21, 2012
117 # This is a hack to make
118 # HADDOCK_DOCS = NO
119 # work when validating.
f630970 @igfoo Tweak the HADDOCK_DOCS regex in validate
igfoo authored Mar 9, 2012
120 if grep -q "^HADDOCK_DOCS.*=.*NO" mk/validate.mk
62494e7 @igfoo Add a hack to make validating with HADDOCK_DOCS=NO work
igfoo authored Feb 21, 2012
121 then
122 unset WITH_HADDOCK
123 DO_HADDOCK=NO
124 else
125 WITH_HADDOCK=--with-haddock="$thisdir/$bindistdir/bin/haddock"
126 DO_HADDOCK=YES
127 fi
128
1bbb89f @simonmar Make the --fast option to validate faster, and add --normal
simonmar authored Nov 16, 2011
129 cd libraries/mtl
130 "$thisdir/$bindistdir/bin/ghc" --make Setup
62494e7 @igfoo Add a hack to make validating with HADDOCK_DOCS=NO work
igfoo authored Feb 21, 2012
131
132 ./Setup configure --with-ghc="$thisdir/$bindistdir/bin/ghc" ${WITH_HADDOCK+"$WITH_HADDOCK"} --global --builddir=dist-bindist --prefix="$thisdir/$bindistdir"
1bbb89f @simonmar Make the --fast option to validate faster, and add --normal
simonmar authored Nov 16, 2011
133 ./Setup build --builddir=dist-bindist
62494e7 @igfoo Add a hack to make validating with HADDOCK_DOCS=NO work
igfoo authored Feb 21, 2012
134 [ "$DO_HADDOCK" = "YES" ] && ./Setup haddock --builddir=dist-bindist
1bbb89f @simonmar Make the --fast option to validate faster, and add --normal
simonmar authored Nov 16, 2011
135 ./Setup install --builddir=dist-bindist
136 ./Setup clean --builddir=dist-bindist
137 rm -f Setup Setup.exe Setup.hi Setup.o
138 cd $thisdir
139 fi
89cfcda @simonmar Install the mtl package into the bindist when validating. This allows
simonmar authored May 24, 2011
140
81553ff @igfoo Allow skipping "make clean" or only re-running the testsuite in validate
igfoo authored Feb 10, 2008
141 fi # testsuite-only
8ce457c Add first cut of the validate script
Simon Marlow authored Jul 4, 2007
142
1bbb89f @simonmar Make the --fast option to validate faster, and add --normal
simonmar authored Nov 16, 2011
143 # -----------------------------------------------------------------------------
144 # Run the testsuite
145
982f6e5 @igfoo Add --slow (and --fast) options to validate
igfoo authored Jul 1, 2008
146 if [ "$hpc" = YES ]
8df3ac7 @igfoo Make a "validate --hpc"; shows how much of the compiler the testsuite…
igfoo authored Jul 1, 2008
147 then
148 # XXX With threads we'd need to give a different tix file to each thread
149 # and then sum them up at the end
150 threads=1
151 HPCTIXFILE=$thisdir/testsuite/hpc_output/ghc.tix
152 export HPCTIXFILE
153 rm -f $HPCTIXFILE
154 fi
155
1bbb89f @simonmar Make the --fast option to validate faster, and add --normal
simonmar authored Nov 16, 2011
156 case "$speed" in
157 SLOW)
158 MAKE_TEST_TARGET=fulltest
159 BINDIST="BINDIST=YES"
160 ;;
161 NORMAL)
162 MAKE_TEST_TARGET=test
163 BINDIST="BINDIST=YES"
164 ;;
165 FAST)
166 MAKE_TEST_TARGET=test
167 BINDIST="BINDIST=NO"
168 ;;
169 esac
ee9343b @igfoo Make "./validate --slow" run the full testsuite
igfoo authored Oct 7, 2010
170
1bbb89f @simonmar Make the --fast option to validate faster, and add --normal
simonmar authored Nov 16, 2011
171 $make $MAKE_TEST_TARGET stage=2 $BINDIST THREADS=$threads 2>&1 | tee testlog
8ce457c Add first cut of the validate script
Simon Marlow authored Jul 4, 2007
172
982f6e5 @igfoo Add --slow (and --fast) options to validate
igfoo authored Jul 1, 2008
173 if [ "$hpc" = YES ]
8df3ac7 @igfoo Make a "validate --hpc"; shows how much of the compiler the testsuite…
igfoo authored Jul 1, 2008
174 then
175 utils/hpc/hpc markup --hpcdir=. --srcdir=compiler --srcdir=testsuite/hpc_output --destdir=testsuite/hpc_output testsuite/hpc_output/ghc.tix
176 fi
177
81553ff @igfoo Allow skipping "make clean" or only re-running the testsuite in validate
igfoo authored Feb 10, 2008
178 echo "-------------------------------------------------------------------"
17c564c @igfoo Check for framework failures and unexpected passes in validate
igfoo authored Jul 22, 2007
179 if
180 grep '\<0 caused framework failures' testlog >/dev/null 2>/dev/null &&
181 grep '\<0 unexpected passes' testlog >/dev/null 2>/dev/null &&
a28f25f @igfoo Have validate check for the "files written by multiple tests" error
igfoo authored Aug 8, 2011
182 grep '\<0 unexpected failures' testlog >/dev/null 2>/dev/null &&
183 ! grep 'Some files are written by multiple tests' testlog >/dev/null 2>/dev/null ; then
81553ff @igfoo Allow skipping "make clean" or only re-running the testsuite in validate
igfoo authored Feb 10, 2008
184 if [ $testsuite_only -eq 0 ] && [ $no_clean -eq 0 ]
185 then
186 cat <<EOF
187 Congratulations! This tree has passed minimal testing.
188
189 NOTE: If you have made changes that may cause failures not tested for by
190 the minimal testing procedure, please do further testing as necessary.
191
192 When you are satisfied that you haven't broken anything, go ahead and
193 push/send your patches.
194 EOF
c629bd1 @igfoo Check mk/validate.mk exists before we try grepping it
igfoo authored Jun 26, 2011
195 if [ -f mk/validate.mk ] && grep -q "^[^#]" mk/validate.mk
f8eee63 @igfoo Check whether mk/validate.mk defines anything after validating
igfoo authored Oct 7, 2008
196 then
197 cat <<EOF
198
199 WARNING: You seem to have things set in mk/validate.mk. Please check
200 that it is OK before pushing.
201 EOF
202 fi
9aa52fb @simonmar add the missing final row of dashes in the success message
simonmar authored Jun 15, 2009
203 cat <<EOF
204 -------------------------------------------------------------------
205 EOF
81553ff @igfoo Allow skipping "make clean" or only re-running the testsuite in validate
igfoo authored Feb 10, 2008
206 else
207 cat <<EOF
208 I didn't find any problems, but this wasn't a complete validate run,
209 so be careful!
210
211 NOTE: If you have made changes that may cause failures not tested for by
212 the minimal testing procedure, please do further testing as necessary.
ffafcfb @simonmar validate does "exit 1" if it fails
simonmar authored May 13, 2009
213 -------------------------------------------------------------------
81553ff @igfoo Allow skipping "make clean" or only re-running the testsuite in validate
igfoo authored Feb 10, 2008
214 EOF
215 fi
8ce457c Add first cut of the validate script
Simon Marlow authored Jul 4, 2007
216 else
81553ff @igfoo Allow skipping "make clean" or only re-running the testsuite in validate
igfoo authored Feb 10, 2008
217 cat <<EOF
218 Oops! Looks like you have some unexpected test results or framework failures.
219 Please fix them before pushing/sending patches.
ffafcfb @simonmar validate does "exit 1" if it fails
simonmar authored May 13, 2009
220 -------------------------------------------------------------------
81553ff @igfoo Allow skipping "make clean" or only re-running the testsuite in validate
igfoo authored Feb 10, 2008
221 EOF
ffafcfb @simonmar validate does "exit 1" if it fails
simonmar authored May 13, 2009
222 exit 1
8ce457c Add first cut of the validate script
Simon Marlow authored Jul 4, 2007
223 fi
81553ff @igfoo Allow skipping "make clean" or only re-running the testsuite in validate
igfoo authored Feb 10, 2008
224
Something went wrong with that request. Please try again.