source: tests/array-container/dimexpr-match-detail.sh @ 402a1e7

Last change on this file since 402a1e7 was 0f4ac10, checked in by Michael Brooks <mlbrooks@…>, 17 months ago

Add tests demonstrating CFA's treatment of C arrays, compared with GCC's.

These tests recognize two levels of CFA functionality: Classic and Preview. This commit shows that CFA Master implements Classic. Preview refers to Mike's forthcoming changes.

Only the CFA part runs in the nightly build. Under CFA Classic, a limitation is that only some rejection cases are exercised in the nightly build. A hand-driven testing script can access all the cases and CFA Preview will exercise all the cases in the nightly build.

test dimexpr-match-c: how CFA's treatment of C arrays compares with GCC's

test dimexpr-match-cfa: how CFA's treamtment of <containers/array.hfa>-arrays aligns with the above

  • Property mode set to 100755
File size: 2.1 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# 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
17compiler=${1:-cfa}
18test=${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
21set -x
22$compiler $test
23rc=$?
24{ set +x; } 2> /dev/null
25
26if [ $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
34fi
35
36set -x
37./a.out
38rc=$?
39{ set +x; } 2> /dev/null
40
41if [ $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
49fi
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
53function 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
72export -f verifyCompilationRejection
73export compiler
74
75./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.