source: tests/array-collections/dimexpr-match-detail.sh@ b28ce93

Last change on this file since b28ce93 was 090b076, checked in by Michael Brooks <mlbrooks@…>, 8 months ago

Expand and update comments re testing instrucions

  • Property mode set to 100755
File size: 2.7 KB
Line 
1# A test.py run (including what happens in the nightly build) runs the dimexpr-match test in a coarse, quick-check, fashion.
2# This script helps you run the dimexpr-match test manually, in a more thorough fashion.
3# test.py runs do not use this script.
4
5# When a test.py run shows that an output has changed, use this script for verification, before running --regenerate-expected.
6# Particularly with -ERRS, we don't actually care what the error message is (likely source of noise requiring --regenerate-expected), just that all the should-reject cases are rejected (which this script shows).
7
8# Success means the script does not print "TEST FAILURE."
9# Expect one large output with a mix of "done" and "skip" messages. That is the acceptance cases.
10# Then expect many small outputs all showing rc=1. These are the rejection cases.
11
12# The thoroughness that this script affords is
13# - verifying that _each_ rejection case is rejected, among a huge number of rejection cases
14# - particularly, counting those that reject by way of CFACC calling GCC, which issues a warning; these rejections are not reached by getting CFACC to report all errors at once
15# - observing the behaviour of a compiler other than the CFACC version in whose folder the test occurs; for example, GCC
16
17# usage examples
18# ./dimexpr-match-detail.sh cfa
19# ./dimexpr-match-detail.sh # same as above
20# ./dimexpr-match-detail.sh ~/cfa6/build/driver/cfa
21# ./dimexpr-match-detail.sh "$cfa -m32 -nodebug"
22# ./dimexpr-match-detail.sh 'gcc -x c'
23
24
25compiler=${1:-cfa}
26test=${2:-dimexpr-match-c.cfa}
27
28# Same as first half of the auto-test: check that all the cases that should be accepted are accepted
29set -x
30$compiler $test
31rc=$?
32{ set +x; } 2> /dev/null
33
34if [ $rc -gt 0 ]; then
35 echo
36 echo
37 echo "TEST FAILURE: compiler rejected a case that should be accepted"
38 echo
39 echo
40
41 exit 1
42fi
43
44set -x
45./a.out
46rc=$?
47{ set +x; } 2> /dev/null
48
49if [ $rc -gt 0 ]; then
50 echo
51 echo
52 echo "TEST FAILURE: runtime crash on a case that should be accepted"
53 echo
54 echo
55
56 exit 1
57fi
58
59# More detailed alternative to the second half of the auto-test: check that each case that the first half skipped is rejected, when run all by itself
60
61function verifyCompilationRejection() {
62 set -x
63 $compiler $1 &> /dev/null
64 rc=$?
65
66 { set +x; } 2> /dev/null
67
68 if [ $rc -eq 0 ]; then
69 echo
70 echo
71 echo "TEST FAILURE: compiler accepted case that should be rejected:"
72 echo $1
73 echo
74 echo
75
76 # keep checking other cases
77 fi
78}
79
80export -f verifyCompilationRejection
81export compiler
82
83./a.out -cmd4skip | sed -E -n 's/skip.*\| *//p' | xargs -n 1 -I {} bash -c 'verifyCompilationRejection "$@"' _ {}
Note: See TracBrowser for help on using the repository browser.