| 1 |
set self parse-semko |
| 2 |
set test_suffix "parse-semko" |
| 3 |
|
| 4 |
# Make sure that we can *parse* all semko test files, to ensure that |
| 5 |
# it is semantic (elaboration) (-p2) checks that fail, not parse |
| 6 |
# errors (-p1). |
| 7 |
|
| 8 |
foreach file [lsort [glob -nocomplain $srcdir/semko/*.stp]] { |
| 9 |
set test "semko/[file tail $file]" |
| 10 |
set full_test "${test} ${test_suffix}" |
| 11 |
|
| 12 |
# Most of the test cases use '#! stap ...'. Try to read this |
| 13 |
# information. |
| 14 |
set f [open $file r] |
| 15 |
set firstbits [gets $f] |
| 16 |
close $f |
| 17 |
if {[regexp -line {\#! (stap .+)} $firstbits -> stap_cmd]} { |
| 18 |
# First, we need to substitute pass 1 for pass 2. |
| 19 |
if {! [regsub {p2} $stap_cmd {p1} stap_cmd]} { |
| 20 |
fail "${full_test} - pass 1 substitute" |
| 21 |
continue |
| 22 |
} |
| 23 |
pass "${full_test} - pass 1 substitute" |
| 24 |
|
| 25 |
# Now run the script using '-p1'. |
| 26 |
set cmd [concat ${stap_cmd} ${file}] |
| 27 |
verbose -log "Running $cmd" |
| 28 |
if {[catch {eval exec ${cmd}} res]} { |
| 29 |
verbose -log "$res" |
| 30 |
fail "${full_test} - parsing" |
| 31 |
continue |
| 32 |
} |
| 33 |
pass "${full_test} - parsing" |
| 34 |
} else { |
| 35 |
# If "stap" wasn't on the first line of the script, this isn't |
| 36 |
# a systemtap script, but a shell script that will run |
| 37 |
# systemtap. We'll have to skip these. |
| 38 |
untested "$full_test - shell script" |
| 39 |
continue |
| 40 |
} |
| 41 |
} |