diff options
author | Dave Brolley <brolley@redhat.com> | 2010-02-15 13:59:24 -0500 |
---|---|---|
committer | Dave Brolley <brolley@redhat.com> | 2010-02-15 13:59:24 -0500 |
commit | ed8abf2763d68a4404477e6b09fee0fe4d591970 (patch) | |
tree | a62ef645c92a11d334115eb9bb72e0271fc75bc5 /testsuite | |
parent | 27dc09b13650456b7b3efd45c07690083e526b6d (diff) | |
parent | c8408b459b88a5aa5f4325e690aef95b5da7c2eb (diff) | |
download | systemtap-steved-ed8abf2763d68a4404477e6b09fee0fe4d591970.tar.gz systemtap-steved-ed8abf2763d68a4404477e6b09fee0fe4d591970.tar.xz systemtap-steved-ed8abf2763d68a4404477e6b09fee0fe4d591970.zip |
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/systemtap.apps/tcl.exp | 1 | ||||
-rw-r--r-- | testsuite/systemtap.base/labels.exp | 43 | ||||
-rw-r--r-- | testsuite/systemtap.maps/hist_in_string.exp | 8 | ||||
-rw-r--r-- | testsuite/systemtap.maps/hist_in_string.stp | 10 | ||||
-rw-r--r-- | testsuite/systemtap.server/client_args.exp | 28 | ||||
-rw-r--r-- | testsuite/systemtap.server/server_args.exp | 45 | ||||
-rwxr-xr-x | testsuite/systemtap.syscall/nd_sys.stp | 37 | ||||
-rw-r--r-- | testsuite/systemtap.syscall/nd_syscall.exp | 59 | ||||
-rw-r--r-- | testsuite/systemtap.syscall/sendfile.c | 8 | ||||
-rw-r--r-- | testsuite/systemtap.syscall/syscall.exp | 1 | ||||
-rwxr-xr-x | testsuite/systemtap.syscall/test.tcl | 4 |
11 files changed, 185 insertions, 59 deletions
diff --git a/testsuite/systemtap.apps/tcl.exp b/testsuite/systemtap.apps/tcl.exp index 4c4a4342..07409ccd 100644 --- a/testsuite/systemtap.apps/tcl.exp +++ b/testsuite/systemtap.apps/tcl.exp @@ -47,6 +47,7 @@ if {![installtest_p]} { set ok 0 set ko 0 +set xok 0 set lines 0 verbose -log "spawn stap -DMAXSKIPPED=8024 -t -c \"tcl/install/bin/tclsh${tclreleasemajor} tcl/src/tests/all.tcl > tcl-test.out\" $srcdir/$subdir/stap-tcl.stp tcl/install/bin/tclsh${tclreleasemajor} tcl/install/lib/libtcl${tclreleasemajor}.so" spawn stap -DMAXSKIPPED=8024 -t -c "tcl/install/bin/tclsh${tclreleasemajor} tcl/src/tests/all.tcl > tcl-test.out" $srcdir/$subdir/stap-tcl.stp tcl/install/bin/tclsh${tclreleasemajor} tcl/install/lib/libtcl${tclreleasemajor}.so diff --git a/testsuite/systemtap.base/labels.exp b/testsuite/systemtap.base/labels.exp index f759beef..01c3afbd 100644 --- a/testsuite/systemtap.base/labels.exp +++ b/testsuite/systemtap.base/labels.exp @@ -60,13 +60,13 @@ if { $res != "" } { set ok 0 spawn stap -l "process(\"$label_exepath\").function(\"foo@${label_srcpath}:10\").label(\"*\")" -wait expect { -timeout 180 -re {no match while resolving probe point} { incr ok; exp_continue } timeout { fail "$test (timeout)" } eof { } } +wait if {$ok == 1} { pass "$test :N .label" } { fail "$test :N .label $ok" } @@ -75,13 +75,13 @@ if {$ok == 1} { pass "$test :N .label" } { fail "$test :N .label $ok" } set ok 0 spawn stap -l "process(\"$label_exepath\").function(\"foo@${label_srcpath}:4\").label(\"*\")" -wait expect { -timeout 180 -re {process.*function.*labels.c:5...label..init_an_int} { incr ok; exp_continue } timeout { fail "$test (timeout)" } eof { } } +wait if {$ok == 1} { pass "$test :N .label" } { fail "$test :N .label $ok" } @@ -89,7 +89,6 @@ if {$ok == 1} { pass "$test :N .label" } { fail "$test :N .label $ok" } spawn stap -l "process(\"$label_exepath\").function(\"*\").label(\"*\")" -wait set ok 0 expect { -timeout 180 @@ -104,25 +103,28 @@ expect { timeout { fail "$test (timeout)" } eof { } } +wait if {$ok == 4} { pass "$test -l .label" } { fail "$test -l .label $ok" } -# label in an executable - -set ok 0 -verbose -log "spawn stap -c $label_exepath $label_stppath" -spawn stap -c $label_exepath $label_stppath - -wait -expect { - -timeout 180 - -re {VARS a=0x0 b=0x0.*init_an_int.*VARS a=0x2 b=0x0.*VARS a=0x2 b=0x3 c=0x[a-f01-9]} { incr ok; exp_continue } - timeout { fail "$test (timeout)" } - eof { } +# label in an executable (only if we have uprobes) +if {[uprobes_p]} { + set ok 0 + verbose -log "spawn stap -c $label_exepath $label_stppath" + spawn stap -c $label_exepath $label_stppath + + expect { + -timeout 180 + -re {VARS a=0x0 b=0x0.*init_an_int.*VARS a=0x2 b=0x0.*VARS a=0x2 b=0x3 c=0x[a-f01-9]} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } + } + wait + if {$ok == 1} { pass "$test exe .label" } { fail "$test exe .label $ok" } +} else { + untested "$test exe .label" } -if {$ok == 1} { pass "$test exe .label" } { fail "$test exe .label $ok" } - # address of label in an executable set label_shpath "[pwd]/label.sh" @@ -138,6 +140,8 @@ spawn sh $label_shpath expect { -re {0x[0-9a-f]*} } +wait + set nomatch 0 spawn stap -p2 -l "process\(\"$label_exepath\"\).statement($expect_out(0,string))" expect { @@ -146,6 +150,7 @@ expect { timeout { fail "$test (timeout)" } eof { } } +wait if {$nomatch == 0} { pass "$test exe .statement" } { fail "$test exe .statement" } @@ -171,6 +176,7 @@ expect { timeout { fail "$test (timeout)" } eof { } } +wait if {$ok == 1} { pass "$test so .label" } { fail "$test so .label $ok" } @@ -189,6 +195,8 @@ spawn sh $label_shpath expect { -re {0x[0-9a-f]*} } +wait + set nomatch 0 spawn stap -p2 -l "process\(\"$label_sopath\"\).statement($expect_out(0,string))" expect { @@ -197,6 +205,7 @@ expect { timeout { fail "$test (timeout)" } eof { } } +wait if {$nomatch == 0} { pass "$test so .statement" } { fail "$test so .statement" } diff --git a/testsuite/systemtap.maps/hist_in_string.exp b/testsuite/systemtap.maps/hist_in_string.exp new file mode 100644 index 00000000..02f201af --- /dev/null +++ b/testsuite/systemtap.maps/hist_in_string.exp @@ -0,0 +1,8 @@ +# test histogram printed to string + +set test "hist_in_string" +set ::result_string {value |-------------------------------------------------- count + 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 128 +} + +stap_run2 $srcdir/$subdir/$test.stp diff --git a/testsuite/systemtap.maps/hist_in_string.stp b/testsuite/systemtap.maps/hist_in_string.stp new file mode 100644 index 00000000..f9d0e81a --- /dev/null +++ b/testsuite/systemtap.maps/hist_in_string.stp @@ -0,0 +1,10 @@ +global l + +probe begin +{ + for (i = 0; i < 128; i++) + l <<< 0 + + print(sprint(@hist_linear(l, 0, 0, 1))) + exit() +} diff --git a/testsuite/systemtap.server/client_args.exp b/testsuite/systemtap.server/client_args.exp index f41b91cb..694d546d 100644 --- a/testsuite/systemtap.server/client_args.exp +++ b/testsuite/systemtap.server/client_args.exp @@ -5,33 +5,34 @@ set test "Invalid Server Client Arguments" set test_file $srcdir/systemtap.server/test.stp # Test invalid combinations. -set error_regexp ".*You can't specify .* when --unprivileged is specified.*" +set error_regexp ".*(ERROR)|(You can't specify .* when --unprivileged is specified).*" set invalid_options [list \ - "--unprivileged --client-options -a i386" \ "--unprivileged --client-options -B X=Y" \ "--unprivileged --client-options -D X=Y" \ "--unprivileged --client-options -I /tmp" \ "--unprivileged --client-options -m test" \ "--unprivileged --client-options -R /tmp" \ - "--unprivileged --client-options -r [exec uname -r]" \ - "--unprivileged --client-options -a i386 -B X=Y -D X=Y -I /tmp -m test -R /tmp -r [exec uname -r]" \ - "--client-options --unprivileged -a i386" \ + "--unprivileged --client-options -B X=Y -D X=Y -I /tmp -m test -R /tmp -r [exec uname -r]" \ "--client-options --unprivileged -B X=Y" \ "--client-options --unprivileged -D X=Y" \ "--client-options --unprivileged -I /tmp" \ "--client-options --unprivileged -m test" \ "--client-options --unprivileged -R /tmp" \ - "--client-options --unprivileged -r [exec uname -r]" \ - "--client-options --unprivileged -a i386 -B X=Y -D X=Y -I /tmp -m test -R /tmp -r [exec uname -r]" \ - "--client-options -a i386 --unprivileged" \ + "--client-options --unprivileged -B X=Y -D X=Y -I /tmp -m test -R /tmp -r [exec uname -r]" \ "--client-options -B X=Y --unprivileged" \ "--client-options -D X=Y --unprivileged" \ "--client-options -I /tmp --unprivileged" \ "--client-options -m test --unprivileged" \ "--client-options -R /tmp --unprivileged" \ - "--client-options -r [exec uname -r] --unprivileged" \ - "--client-options -a i386 -B X=Y -D X=Y -I /tmp -m test -R /tmp -r [exec uname -r] --unprivileged" \ + "--client-options -B X=Y -D X=Y -I /tmp -m test -R /tmp -r [exec uname -r] --unprivileged" \ + "--client-options -R /path" \ + "-D \"foo;bar\"" \ + "-D 2=4" \ + "-D \"foo;bar\"" \ + "--client-options -r /path" \ + "-S /path" \ + "--client-options -q" \ ] foreach options $invalid_options { @@ -66,9 +67,8 @@ set valid_options [list \ "-D X=Y" \ "-I /tmp" \ "-m test" \ - "-R /tmp" \ "-r [exec uname -r]" \ - "-a i386 -B X=Y -D X=Y -I /tmp -m test -R /tmp -r [exec uname -r]" \ + "-a i386 -B X=Y -D X=Y -I /tmp -m test -r [exec uname -r]" \ "--unprivileged" \ "--unprivileged -a i386" \ "--unprivileged -B X=Y" \ @@ -80,13 +80,11 @@ set valid_options [list \ "--unprivileged -a i386 -B X=Y -D X=Y -I /tmp -m test -R /tmp -r [exec uname -r]" \ "--client-options" \ "--client-options -a i386" \ - "--client-options -B X=Y" \ "--client-options -D X=Y" \ "--client-options -I /tmp" \ "--client-options -m test" \ - "--client-options -R /tmp" \ "--client-options -r [exec uname -r]" \ - "--client-options -a i386 -B X=Y -D X=Y -I /tmp -m test -R /tmp -r [exec uname -r]" \ + "--client-options -a i386 -D X=Y -I /tmp -m test -r [exec uname -r]" \ "--unprivileged --client-options" \ "--client-options --unprivileged" \ "--unprivileged -a i386 --client-options" \ diff --git a/testsuite/systemtap.server/server_args.exp b/testsuite/systemtap.server/server_args.exp index eac9074c..81a2c37b 100644 --- a/testsuite/systemtap.server/server_args.exp +++ b/testsuite/systemtap.server/server_args.exp @@ -114,27 +114,27 @@ if {[installtest_p]} then { # for debugging a currently failing case and helps to ensure that previously # fixed cases do not regress. set previously_fixed [list \ - "-p1 -I=\\w94\nbh -R'-1vo*w- -e -B9 -Dhfuo0iu7 -c" \ - "-p1 -I8o\\2ie -Rtu\\\n -e'1\\ -B*3x8k\; -D\n\" -c" \ - "-p1 -Ira\\3;c g -Rlr\"6/3ho -e0fle'qq -B -Dr/316k\\o8 -cjyoc\n3" \ - "-p1 -I6p3 -Rk3g-t\n89 -elc -Bd -Dqgsgv' -c" \ - "-p1 -I\"vyv;z -Rzvchje2\\ -ej\"/3 -Be -D/ 01qck\n -c3u55zut" \ - "-p1 -I1 -R\n -eo9e\nx047q -B\"*dd;tn\\ -D9xyefk0a -cvl98/x1'i" \ + "-p1 -I=\\w94\nbh -e -Dhfuo0iu7 -c" \ + "-p1 -I8o\\2ie -e'1\\ -D\n\" -c" \ + "-p1 -Ira\\3;c g -e0fle'qq -Dr/316k\\o8 -cjyoc\n3" \ + "-p1 -I6p3 -elc -Dqgsgv' -c" \ + "-p1 -I\"vyv;z -ej\"/3 -D/ 01qck\n -c3u55zut" \ + "-p1 -I1 -eo9e\nx047q -D9xyefk0a -cvl98/x1'i" \ "-p1 -c; test.stp" \ - "-p1 -I4hgy96 -R -e5oo39p -Bile\\vp -Ddx8v -c4;" \ - "-p1 -I -Repwd9 -esq3wors -Btmk;\\t -Dz -c*eibz8h2e" \ - "-p1 -I -Ry a -em339db5 -B;ae41428d -Du2;c0ps -ch9o\\" \ - "-p1 -Ipfjps4 -Rx479 -ebug4dc -Bih;fe2 -Du8vd fvkl -c" \ - "-p1 -I0\"nspzjyf -R -e5r3up8h -Bgqnyjq6w -Dmi;ojp9m -cx;a2fat" \ - "-p1 -Iu -R9 -ek7;r -Big -Dcu\"; -c\"hc" \ - "-p1 -Icd4fidq -Rkj m40mv -edn -B7ria -D;8ha\\cjr -c1*vnq" \ - "-p1 -I;3 -R3lq;vp -er8e -Bgdqjqdy -D -cb6k29z" \ - "-p1 -Ircj -R -e -B -D -c\\vmww" \ - "-p1 -Illc5 -Rug*\\o -e65wof9 -B qr*=x7x5 -D -cgx;" \ - "-p1 -Iyaj420=3 -R -e\" -Bx68j -D -cd'5mi" \ - "-p1 -Ir -Rwd8;;sjl -e -Bxh; -D29\\ -cj2szt;4" \ - "-p1 -Ibno3=b4sk -R*5 -e' -Byl63flos -Dg2-j;e -c2ijx'" \ - "-p1 -I285v7pl -R9a -eo5\\0 -Bfs* -D86s -c-c*v" \ + "-p1 -I4hgy96 -e5oo39p -Ddx8v -c4;" \ + "-p1 -I -esq3wors -Dz -c*eibz8h2e" \ + "-p1 -I a -em339db5 -Du2;c0ps -ch9o\\" \ + "-p1 -Ipfjps4 -ebug4dc -Du8vd fvkl -c" \ + "-p1 -I0\"nspzjyf -e5r3up8h -Dmi;ojp9m -cx;a2fat" \ + "-p1 -Iu -ek7;r -Dcu\"; -c\"hc" \ + "-p1 -Icd4fidq m40mv -edn -D;8ha\\cjr -c1*vnq" \ + "-p1 -I;3 -er8e -D -cb6k29z" \ + "-p1 -Ircj -e -D -c\\vmww" \ + "-p1 -Illc5 -e65wof9 qr*=x7x5 -D -cgx;" \ + "-p1 -Iyaj420=3 -e\" -D -cd'5mi" \ + "-p1 -Ir -e -D29\\ -cj2szt;4" \ + "-p1 -Ibno3=b4sk -e' -Dg2-j;e -c2ijx'" \ + "-p1 -I285v7pl -eo5\\0 -D86s -c-c*v" \ ] set i 0 @@ -150,7 +150,10 @@ foreach options $previously_fixed { # Generate semi-random arguments containing with potential problem characters. # Check that running systemtap with the client/server generates output # comparable to running stap directly. -set dangerous_options [list "-I" "-R" "-e" "-B" "-D" "-c"] +set dangerous_options [list "-I" "-e" "-D" "-c" "-S"] +# NB: Other options could be candidates here, like -r and -B, but +# there stap-server imposes more restrictions than local stap, so +# this simple error-matching test cannot use them. set argchars "0123456789/;*'=-\\\"\n abcdefghijklmnopqrstuvwxyz" for {set i 0} {$i < $iterations} {incr i} { diff --git a/testsuite/systemtap.syscall/nd_sys.stp b/testsuite/systemtap.syscall/nd_sys.stp new file mode 100755 index 00000000..5936cb77 --- /dev/null +++ b/testsuite/systemtap.syscall/nd_sys.stp @@ -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 index 00000000..4aefcf4b --- /dev/null +++ b/testsuite/systemtap.syscall/nd_syscall.exp @@ -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 diff --git a/testsuite/systemtap.syscall/sendfile.c b/testsuite/systemtap.syscall/sendfile.c index 690d078e..a21694fe 100644 --- a/testsuite/systemtap.syscall/sendfile.c +++ b/testsuite/systemtap.syscall/sendfile.c @@ -14,7 +14,7 @@ int main () int write_fd; struct stat stat_buf; off_t offset = 0; - char buff[512]; + char buff[22]; // Note below 22 == EINVAL int ret; memset(buff, 5, sizeof(buff)); @@ -32,11 +32,11 @@ int main () write_fd = creat("foobar2",S_IREAD|S_IWRITE|S_IRWXO); /* - * For kernel2.6 the write_fd has to be a socket otherwise - * sendfile will fail. So we test for failure here. + * For 2.6 the write_fd had to be a socket otherwise + * sendfile would fail. So we also test for failure here. */ ret = sendfile (write_fd, read_fd, &offset, stat_buf.st_size); - //staptest// sendfile (NNNN, NNNN, XXXX, 512) = -22 (EINVAL) + //staptest// sendfile (NNNN, NNNN, XXXX, 22) = -?22 close (read_fd); close (write_fd); diff --git a/testsuite/systemtap.syscall/syscall.exp b/testsuite/systemtap.syscall/syscall.exp index a4978997..3316c4a5 100644 --- a/testsuite/systemtap.syscall/syscall.exp +++ b/testsuite/systemtap.syscall/syscall.exp @@ -1,3 +1,4 @@ +set test_script "sys.stp" source $srcdir/$subdir/test.tcl proc test_procedure {} { diff --git a/testsuite/systemtap.syscall/test.tcl b/testsuite/systemtap.syscall/test.tcl index 9d620d74..477fae70 100755 --- a/testsuite/systemtap.syscall/test.tcl +++ b/testsuite/systemtap.syscall/test.tcl @@ -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 |