9 Validate GHC source tree against testsuite; see
10 http://ghc.haskell.org/trac/ghc/wiki/TestingPatches for more
14 --no-clean don't make clean first, just carry on from
15 a previous interrupted validation run
16 --testsuite-only don't build the compiler, just run the test suite
17 --build-only don't test the compiler, just build it
18 --hpc build stage2 with -fhpc, and see how much of the
19 compiler the test suite covers.
20 2008-07-01: 63% slower than the default.
21 HTML generated here: testsuite/hpc_output/hpc_index.html
22 --fast Omit binary distribution. Omit certain tests.
23 --slow Build stage2 with -DDEBUG. Run tests for all WAYS,
24 but skip those that call compiler_stats_num_field.
25 2008-07-01: 14% slower than the default.
26 --dph Also build libraries/dph and run associated tests.
27 --quiet More pretty build log.
28 See Note [Default build system verbosity].
29 --help shows this usage help.
31 validate runs 'make -j\$THREADS', where by default THREADS is the number of
32 cpus your computer has +1. You can set the environment variable THREADS to
33 override this. For a sequential build you would for example use
37 You can set the 'config_args' environment variable to pass flags to
40 You can also use environment variables to pass extra options to the
41 testsuite. For example:
43 TEST='read001 read002' ./validate --testsuite-only --fast
55 # Validate uses gzip compression for the binary distribution to avoid the rather
56 # heavy cost of xz, which is the typical default. The options are defined in
81 --normal) # for backward compat
84 --no-dph) # for backward compat
97 echo "$0: unrecognized argument '$1'" >&2
98 echo "Try '$0 --help' for more information." >&2
105 if [ "$bindistdir" = "" ]
107 ghc_pkg=inplace/bin/ghc-pkg
109 ghc_pkg="$bindistdir"/bin/ghc-pkg
112 if [ $be_quiet -eq 1 ]
116 echo "== Start $1 package check"
118 echo "== End $1 package check"
122 detect_cpu_count () {
123 if [ "$CPUS" = "" ]; then
124 # Windows standard environment variable
125 CPUS="$NUMBER_OF_PROCESSORS"
128 if [ "$CPUS" = "" ]; then
130 CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null`
133 if [ "$CPUS" = "" ]; then
135 CPUS=`getconf NPROCESSORS_ONLN 2>/dev/null`
138 if [ "$CPUS" = "" ]; then
146 if ! [ -d testsuite ]
148 echo 'Could not find the testsuite for validation' >&2
152 if [ "$THREADS" = "" ]; then
153 threads=$(($CPUS + 1)) # `expr $CPUS + 1`
158 echo "using THREADS=${threads}" >&2
160 if type gmake > /dev/null 2> /dev/null
167 if [ $be_quiet -eq 1 ]; then
168 # See Note [Default build system verbosity].
172 $make -C utils/checkUniques
174 if [ $testsuite_only -eq 0 ]; then
178 if [ $no_clean -eq 0 ]; then
179 $make maintainer-clean NO_CLEAN_GMP=YES
181 INSTDIR="$thisdir/inst"
183 if [ $use_dph -eq 1 ]; then
184 perl -w boot --validate --required-tag=dph
186 perl -w boot --validate
188 ./configure --prefix="$INSTDIR" $config_args
191 echo "Validating=YES" > mk/are-validating.mk
192 echo "ValidateSpeed=$speed" >> mk/are-validating.mk
193 echo "ValidateHpc=$hpc" >> mk/are-validating.mk
195 # Note [Default build system verbosity].
197 # From https://ghc.haskell.org/trac/ghc/wiki/Design/BuildSystem:
199 # "The build system should clearly report what it's doing (and sometimes
200 # why), without being too verbose. It should emit actual command lines as
201 # much as possible, so that they can be inspected and cut & pasted."
203 # That should be the default. Only suppress commands, by setting V=0 and using
204 # `make -s`, when user explicitly asks for it with `./validate --quiet`.
205 if [ $be_quiet -eq 1 ]; then
206 # See Note [Default build system verbosity].
207 echo "V=0" >> mk/are-validating.mk # Less gunk
210 if [ $use_dph -eq 1 ]; then
211 echo "BUILD_DPH=YES" >> mk/are-validating.mk
213 echo "BUILD_DPH=NO" >> mk/are-validating.mk
217 # For a "debug make", add "--debug=b --debug=m"
219 check_packages post-build
221 # -----------------------------------------------------------------------------
222 # Build and test a binary distribution (not --fast)
224 if [ $speed != "FAST" ]; then
226 $make binary-dist-prep TAR_COMP=$tar_comp
227 $make test_bindist TEST_PREP=YES TAR_COMP=$tar_comp
230 # Install the xhtml package into the bindist.
231 # This verifies that we can install a package into the
232 # bindist with Cabal.
234 bindistdir="bindisttest/install dir"
236 check_packages post-install
238 $make validate_build_xhtml BINDIST_PREFIX="$thisdir/$bindistdir"
240 check_packages post-xhtml
245 # -----------------------------------------------------------------------------
248 if [ "$build_only" -eq 1 ]; then
250 -------------------------------------------------------------------
251 Congratulations! This tree has compiled successfully.
253 You can now test your new compiler using ./validate --testsuite-only.
260 # XXX With threads we'd need to give a different tix file to each thread
261 # and then sum them up at the end
263 HPCTIXFILE=$thisdir/testsuite/hpc_output/ghc.tix
270 MAKE_TEST_TARGET=slowtest
271 BINDIST="BINDIST=YES"
274 MAKE_TEST_TARGET=test
275 BINDIST="BINDIST=YES"
278 MAKE_TEST_TARGET=fasttest
283 if [ $be_quiet -eq 1 ] && [ -z $VERBOSE ]; then
284 TEST_VERBOSITY="VERBOSE=1"
287 rm -f testsuite_summary.txt testsuite_summary_stage1.txt
289 # Use LOCAL=0, see Note [Running tests in /tmp].
290 $make -C testsuite/tests $BINDIST \
291 $MAKE_TEST_TARGET stage=2 LOCAL=0 $TEST_VERBOSITY THREADS=$threads \
292 NO_PRINT_SUMMARY=YES SUMMARY_FILE=../../testsuite_summary.txt \
295 # Run a few tests using the stage1 compiler.
296 # See Note [Why is there no stage1 setup function?].
297 # Don't use BINDIST=YES, as stage1 is not available in a bindist.
298 $make -C testsuite/tests/stage1 \
299 $MAKE_TEST_TARGET stage=1 LOCAL=0 $TEST_VERBOSITY THREADS=$threads \
300 NO_PRINT_SUMMARY=YES SUMMARY_FILE=../../../testsuite_summary_stage1.txt \
301 2>&1 | tee testlog-stage1
304 echo '==== STAGE 1 TESTS ==== '
305 cat testsuite_summary_stage1.txt
307 echo '==== STAGE 2 TESTS ==== '
308 cat testsuite_summary.txt
310 check_packages post-testsuite
314 utils/hpc/hpc markup --hpcdir=. --srcdir=compiler --srcdir=testsuite/hpc_output --destdir=testsuite/hpc_output testsuite/hpc_output/ghc.tix
318 grep '\<0 caused framework failures' testsuite_summary.txt >/dev/null 2>/dev/null &&
319 grep '\<0 unexpected passes' testsuite_summary.txt >/dev/null 2>/dev/null &&
320 grep '\<0 unexpected failures' testsuite_summary.txt >/dev/null 2>/dev/null &&
321 grep '\<0 unexpected stat failures' testsuite_summary.txt >/dev/null 2>/dev/null &&
323 grep '\<0 caused framework failures' testsuite_summary_stage1.txt >/dev/null 2>/dev/null &&
324 grep '\<0 unexpected passes' testsuite_summary_stage1.txt >/dev/null 2>/dev/null &&
325 grep '\<0 unexpected failures' testsuite_summary_stage1.txt >/dev/null 2>/dev/null &&
326 grep '\<0 unexpected stat failures' testsuite_summary_stage1.txt >/dev/null 2>/dev/null ; then
328 if [ $testsuite_only -eq 0 ] && [ $no_clean -eq 0 ]
331 -------------------------------------------------------------------
332 Congratulations! This tree has passed minimal testing.
334 NOTE: If you have made changes that may cause failures not tested for by
335 the minimal testing procedure, please do further testing as necessary.
337 When you are satisfied that you haven't broken anything, go ahead and
338 push/send your patches.
340 if [ -f mk/validate.mk ] && grep -q "^[^#]" mk/validate.mk
344 WARNING: You seem to have things set in mk/validate.mk. Please check
345 that it is OK before pushing.
349 -------------------------------------------------------------------
353 -------------------------------------------------------------------
354 I didn't find any problems, but this wasn't a complete validate run,
357 NOTE: If you have made changes that may cause failures not tested for by
358 the minimal testing procedure, please do further testing as necessary.
359 -------------------------------------------------------------------
363 if [ $be_quiet -eq 0 ]
366 -------------------------------------------------------------------
367 Oops! Looks like you have some unexpected test results or framework failures.
368 Please fix them before pushing/sending patches.
369 -------------------------------------------------------------------