| 1 |
# tp_syscall.exp |
| 2 |
# |
| 3 |
# This script searches the systemtap.syscall directory for C files to |
| 4 |
# test. See the README file for details on the C files. |
| 5 |
# |
| 6 |
# To restrict C files to test, set the CHECK_ONLY environment variable. |
| 7 |
# For example, to only test the readwrite and accept C files, run: |
| 8 |
# |
| 9 |
# make installcheck RUNTESTFLAGS=tp_syscall.exp CHECK_ONLY="readwrite accept" |
| 10 |
|
| 11 |
set test_script "tp_sys.stp" |
| 12 |
set test_module_name "tp_syscall_longlonglong" |
| 13 |
set wd [pwd] |
| 14 |
set test_module "${wd}/${test_module_name}.ko" |
| 15 |
|
| 16 |
source $srcdir/$subdir/test.tcl |
| 17 |
|
| 18 |
proc test_procedure {} { |
| 19 |
global env srcdir subdir test_script test_module test_module_name |
| 20 |
set flags "" |
| 21 |
|
| 22 |
set patterns [] |
| 23 |
if {[info exists env(CHECK_ONLY)]} { |
| 24 |
foreach file $env(CHECK_ONLY) { |
| 25 |
lappend patterns "$file.c" |
| 26 |
} |
| 27 |
} else { |
| 28 |
lappend patterns "*.c" |
| 29 |
} |
| 30 |
|
| 31 |
if {$srcdir == ""} { |
| 32 |
set basedir "" |
| 33 |
} else { |
| 34 |
set basedir "$srcdir/$subdir/" |
| 35 |
} |
| 36 |
|
| 37 |
set test_files [] |
| 38 |
foreach pattern $patterns { |
| 39 |
set test_files [concat $test_files \ |
| 40 |
[glob -nocomplain "${basedir}${pattern}"]] |
| 41 |
} |
| 42 |
|
| 43 |
if {[llength $test_files] == 0} { |
| 44 |
# If our globbing didn't find any test files, there isn't any |
| 45 |
# point in proceeding. |
| 46 |
fail "$test_module_name: no tests found" |
| 47 |
return |
| 48 |
} |
| 49 |
|
| 50 |
# To speed things up, go ahead and compile the test module once |
| 51 |
# here, then just use it down in run_one_test(). The test script |
| 52 |
# uses wildcards to cover every syscall and takes time to parse. |
| 53 |
# |
| 54 |
# Note that at one point we were passing '--skip-badvars' when |
| 55 |
# compiling the syscall module. This tends to hide errors and not |
| 56 |
# give errors when we expect them. |
| 57 |
set script "$srcdir/$subdir/${test_script}" |
| 58 |
set cmd "stap -p4 -I $srcdir/$subdir/tapset -m ${test_module_name} ${script}" |
| 59 |
exec /bin/rm -f ${test_module} |
| 60 |
catch {eval exec $cmd} output |
| 61 |
send_log "${output}\n" |
| 62 |
if {[file exists ${test_module}]} { |
| 63 |
pass "[file tail ${script}] compilation" |
| 64 |
} else { |
| 65 |
# If compiling the test module failed, there isn't much point |
| 66 |
# in trying to run any of the real tests. |
| 67 |
fail "[file tail ${script}] compilation" |
| 68 |
return |
| 69 |
} |
| 70 |
|
| 71 |
for {set i 0} {$i < [arch_compile_flags]} {incr i} { |
| 72 |
set flags [arch_compile_flag $i] |
| 73 |
set arch [arch_compile_flag_name $i] |
| 74 |
set arch_size [arch_compile_flag_bits $i] |
| 75 |
|
| 76 |
foreach filename [lsort $test_files] { |
| 77 |
set testname [file tail [string range $filename 0 end-2]] |
| 78 |
if {![installtest_p]} { |
| 79 |
untested "${arch_size}-bit $testname"; continue |
| 80 |
} |
| 81 |
send_log "Testing ${arch_size}-bit ${testname} tp_syscall\n" |
| 82 |
run_one_test $filename $flags ${arch_size} "tp_syscall" |
| 83 |
} |
| 84 |
} |
| 85 |
|
| 86 |
# Cleeanup |
| 87 |
exec /bin/rm -f ${test_module} |
| 88 |
} |
| 89 |
|
| 90 |
test_procedure |