]> sourceware.org Git - systemtap.git/commitdiff
Fixed PR 11270 by adding nd_syscall testcase.
authorDavid Smith <dsmith@redhat.com>
Wed, 10 Feb 2010 22:35:46 +0000 (16:35 -0600)
committerDavid Smith <dsmith@redhat.com>
Wed, 10 Feb 2010 22:35:46 +0000 (16:35 -0600)
* testsuite/systemtap.syscall/test.tcl: Now uses global variable
  'test_script' to find test script to run.
* testsuite/systemtap.syscall/syscall.exp: Sets test_script.
* testsuite/systemtap.syscall/nd_sys.stp: New test script.  Copy of
  sys.stp, but uses nd_syscall probes.
* testsuite/systemtap.syscall/nd_syscall.exp: New testcase.  Copy of
  syscall.exp, but uses nd_sys.stp test script.

testsuite/systemtap.syscall/nd_sys.stp [new file with mode: 0755]
testsuite/systemtap.syscall/nd_syscall.exp [new file with mode: 0644]
testsuite/systemtap.syscall/syscall.exp
testsuite/systemtap.syscall/test.tcl

diff --git a/testsuite/systemtap.syscall/nd_sys.stp b/testsuite/systemtap.syscall/nd_sys.stp
new file mode 100755 (executable)
index 0000000..5936cb7
--- /dev/null
@@ -0,0 +1,37 @@
+global indent, indent_str, entry_p
+
+probe begin {
+       indent = 0
+       for (i=0; i<20; i++) {
+               if (i == 0)
+                       indent_str[0] = ""
+               else
+                       indent_str[i] =  indent_str[i-1] . "  "
+       }
+}
+
+
+probe nd_syscall.* ? {
+       if (pid() == target()) {
+               if (entry_p) printf("\n")
+               printf("%s%s: %s (%s) = ", indent_str[indent], execname(), name, argstr)
+#              printf("%s%s: %s (%s) = ", indent_str[indent], execname(), probefunc(), argstr)
+               indent++
+               entry_p = 1
+       }
+}
+
+probe nd_syscall.*.return ? {
+       if (pid() == target()) {
+               if (indent) indent--
+               if (entry_p)
+                       printf("%s\n", retstr)
+               else
+                       printf("%s%s\n", indent_str[indent],retstr)
+               entry_p = 0
+       }
+}
+
+probe end {
+       printf("\n")
+}
diff --git a/testsuite/systemtap.syscall/nd_syscall.exp b/testsuite/systemtap.syscall/nd_syscall.exp
new file mode 100644 (file)
index 0000000..4aefcf4
--- /dev/null
@@ -0,0 +1,59 @@
+set test_script "nd_sys.stp"
+source $srcdir/$subdir/test.tcl
+
+proc test_procedure {} {
+    global srcdir subdir
+    set wd [pwd]
+    set flags ""
+    if {$srcdir == ""} {
+       set pattern "*.c"
+    } else {
+       set pattern "$srcdir/$subdir/*.c"
+    }
+
+    # 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:
+    # echo "puts $::tcl_platform(machine)" | tclsh
+
+    switch -regexp $::tcl_platform(machine) {
+       ^ia64$ {
+           set do_64_bit_pass 1
+           set flags "" 
+       }
+       ^(x86_64|ppc64|s390x)$ { 
+           set do_64_bit_pass 1
+           set flags "additional_flags=-m64"
+       }
+       default {
+           set do_64_bit_pass 0
+       }
+    }
+
+    if {$do_64_bit_pass} {
+       foreach filename [lsort [glob $pattern]] {
+           set testname [file tail [string range $filename 0 end-2]]
+           if {![installtest_p]} { untested "64-bit $testname"; continue }
+           send_log "Testing 64-bit ${testname}\n"
+           run_one_test $filename $flags 64
+       }
+    }
+
+    set do_32_bit_pass 1    
+    switch -regexp $::tcl_platform(machine) {
+       {^(x86_64|ppc64)$} { set flags "additional_flags=-m32" }
+       {^s390x$} { set flags "additional_flags=-m31" }
+       {^ia64$} { set do_32_bit_pass 0 }
+    }
+
+    if {$do_32_bit_pass} {
+       foreach filename [lsort [glob $pattern]] {
+           set testname [file tail [string range $filename 0 end-2]]
+           if {![installtest_p]} { untested "32-bit $testname"; continue }
+           send_log "Testing 32-bit ${testname}\n"
+           run_one_test $filename $flags 32
+       }
+    }
+}
+
+test_procedure
index a49789972d5c1cf2cbf58e6a74a40356dd030265..3316c4a52645d84ec5df59b531854c3c8a1005e4 100644 (file)
@@ -1,3 +1,4 @@
+set test_script "sys.stp"
 source $srcdir/$subdir/test.tcl
 
 proc test_procedure {} {
index 9d620d74dfe3852f587be0655d398ad21f7c01b6..477fae7001e35d9450d491650f1cac4fe8af9820 100755 (executable)
@@ -27,7 +27,7 @@ proc bgerror {error} {
 trap {cleanup_and_exit} SIGINT
 
 proc run_one_test {filename flags bits} {
-    global dir current_dir
+    global dir current_dir test_script
 
     set testname [file tail [string range $filename 0 end-2]]
 
@@ -43,7 +43,7 @@ proc run_one_test {filename flags bits} {
       return
     }
 
-    set sys_prog "[file dirname [file normalize $filename]]/sys.stp"
+    set sys_prog "[file dirname [file normalize $filename]]/${test_script}"
     set cmd "stap --skip-badvars -c $dir/${testname} ${sys_prog}"
     
     # Extract additional C flags needed to compile
This page took 0.03106 seconds and 5 git commands to generate.