From 661d7bed2e686e2b8c0af21be4d661c7d0ad4265 Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 12 Feb 2014 12:58:41 -0600 Subject: [PATCH] Fix PR16570 by speeding up the syscall.exp/nd_syscall.exp testcases. * testsuite/systemtap.syscall/syscall.exp: Compile the module once. * testsuite/systemtap.syscall/nd_syscall.exp: Ditto. * testsuite/systemtap.syscall/test.tcl (run_one_test): Use staprun to load the previously compiled module. --- testsuite/systemtap.syscall/nd_syscall.exp | 26 ++++++++++++++++++++- testsuite/systemtap.syscall/syscall.exp | 27 ++++++++++++++++++++-- testsuite/systemtap.syscall/test.tcl | 5 ++-- 3 files changed, 52 insertions(+), 6 deletions(-) diff --git a/testsuite/systemtap.syscall/nd_syscall.exp b/testsuite/systemtap.syscall/nd_syscall.exp index 0cc221b92..5b8e0fccb 100644 --- a/testsuite/systemtap.syscall/nd_syscall.exp +++ b/testsuite/systemtap.syscall/nd_syscall.exp @@ -1,8 +1,12 @@ set test_script "nd_sys.stp" +set test_module_name "nd_syscall" +set wd [pwd] +set test_module "${wd}/${test_module_name}.ko" + source $srcdir/$subdir/test.tcl proc test_procedure {} { - global srcdir subdir + global srcdir subdir test_script test_module test_module_name set wd [pwd] set flags "" if {$srcdir == ""} { @@ -11,6 +15,23 @@ proc test_procedure {} { set pattern "$srcdir/$subdir/*.c" } + # To speed things up, go ahead and compile the test module once + # here, then just use it down in run_one_test(). The test script + # uses wildcards to cover every syscall and takes time to parse. + set script "$srcdir/$subdir/${test_script}" + set cmd "stap -p4 -m ${test_module_name} --skip-badvars ${script}" + exec /bin/rm -f ${test_module} + catch {eval exec $cmd} output + send_log $output + if {[file exists ${test_module}]} { + pass "${script} compilation" + } else { + # If compiling the test module failed, there isn't much point + # in trying to run any of the real tests. + fail "${script} compilation" + return + } + # for first pass, force 64-bit compilation for 64-bit systems # Add any other 64-bit arcvhitecture you want tested below. # To find tcl's platform name for your machine, run the following: @@ -58,6 +79,9 @@ proc test_procedure {} { run_one_test $filename $flags 32 "nd_syscall" } } + + # Cleeanup + exec /bin/rm -f ${test_module} } test_procedure diff --git a/testsuite/systemtap.syscall/syscall.exp b/testsuite/systemtap.syscall/syscall.exp index 7f67ff507..630917021 100644 --- a/testsuite/systemtap.syscall/syscall.exp +++ b/testsuite/systemtap.syscall/syscall.exp @@ -1,9 +1,12 @@ set test_script "sys.stp" +set test_module_name "syscall" +set wd [pwd] +set test_module "${wd}/${test_module_name}.ko" + source $srcdir/$subdir/test.tcl proc test_procedure {} { - global srcdir subdir - set wd [pwd] + global srcdir subdir test_script test_module test_module_name set flags "" if {$srcdir == ""} { set pattern "*.c" @@ -11,6 +14,23 @@ proc test_procedure {} { set pattern "$srcdir/$subdir/*.c" } + # To speed things up, go ahead and compile the test module once + # here, then just use it down in run_one_test(). The test script + # uses wildcards to cover every syscall and takes time to parse. + set script "$srcdir/$subdir/${test_script}" + set cmd "stap -p4 -m ${test_module_name} --skip-badvars ${script}" + exec /bin/rm -f ${test_module} + catch {eval exec $cmd} output + send_log $output + if {[file exists ${test_module}]} { + pass "${script} compilation" + } else { + # If compiling the test module failed, there isn't much point + # in trying to run any of the real tests. + fail "${script} compilation" + return + } + # for first pass, force 64-bit compilation for 64-bit systems # Add any other 64-bit arcvhitecture you want tested below. # To find tcl's platform name for your machine, run the following: @@ -54,6 +74,9 @@ proc test_procedure {} { run_one_test $filename $flags 32 "syscall" } } + + # Cleeanup + exec /bin/rm -f ${test_module} } test_procedure diff --git a/testsuite/systemtap.syscall/test.tcl b/testsuite/systemtap.syscall/test.tcl index a44363899..6b7436423 100644 --- a/testsuite/systemtap.syscall/test.tcl +++ b/testsuite/systemtap.syscall/test.tcl @@ -27,7 +27,7 @@ proc bgerror {error} { trap {syscall_cleanup_and_exit} SIGINT proc run_one_test {filename flags bits suite} { - global syscall_dir current_dir test_script + global syscall_dir current_dir test_module set testname [file tail [string range $filename 0 end-2]] @@ -46,8 +46,7 @@ proc run_one_test {filename flags bits suite} { return } - set sys_prog "[file dirname [file normalize $filename]]/${test_script}" - set cmd "stap --skip-badvars -c $syscall_dir/${testname} ${sys_prog}" + set cmd "staprun ${test_module} -c $syscall_dir/${testname}" # Extract additional C flags needed to compile set add_flags "" -- 2.43.5