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 | # The thoroughness that this script affords is |
---|
6 | # - verifying that _each_ rejection case is rejected, among a huge number of rejection cases |
---|
7 | # - 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 |
---|
8 | # - observing the behaviour of a compiler other than the CFACC version in whose folder the test occurs; for example, GCC |
---|
9 | |
---|
10 | # usage (one of) |
---|
11 | # ./dimexpr-match-detail.sh '/u0/mlbrooks/cfa2/build-straw3/driver/cfa -DCFA_PREVIEW_FUNCTIONALITY' |
---|
12 | # ./dimexpr-match-detail.sh ~/cfa6/build/driver/cfa |
---|
13 | # ./dimexpr-match-detail.sh 'gcc -x c' |
---|
14 | |
---|
15 | |
---|
16 | |
---|
17 | compiler=${1:-cfa} |
---|
18 | test=${2:-dimexpr-match-c.cfa} |
---|
19 | |
---|
20 | # Same as first half of the auto-test: check that all the cases that should be accepted are accepted |
---|
21 | set -x |
---|
22 | $compiler $test |
---|
23 | rc=$? |
---|
24 | { set +x; } 2> /dev/null |
---|
25 | |
---|
26 | if [ $rc -gt 0 ]; then |
---|
27 | echo |
---|
28 | echo |
---|
29 | echo "TEST FAILURE: compiler rejected a case that should be accepted" |
---|
30 | echo |
---|
31 | echo |
---|
32 | |
---|
33 | exit 1 |
---|
34 | fi |
---|
35 | |
---|
36 | set -x |
---|
37 | ./a.out |
---|
38 | rc=$? |
---|
39 | { set +x; } 2> /dev/null |
---|
40 | |
---|
41 | if [ $rc -gt 0 ]; then |
---|
42 | echo |
---|
43 | echo |
---|
44 | echo "TEST FAILURE: runtime crash on a case that should be accepted" |
---|
45 | echo |
---|
46 | echo |
---|
47 | |
---|
48 | exit 1 |
---|
49 | fi |
---|
50 | |
---|
51 | # 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 |
---|
52 | |
---|
53 | function verifyCompilationRejection() { |
---|
54 | set -x |
---|
55 | $compiler $1 &> /dev/null |
---|
56 | rc=$? |
---|
57 | |
---|
58 | { set +x; } 2> /dev/null |
---|
59 | |
---|
60 | if [ $rc -eq 0 ]; then |
---|
61 | echo |
---|
62 | echo |
---|
63 | echo "TEST FAILURE: compiler accepted case that should be rejected:" |
---|
64 | echo $1 |
---|
65 | echo |
---|
66 | echo |
---|
67 | |
---|
68 | # keep checking other cases |
---|
69 | fi |
---|
70 | } |
---|
71 | |
---|
72 | export -f verifyCompilationRejection |
---|
73 | export compiler |
---|
74 | |
---|
75 | ./a.out -cmd4skip | sed -E -n 's/skip.*\| *//p' | xargs -n 1 -I {} bash -c 'verifyCompilationRejection "$@"' _ {} |
---|