From 059cd9efbd82e1017406a7a290a2fb9f6bfb64f7 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Thu, 30 Apr 2009 17:07:43 -0400 Subject: syscalls testsuite: use different escape sequence The syscall testsuite uses embedded "// TEXT" markers in the .c files to designate expected output, kind of like the "dg-" bunch in the gcc test suite. Unfortunately, "//" is not a unique prefix to systemtap tests, and in particular it can occur in the system headers that will be picked up with the "gcc -E -C ..." invocation in test.tcl. So let's switch to "//staptest//". test.tcl is also modified to escape a few more mischevious regexp metacharacters that might sneak past. --- testsuite/systemtap.syscall/test.tcl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'testsuite/systemtap.syscall/test.tcl') diff --git a/testsuite/systemtap.syscall/test.tcl b/testsuite/systemtap.syscall/test.tcl index db0df138..efe48d20 100755 --- a/testsuite/systemtap.syscall/test.tcl +++ b/testsuite/systemtap.syscall/test.tcl @@ -40,22 +40,26 @@ proc run_one_test {filename flags} { target_compile $filename $dir/$testname executable $flags set sys_prog "[file dirname [file normalize $filename]]/sys.stp" - set cmd "stap -c $dir/${testname} ${sys_prog}" + set cmd "stap --skip-badvars -c $dir/${testname} ${sys_prog}" # Extract the expected results # Use the preprocessor so we can ifdef tests in and out set ccmd "gcc -E -C -P $filename" + # XXX: but note, this will expand all system headers too! catch {eval exec $ccmd} output set ind 0 foreach line [split $output "\n"] { - if {[regsub {//} $line {} line]} { + if {[regsub {//staptest//} $line {} line]} { set line "$testname: [string trimleft $line]" - + + # We need to quote all these metacharacters regsub -all {\(} $line {\\(} line - regsub -all {\)} $line {\\)} line + regsub -all {\)} $line {\\)} line regsub -all {\|} $line {\|} line + regsub -all {\+} $line {\\+} line + regsub -all {\*} $line {\\*} line regsub -all NNNN $line {[\-0-9]+} line regsub -all XXXX $line {[x0-9a-fA-F]+} line @@ -78,6 +82,7 @@ proc run_one_test {filename flags} { set i 0 foreach line [split $output "\n"] { + # send_log "Comparing $results($i) against $line" if {[regexp $results($i) $line]} { incr i if {$i >= $ind} {break} -- cgit From 823001c193485dd81d43c2b6af071d57b1eec769 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 3 May 2009 08:05:43 +0200 Subject: systemtap.syscall tests do use + and * as metachars. + and * are metacharacters, but should always be used as metacharacters in the expressions, don't escape them. * testsuite/systemtap.syscall/test.tcl (run_one_test): Remove escaping of + and *. --- testsuite/systemtap.syscall/test.tcl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'testsuite/systemtap.syscall/test.tcl') diff --git a/testsuite/systemtap.syscall/test.tcl b/testsuite/systemtap.syscall/test.tcl index efe48d20..a458914b 100755 --- a/testsuite/systemtap.syscall/test.tcl +++ b/testsuite/systemtap.syscall/test.tcl @@ -58,8 +58,10 @@ proc run_one_test {filename flags} { regsub -all {\(} $line {\\(} line regsub -all {\)} $line {\\)} line regsub -all {\|} $line {\|} line - regsub -all {\+} $line {\\+} line - regsub -all {\*} $line {\\*} line + # + and * are metacharacters, but should always be used + # as metacharacters in the expressions, don't escape them. + #regsub -all {\+} $line {\\+} line + #regsub -all {\*} $line {\\*} line regsub -all NNNN $line {[\-0-9]+} line regsub -all XXXX $line {[x0-9a-fA-F]+} line -- cgit From 9f27bd8143604a815b11b48ca054e03f78bdf69e Mon Sep 17 00:00:00 2001 From: Eugeniy Meshcheryakov Date: Tue, 5 May 2009 21:27:10 +0200 Subject: Fix arguments to mktemp with less than 6 X's --- testsuite/systemtap.syscall/test.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testsuite/systemtap.syscall/test.tcl') diff --git a/testsuite/systemtap.syscall/test.tcl b/testsuite/systemtap.syscall/test.tcl index a458914b..8a5801af 100755 --- a/testsuite/systemtap.syscall/test.tcl +++ b/testsuite/systemtap.syscall/test.tcl @@ -32,7 +32,7 @@ proc run_one_test {filename flags} { set testname [file tail [string range $filename 0 end-2]] set result "UNSUPP" - if {[catch {exec mktemp -d [pwd]/staptestXXXXX} dir]} { + if {[catch {exec mktemp -d [pwd]/staptestXXXXXX} dir]} { puts stderr "Failed to create temporary directory: $dir" cleanup } -- cgit