From 2e526dabcf4b15fb102e295b282df3af54d5c9d3 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Mon, 19 Oct 2009 11:33:24 -0400 Subject: PR10799: warn on possibly uintended local-vs-global namespace collision * elaborate.cxx (find_var): Take extra token parameter. Look for cross-file global variable resolution, signal a warning. * testsuite/systemtap.examples/io/traceio2.stp: Fix it. * testsuite/systemtap.syscall/sys.stp: Fix it. * NEWS: Document it. --- testsuite/systemtap.examples/io/traceio2.stp | 2 +- testsuite/systemtap.syscall/sys.stp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'testsuite') diff --git a/testsuite/systemtap.examples/io/traceio2.stp b/testsuite/systemtap.examples/io/traceio2.stp index 1abea45d..797f3062 100755 --- a/testsuite/systemtap.examples/io/traceio2.stp +++ b/testsuite/systemtap.examples/io/traceio2.stp @@ -1,6 +1,6 @@ #! /usr/bin/env stap -global device_of_interest, dev +global device_of_interest probe begin { /* The following is not the most efficient way to do this. diff --git a/testsuite/systemtap.syscall/sys.stp b/testsuite/systemtap.syscall/sys.stp index e3564a15..79c7ff57 100755 --- a/testsuite/systemtap.syscall/sys.stp +++ b/testsuite/systemtap.syscall/sys.stp @@ -1,4 +1,4 @@ -global indent, indent_str, entry +global indent, indent_str, entry_p probe begin { indent = 0 @@ -13,22 +13,22 @@ probe begin { probe syscall.* ? { if (pid() == target()) { - if (entry) printf("\n") + 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 = 1 + entry_p = 1 } } probe syscall.*.return ? { if (pid() == target()) { if (indent) indent-- - if (entry) + if (entry_p) printf("%s\n", retstr) else printf("%s%s\n", indent_str[indent],retstr) - entry = 0 + entry_p = 0 } } -- cgit From f10d126854eec887ddef18b1d04a8b5ec6505d65 Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Sun, 18 Oct 2009 22:26:27 -0400 Subject: Add testsuite for tcl sdt markers. dtrace.in (provider::generate): Set enabled to true until .so is resolved. tcl.exp: New testsuite for tcl sdt markers modelled after mysql. --- testsuite/systemtap.base/tcl.exp | 165 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 testsuite/systemtap.base/tcl.exp (limited to 'testsuite') diff --git a/testsuite/systemtap.base/tcl.exp b/testsuite/systemtap.base/tcl.exp new file mode 100644 index 00000000..7e21091a --- /dev/null +++ b/testsuite/systemtap.base/tcl.exp @@ -0,0 +1,165 @@ +set test "tcl" + +# Test sdt support in tcl. + +global env + +if {! [info exists env(SYSTEMTAP_TEST_SDT)]} { + unsupported "tcl (\"SYSTEMTAP_TEST_SDT\" not in env)" + return +} + +########## Create /tmp/stap-tcl.stp ########## +set tclreleasemajor "8.6" +set tclrelease "8.6b1" +set tcldir "[pwd]/tcl/install/" +set testsuite "[pwd]" + +set fp [open "$testsuite/stap-tcl.stp" "w"] +puts $fp " +probe process(@1).mark(\"proc__entry\") +{ + printf (\"%s %#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3) +} +probe process(@1).mark(\"proc__return\") +{ + printf (\"%s %#x,%#x\\n\",\$\$name, \$arg1,\$arg2) +} +probe process(@1).mark(\"proc__result\") +{ + printf (\"%s %#x,%#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3,\$arg4) +} +probe process(@1).mark(\"proc__args\") +{ + printf (\"%s %#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3,\$arg4,\$arg5,\$arg6,\$arg7,\$arg8,\$arg9,\$arg10) +} +probe process(@1).mark(\"proc__info\") +{ + printf (\"%s %#x,%#x,%#x,%#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3,\$arg4,\$arg5,\$arg6) +} +probe process(@1).mark(\"cmd__entry\") +{ + printf (\"%s %#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3) +} +probe process(@1).mark(\"cmd__return\") +{ + printf (\"%s %#x,%#x\\n\",\$\$name, \$arg1,\$arg2) +} +probe process(@1).mark(\"cmd__result\") +{ + printf (\"%s %#x,%#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3,\$arg4) +} +probe process(@1).mark(\"cmd__args\") +{ + printf (\"%s %#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3,\$arg4,\$arg5,\$arg6,\$arg7,\$arg8,\$arg9,\$arg10) +} +probe process(@1).mark(\"cmd__info\") +{ + printf (\"%s %#x,%#x,%#x,%#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3,\$arg4,\$arg5,\$arg6) +} +probe process(@1).mark(\"inst__start\") +{ + printf (\"%s %#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3) +} +probe process(@1).mark(\"inst__done\") +{ + printf (\"%s %#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3) +} +probe process(@1).mark(\"obj__create\") +{ + printf (\"%s %#x\\n\",\$\$name, \$arg1) +} +probe process(@1).mark(\"obj__free\") +{ + printf (\"%s %#x\\n\",\$\$name, \$arg1) +} +probe process(@1).mark(\"tcl__probe\") +{ + printf (\"%s %#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3,\$arg4,\$arg5,\$arg6,\$arg7,\$arg8,\$arg9,\$arg10) +} +" +close $fp + +########## Begin /tmp/stap-tcl.sh ########## +set fp [open "$testsuite/stap-tcl.sh" "w"] +puts $fp " +##### begin run_tests ##### +function run_tests \{ +(cd $tcldir/.. +MOD=stapsdt_\$(date +%j%k%M%N | sed 's/ //') +/work/scox/virginsystemtap/install/bin/stap -m \$MOD -c install/bin/tclsh$tclreleasemajor $testsuite/stap-tcl.stp $testsuite/tcl/install/lib//libtcl$tclreleasemajor.so << END >$testsuite/stap-tcl-markers.log 2>&1 +source src/tests/all.tcl +quit +END +) + +PROC_ENTRY=\$(grep 'proc__entry' $testsuite/stap-tcl-markers.log | wc -l) +PROC_RETURN=\$(grep 'proc__return' $testsuite/stap-tcl-markers.log | wc -l) +PROC_RESULT=\$(grep 'proc__result' $testsuite/stap-tcl-markers.log | wc -l) +PROC_ARGS=\$(grep 'proc__args' $testsuite/stap-tcl-markers.log | wc -l) +PROC_INFO=\$(grep 'proc__info' $testsuite/stap-tcl-markers.log | wc -l) +CMD_ENTRY=\$(grep 'cmd__entry' $testsuite/stap-tcl-markers.log | wc -l) +CMD_RETURN=\$(grep 'cmd__return' $testsuite/stap-tcl-markers.log | wc -l) +CMD_RESULT=\$(grep 'cmd__result' $testsuite/stap-tcl-markers.log | wc -l) +CMD_ARGS=\$(grep 'cmd__args' $testsuite/stap-tcl-markers.log | wc -l) +CMD_INFO=\$(grep 'cmd__info' $testsuite/stap-tcl-markers.log | wc -l) +INST_START=\$(grep 'inst__start' $testsuite/stap-tcl-markers.log | wc -l) +INST_DONE=\$(grep 'inst__done' $testsuite/stap-tcl-markers.log | wc -l) +OBJ_CREATE=\$(grep 'obj__create' $testsuite/stap-tcl-markers.log | wc -l) +OBJ_FREE=\$(grep 'obj__free' $testsuite/stap-tcl-markers.log | wc -l) + +echo PROC_ENTRY=\$PROC_ENTRY PROC_RETURN=\$PROC_RETURN PROC_RESULT=\$PROC_RESULT PROC_ARGS=\$PROC_ARGS PROC_INFO=\$PROC_INFO CMD_ENTRY=\$CMD_ENTRY CMD_RETURN=\$CMD_RETURN CMD_RESULT=\$CMD_RESULT CMD_ARGS=\$CMD_ARGS CMD_INFO=\$CMD_INFO INST_START=\$INST_START INST_DONE=\$INST_DONE OBJ_CREATE=\$OBJ_CREATE OBJ_FREE=\$OBJ_FREE + +if \[ \$PROC_ENTRY -gt 9000 -a \$PROC_RETURN -gt 9000 -a \$PROC_RESULT -gt 9000 -a \$PROC_ARGS -gt 9000 -a \$PROC_INFO -gt 9000 -a \$CMD_ENTRY -gt 37000 -a \$CMD_RETURN -gt 37000 -a \$CMD_RESULT -gt 37000 -a \$CMD_ARGS -gt 3700 -a \$CMD_INFO -gt 37000 -a \$INST_START -gt 542000 -a \$INST_DONE -gt 542000 -a \$OBJ_CREATE -gt 723000 -a \$OBJ_FREE -gt 704000 \] ; then + echo PASS: tcl markers \$1 +else + echo FAIL: tcl markers \$1 +fi + +\} +##### end run_tests ##### + +if \[ ! -r tcl$tclrelease-src.tar.gz \] ; then +wget http://sourceforge.net/projects/tcl/files/Tcl/$tclrelease/tcl$tclrelease-src.tar.gz/download +fi + +if \[ ! -d tcl/src \] ; then +tar -x -z -f tcl$tclrelease-src.tar.gz +mkdir tcl +mv tcl$tclrelease tcl/src +fi + +if \[ ! -d tcl/install/bin \] ; then +cd tcl/src/unix +./configure --prefix=$tcldir --enable-dtrace CFLAGS='-I$env(SYSTEMTAP_INCLUDES) -g' + +make -j2 +make install +fi + +run_tests uprobe +" +########## End /tmp/stap-tcl.sh ########## +close $fp + +########## /tmp/stap-tcl.sh does most of the work ########## +verbose -log Running tcl testsuite +spawn sh stap-tcl.sh 2>&1 +expect { + -timeout 1000 + -re {FAIL: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s; + fail "$s"; exp_continue } + -re {PASS: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s; + pass "$s"; exp_continue } + -re {UNSUPPORTED: [a-zA-Z_/: ]+} { regexp " .*$" $expect_out(0,string) s; + verbose -log "$s" + unsupported "$s"; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} + +if { $verbose == 0 } { +catch {exec rm -rf $testsuite/stap-tcl.stp tcl$tclrelease-src.tar.gz \ + $testsuite/stap-tcl-markers.log $testsuite/stap-tcl.sh } +catch {exec rm -rf tcl} +} -- cgit From 1c0b2b1591333280015fc97ce5736d523b0fd0dc Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Tue, 20 Oct 2009 06:56:31 -0400 Subject: tcl.exp path fix. tcl.exp (run_tests): Fix stap path. --- testsuite/systemtap.base/tcl.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testsuite') diff --git a/testsuite/systemtap.base/tcl.exp b/testsuite/systemtap.base/tcl.exp index 7e21091a..5e51609d 100644 --- a/testsuite/systemtap.base/tcl.exp +++ b/testsuite/systemtap.base/tcl.exp @@ -87,7 +87,7 @@ puts $fp " function run_tests \{ (cd $tcldir/.. MOD=stapsdt_\$(date +%j%k%M%N | sed 's/ //') -/work/scox/virginsystemtap/install/bin/stap -m \$MOD -c install/bin/tclsh$tclreleasemajor $testsuite/stap-tcl.stp $testsuite/tcl/install/lib//libtcl$tclreleasemajor.so << END >$testsuite/stap-tcl-markers.log 2>&1 +stap -m \$MOD -c install/bin/tclsh$tclreleasemajor $testsuite/stap-tcl.stp $testsuite/tcl/install/lib//libtcl$tclreleasemajor.so << END >$testsuite/stap-tcl-markers.log 2>&1 source src/tests/all.tcl quit END -- cgit From 96c57a86bb8d14b49b2e8b0ab8e9a044b2fadf42 Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Tue, 20 Oct 2009 13:42:01 -0400 Subject: Added testsuite to test xulrunner sdt markers. xulrunner.exp: New testsuite, modelled after mysql.exp. mysql.exp (stap-mysql.sh): Use installed stap. postgres.exp (stap-mysql.sh): Use installed stap. tcl.exp (stap-mysql.sh): Use installed stap. --- testsuite/systemtap.base/mysql.exp | 2 +- testsuite/systemtap.base/postgres.exp | 2 +- testsuite/systemtap.base/tcl.exp | 2 +- testsuite/systemtap.base/xulrunner.exp | 133 +++++++++++++++++++++++++++++++++ 4 files changed, 136 insertions(+), 3 deletions(-) create mode 100644 testsuite/systemtap.base/xulrunner.exp (limited to 'testsuite') diff --git a/testsuite/systemtap.base/mysql.exp b/testsuite/systemtap.base/mysql.exp index 44b30cf4..efeffbae 100644 --- a/testsuite/systemtap.base/mysql.exp +++ b/testsuite/systemtap.base/mysql.exp @@ -244,7 +244,7 @@ $mysqldir/bin/mysql_install_db --basedir=$mysqldir --datadir=$msdata (cd $mysqldir/mysql-test # wait until mysql is running MOD=stapsdt_\$(date +%j%k%M%N | sed 's/ //') -/usr/local/bin/stap -m \$MOD -c \"$mysqldir/libexec/mysqld --basedir=$mysqldir --datadir=$msdata --log-error=$msdata/mysql.log --pid-file=$msdata/mysql.pid --socket=$msdata/mysql.sock\" $testsuite/stap-mysql.stp $mysqldir/libexec/mysqld >$testsuite/stap-mysql-markers.log 2>&1 & +$env(SYSTEMTAP_PATH)/stap -m \$MOD -c \"$mysqldir/libexec/mysqld --basedir=$mysqldir --datadir=$msdata --log-error=$msdata/mysql.log --pid-file=$msdata/mysql.pid --socket=$msdata/mysql.sock\" $testsuite/stap-mysql.stp $mysqldir/libexec/mysqld >$testsuite/stap-mysql-markers.log 2>&1 & STAPPID=\$! for i in \$(seq 0 10) ; do diff --git a/testsuite/systemtap.base/postgres.exp b/testsuite/systemtap.base/postgres.exp index ceef9437..2d58a54f 100644 --- a/testsuite/systemtap.base/postgres.exp +++ b/testsuite/systemtap.base/postgres.exp @@ -69,7 +69,7 @@ function run_tests \{ $postgresdir/bin/initdb $pgdata which stap -stap -m \$(date +stapsdt_%j%k%M%N | sed 's/ //') -c \"$postgresdir/bin/postgres -D $pgdata\" $pgdata.stp >$pgdata-markers.log 2>&1 & +$env(SYSTEMTAP_PATH)/stap -m \$(date +stapsdt_%j%k%M%N | sed 's/ //') -c \"$postgresdir/bin/postgres -D $pgdata\" $pgdata.stp >$pgdata-markers.log 2>&1 & STAPPID=\$! # wait until postgres is running diff --git a/testsuite/systemtap.base/tcl.exp b/testsuite/systemtap.base/tcl.exp index 5e51609d..8056f5e5 100644 --- a/testsuite/systemtap.base/tcl.exp +++ b/testsuite/systemtap.base/tcl.exp @@ -87,7 +87,7 @@ puts $fp " function run_tests \{ (cd $tcldir/.. MOD=stapsdt_\$(date +%j%k%M%N | sed 's/ //') -stap -m \$MOD -c install/bin/tclsh$tclreleasemajor $testsuite/stap-tcl.stp $testsuite/tcl/install/lib//libtcl$tclreleasemajor.so << END >$testsuite/stap-tcl-markers.log 2>&1 +$env(SYSTEMTAP_PATH)/stap -m \$MOD -c install/bin/tclsh$tclreleasemajor $testsuite/stap-tcl.stp $testsuite/tcl/install/lib//libtcl$tclreleasemajor.so << END >$testsuite/stap-tcl-markers.log 2>&1 source src/tests/all.tcl quit END diff --git a/testsuite/systemtap.base/xulrunner.exp b/testsuite/systemtap.base/xulrunner.exp new file mode 100644 index 00000000..be2db0c7 --- /dev/null +++ b/testsuite/systemtap.base/xulrunner.exp @@ -0,0 +1,133 @@ +set test "xulrunner" + +# Test sdt support in xulrunner. + +global env + +if {! [info exists env(SYSTEMTAP_TEST_SDT)]} { + unsupported "xulrunner (\"SYSTEMTAP_TEST_SDT\" not in env)" + return +} + +########## Create /tmp/stap-xul.stp ########## +set xulrelease "1.9.1.3" +set xuldir "[pwd]/xul/" +set testsuite "[pwd]" + +set fp [open "$testsuite/stap-xul.stp" "w"] +puts $fp " +global funcinfo +global objinfo + +probe process(@1).mark(\"function__info\") +{ + file = user_string (\$arg1) + func = user_string (\$arg3) + funcinfo\[file,func\] <<< 1 +} + +probe process(@1).mark(\"object__create\") +{ + file = user_string (\$arg1) + class = user_string (\$arg2) + objinfo\[file,class\] <<< 1 +} + +probe end +{ + foreach (\[i,j\] in funcinfo+) + { + printf (\"probes: %-20s %-25s %d\\n\", substr(i,strlen(i)-20,strlen(i)), j, @count(funcinfo\[i,j\])) + } + foreach (\[i,j\] in objinfo+) + { + printf (\"probes: %-20s %-25s %d\\n\", substr(i,strlen(i)-20,strlen(i)), j, @count(funcinfo\[i,j\])) + } +} +" +close $fp + +########## Begin /tmp/stap-xul.sh ########## +set fp [open "$testsuite/stap-xul.sh" "w"] +puts $fp " +##### begin run_tests ##### +function run_tests \{ +cd $testsuite/xul/bld/js/src +pwd +for i in call trace-test math-trace-tests ; do +$env(SYSTEMTAP_PATH)/stap -c \"./js $xuldir/src/js/src/\$i.js\" $testsuite/stap-xul.stp ./js +done | tee $testsuite/stap-xul-markers.log +PROBES=\$(grep 'probes: ' $testsuite/stap-xul-markers.log | wc -l) +TESTS=\$(grep '-FAIL' $testsuite/stap-xul-markers.log) +echo PROBES=\$PROBES TESTS=\$TESTS + +if \[ \$PROBES -gt 400 \] ; then + echo PASS: xulrunner javascript markers \$1 +else + echo FAIL: xulrunner javascript markers \$1 +fi + +if \[ -z \$TESTS \] ; then + echo PASS: xulrunner javascript testsuite \$1 +else + echo FAIL: xulrunner javascript testsuite \$1 +fi + +\} +##### end run_tests ##### + +if \[ ! -r xulrunner-$xulrelease-source.tar \] ; then +wget ftp://ftp.mozilla.org/pub/mozilla.org/xul/releases/$xulrelease/source/xulrunner-$xulrelease-source.tar.bz2 +bunzip2 xulrunner-$xulrelease-source.tar.bz2 +fi + +if \[ ! -d xul/src \] ; then +tar -x -f xulrunner-$xulrelease-source.tar +mkdir xul +xulrelease=$xulrelease +mv mozilla-\${xulrelease%.\[0-9\]} xul/src +fi + +if \[ ! -f xul/bld/js/src/js \] ; then +mkdir xul/bld +cd xul/bld +if rpm -q java-1.6.0-openjdk ; then : +else + echo FAIL: Need java-1.6.0-openjdk-devel + exit +fi +JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64 \ +CXXFLAGS='-g -I$env(SYSTEMTAP_INCLUDES)' \ +CFLAGS='-g -I$env(SYSTEMTAP_INCLUDES)' \ +PATH=$env(SYSTEMTAP_PATH)/:\$PATH \ +../src/configure --prefix=$xuldir --enable-dtrace --enable-application=xulrunner +J=\$(getconf _NPROCESSORS_CONF) +make -j \$J +fi + +run_tests uprobe +" +########## End /tmp/stap-xul.sh ########## +close $fp + +########## /tmp/stap-xul.sh does most of the work ########## +verbose -log Running xul testsuite +spawn sh stap-xul.sh 2>&1 +expect { + -timeout 10000 + -re {FAIL: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s; + fail "$s"; exp_continue } + -re {PASS: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s; + pass "$s"; exp_continue } + -re {UNSUPPORTED: [a-zA-Z_/: ]+} { regexp " .*$" $expect_out(0,string) s; + verbose -log "$s" + unsupported "$s"; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} + +if { $verbose == 0 } { +catch {exec rm -rf $testsuite/stap-xul.stp xulrunner-$xulrelease-source.tar \ + $testsuite/stap-xul-markers.log $testsuite/stap-xul.sh } +catch {exec rm -rf xul} +} -- cgit From 8f805d3329e985f0ea0851fa1522ab447765af27 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 9 Oct 2009 17:32:26 -0700 Subject: PR10750: Enforce a reasonable limit on # of varargs If we leave the number of args unbounded, then an excessively-sized printf could cause a kernel stack overflow. I've arbitrarily chosen 32 as our new maximum. * translate.cxx (c_unparser::visit_print_format): Throw if >32 args. * testsuite/transko/varargs.stp: Assert that 33 args aren't allowed. * testsuite/transok/varargs.stp: Assert that 32 args are ok. --- testsuite/transko/varargs.stp | 10 ++++++++++ testsuite/transok/varargs.stp | 9 +++++++++ 2 files changed, 19 insertions(+) create mode 100755 testsuite/transko/varargs.stp create mode 100755 testsuite/transok/varargs.stp (limited to 'testsuite') diff --git a/testsuite/transko/varargs.stp b/testsuite/transko/varargs.stp new file mode 100755 index 00000000..f38309ad --- /dev/null +++ b/testsuite/transko/varargs.stp @@ -0,0 +1,10 @@ +#! stap -p3 + +probe begin { + // PR10750 enforces at most 32 print args + println(1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, + 33) +} diff --git a/testsuite/transok/varargs.stp b/testsuite/transok/varargs.stp new file mode 100755 index 00000000..216166f6 --- /dev/null +++ b/testsuite/transok/varargs.stp @@ -0,0 +1,9 @@ +#! stap -p3 + +probe begin { + // PR10750 enforces at most 32 print args + println(1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32) +} -- cgit From 712d12ca4c74b824e7afbb273c0975eb0a30847c Mon Sep 17 00:00:00 2001 From: David Smith Date: Thu, 22 Oct 2009 09:03:44 -0500 Subject: PR 10822 fixed by waiting for the procfs file. * testsuite/systemtap.base/onoffprobe.exp: Wait for up to 10 seconds for the procfs file to be created. --- testsuite/systemtap.base/onoffprobe.exp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'testsuite') diff --git a/testsuite/systemtap.base/onoffprobe.exp b/testsuite/systemtap.base/onoffprobe.exp index 1b39dab5..c6d83d5d 100644 --- a/testsuite/systemtap.base/onoffprobe.exp +++ b/testsuite/systemtap.base/onoffprobe.exp @@ -10,9 +10,27 @@ proc advance {} { global expect_out global ok global modname + set procfs_file "/proc/systemtap/$modname/switch" + pass "$test $expect_out(1,string)" + + # If this is the first time, wait until the procfs file exists + # (for up to 10 seconds). + if {$ok == 0} { + set i 0 + while {![file exists $procfs_file]} { + sleep 1 + incr i + if {$i >= 10} { break } + } + # If the procfs file still doesn't exist, fail. + if {![file exists $procfs_file]} { + fail "$test (missing procfs file)" + } + } + incr ok - exec echo $ok > /proc/systemtap/$modname/switch + if {[file exists $procfs_file]} { exec echo $ok > $procfs_file } exec echo dummy > /dev/null exp_continue } -- cgit From d117a23e6883640be751523274811d9d5e9dcc11 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 27 Oct 2009 13:52:34 -0700 Subject: PR10854 cont'd: Add a testcase for the reproducer --- testsuite/systemtap.base/pr10854.exp | 31 +++++++++++++++++++++++++++++++ testsuite/systemtap.base/pr10854.stp | 20 ++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 testsuite/systemtap.base/pr10854.exp create mode 100644 testsuite/systemtap.base/pr10854.stp (limited to 'testsuite') diff --git a/testsuite/systemtap.base/pr10854.exp b/testsuite/systemtap.base/pr10854.exp new file mode 100644 index 00000000..11d2221e --- /dev/null +++ b/testsuite/systemtap.base/pr10854.exp @@ -0,0 +1,31 @@ +# This test is to make sure that we've resolved PR10854's race between probe +# initialization and shutdown. Here we load a module and then kill the stapio +# process as soon as we can to try to make the init and shutdown overlap. + +set test "pr10854" + +# precompile the script module +set compile { exec stap $srcdir/$subdir/$test.stp sys_read *@fs/*.c -p4 } +if { [catch { set module [eval $compile] } msg ] } { + fail "compiling $test.stp: $msg" + untested "$test runloop" + continue +} else { + pass "compiling $test.stp" +} + +if {![installtest_p]} { + untested "$test runloop" + continue +} + +# run & kill the module 10 times +# (this was usually enough to trigger the fault) +for {set i 0} {$i < 10} {incr i} { + spawn staprun $module -o /dev/null + while { [catch { exec pkill stapio -P [pid] } msg ] } { } + wait +} + +# if we're still alive, we pass :) +pass "$test runloop" diff --git a/testsuite/systemtap.base/pr10854.stp b/testsuite/systemtap.base/pr10854.stp new file mode 100644 index 00000000..55f027f2 --- /dev/null +++ b/testsuite/systemtap.base/pr10854.stp @@ -0,0 +1,20 @@ +function trace(entry_p) { + if(tid() in trace) + printf("%s%s%s\n",thread_indent(entry_p), + (entry_p>0?"->":"<-"), + probefunc()) +} + +global trace +probe kernel.function(@1).call { + if (execname() == "staprun") next # skip our own helper process + trace[tid()] = 1 + trace(1) +} +probe kernel.function(@1).return { + trace(-1) + delete trace[tid()] +} + +probe kernel.function(@2).call { trace(1) } +probe kernel.function(@2).return { trace(-1) } -- cgit From 06406f452757336ede3eb951544ffda74bed8985 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 27 Oct 2009 14:06:06 -0700 Subject: Properly close the spawn of the pr10854 testcase --- testsuite/systemtap.base/pr10854.exp | 1 + 1 file changed, 1 insertion(+) (limited to 'testsuite') diff --git a/testsuite/systemtap.base/pr10854.exp b/testsuite/systemtap.base/pr10854.exp index 11d2221e..9173c8b4 100644 --- a/testsuite/systemtap.base/pr10854.exp +++ b/testsuite/systemtap.base/pr10854.exp @@ -24,6 +24,7 @@ if {![installtest_p]} { for {set i 0} {$i < 10} {incr i} { spawn staprun $module -o /dev/null while { [catch { exec pkill stapio -P [pid] } msg ] } { } + catch { close } wait } -- cgit From f4444f0c848bade06b7953d1d57d14d67a3167b6 Mon Sep 17 00:00:00 2001 From: Breno Leitão Date: Fri, 2 Oct 2009 16:38:46 -0400 Subject: A new testcase for tty tapset This is a basic test to assure that the tty tapset is working compiling and working properly --- testsuite/buildok/tty.stp | 51 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 testsuite/buildok/tty.stp (limited to 'testsuite') diff --git a/testsuite/buildok/tty.stp b/testsuite/buildok/tty.stp new file mode 100755 index 00000000..0b5018d9 --- /dev/null +++ b/testsuite/buildok/tty.stp @@ -0,0 +1,51 @@ +#! stap -wp4 + +probe tty.poll{ + printf("Pooling tty %s for wait queue key %d\n", file_name, wait_key); +} + +probe tty.register { + printf("Device registered using index %d using driver %s(%s/%s)\n", index, driver_name, name, module) +} + +probe tty.unregister { + printf("Device registered using index %d using driver %s(%s/%s)\n", index, driver_name, name, module) +} + +probe tty.release { + printf("Closing file %s\n", file_name) + printf("INODE: number %d\nState: %d\nFlag: %d\n", inode_number, inode_state, inode_flags) + printf("File: %s (mode %x flags %x)\n", file_name, file_mode, file_flags) +} + +probe tty.open { + printf("Opening tty file %s\n", file_name) + printf("INODE: number %d\nState: %d\nFlag: %d\n", inode_number, inode_state, inode_flags) + printf("File: %s mode %x flags %x\n", file_name, file_mode, file_flags) +} + +probe tty.resize { + printf("Resizing %s from %dx%d (%d/%d) to %dx%d (%d/%d)\n", name, old_row, old_col, old_xpixel, old_ypixel, + new_row, new_col, new_xpixel, new_ypixel) +} + +probe tty.ioctl { + printf("Ioctling file %s with %d %d\n", name, cmd, arg) +} + +probe tty.init { + printf("new tty with name %s from driver %s and module %s\nn", driver_name, name, module) +} + +probe tty.receive { + printf("Driver %s/%s (%d/%d) received %s (%s) with len %d\n", name, driver_name, index, id, cp, fp, count) +} + + +probe tty.write { + printf("Buffer %s (len %d) wrote on file %s (driver %s)\n", buffer, nr, file_name, driver_name) +} + +probe tty.read { + printf("Reading tty file %s (driver %s) to a buffer with size %d containing %s\n", file_name, driver_name, nr, buffer) +} -- cgit From 49e20063710b1d5dbb4efeb53d751b684835413c Mon Sep 17 00:00:00 2001 From: David Smith Date: Thu, 29 Oct 2009 16:12:18 -0500 Subject: Fix syscall testsuite bugs. * testsuite/systemtap.syscall/test.tcl: Substitute '[[[[' and ']]]]' for '(' and ')'. This allows us to get unquoted parens. * testsuite/systemtap.syscall/test-debug.tcl: Matches substitute logic of test.tcl. * testsuite/systemtap.syscall/README: Document '[[[[' and ']]]]'. * testsuite/systemtap.syscall/chmod.c: Handle optional O_LARGEFILE flag in open calls. * testsuite/systemtap.syscall/dir.c: Ditto. * testsuite/systemtap.syscall/mmap.c: Ditto. * testsuite/systemtap.syscall/openclose.c: Ditto. * testsuite/systemtap.syscall/readwrite.c: Ditto. * testsuite/systemtap.syscall/stat.c: Ditto. --- testsuite/systemtap.syscall/README | 3 +++ testsuite/systemtap.syscall/chmod.c | 2 +- testsuite/systemtap.syscall/dir.c | 4 ++-- testsuite/systemtap.syscall/mmap.c | 4 ++-- testsuite/systemtap.syscall/openclose.c | 18 +++++++++--------- testsuite/systemtap.syscall/readwrite.c | 4 ++-- testsuite/systemtap.syscall/stat.c | 2 +- testsuite/systemtap.syscall/test-debug.tcl | 11 +++++++++++ testsuite/systemtap.syscall/test.tcl | 6 ++++++ 9 files changed, 37 insertions(+), 17 deletions(-) (limited to 'testsuite') diff --git a/testsuite/systemtap.syscall/README b/testsuite/systemtap.syscall/README index 480bd8cd..836ac747 100644 --- a/testsuite/systemtap.syscall/README +++ b/testsuite/systemtap.syscall/README @@ -18,6 +18,9 @@ is expected, put "NNNN" (for decimal) or "XXXX" (for hex). Or you can just write regular expressions. The "NNNN" and "XXXX" are just shorthand to aid readability and are converted to regular expressions in test.tcl. +Normally opening and closing parentheses ('(' and ')') get quoted. If +you want unquoted parentheses, use '[[[[' (for '(') or ']]]]' (for ')'). + 3. Somewhere is your test program puts a comment line like this: /* COVERAGE: syscall1 syscall2 ... */ where you list the systemcalls that are tested. Then you can run diff --git a/testsuite/systemtap.syscall/chmod.c b/testsuite/systemtap.syscall/chmod.c index 724b86c4..ce18b3d0 100644 --- a/testsuite/systemtap.syscall/chmod.c +++ b/testsuite/systemtap.syscall/chmod.c @@ -11,7 +11,7 @@ int main() int fd; fd = open("foobar",O_WRONLY|O_CREAT, 0666); - //staptest// open ("foobar", O_WRONLY|O_CREAT, 0666) = NNNN + //staptest// open ("foobar", O_WRONLY|O_CREAT[[[[.O_LARGEFILE]]]]?, 0666) = NNNN chmod("foobar", 0644); //staptest// chmod ("foobar", 0644) diff --git a/testsuite/systemtap.syscall/dir.c b/testsuite/systemtap.syscall/dir.c index 3eda8175..f5b9f320 100644 --- a/testsuite/systemtap.syscall/dir.c +++ b/testsuite/systemtap.syscall/dir.c @@ -20,7 +20,7 @@ int main() //staptest// chdir ("..") = 0 fd = open("foobar", O_RDONLY); - //staptest// open ("foobar", O_RDONLY) = NNNN + //staptest// open ("foobar", O_RDONLY[[[[.O_LARGEFILE]]]]?) = NNNN fchdir(fd); //staptest// fchdir (NNNN) = 0 @@ -35,7 +35,7 @@ int main() //staptest// rmdir ("foobar") = 0 fd = open(".", O_RDONLY); - //staptest// open (".", O_RDONLY) = NNNN + //staptest// open (".", O_RDONLY[[[[.O_LARGEFILE]]]]?) = NNNN #ifdef SYS_mkdirat mkdirat(fd, "xyzzy", 0765); diff --git a/testsuite/systemtap.syscall/mmap.c b/testsuite/systemtap.syscall/mmap.c index 13145fb2..a09888b4 100644 --- a/testsuite/systemtap.syscall/mmap.c +++ b/testsuite/systemtap.syscall/mmap.c @@ -13,14 +13,14 @@ int main() /* create a file with something in it */ fd = open("foobar",O_WRONLY|O_CREAT|O_TRUNC, 0600); - //staptest// open ("foobar", O_WRONLY|O_CREAT|O_TRUNC, 0600) = NNNN + //staptest// open ("foobar", O_WRONLY|O_CREAT[[[[.O_LARGEFILE]]]]?|O_TRUNC, 0600) = NNNN lseek(fd, 1024, SEEK_SET); write(fd, "abcdef", 6); close(fd); //staptest// close (NNNN) = 0 fd = open("foobar", O_RDONLY); - //staptest// open ("foobar", O_RDONLY) = NNNN + //staptest// open ("foobar", O_RDONLY[[[[.O_LARGEFILE]]]]?) = NNNN /* stat for file size */ ret = fstat(fd, &fs); diff --git a/testsuite/systemtap.syscall/openclose.c b/testsuite/systemtap.syscall/openclose.c index cb003a9e..aeabbe19 100644 --- a/testsuite/systemtap.syscall/openclose.c +++ b/testsuite/systemtap.syscall/openclose.c @@ -13,46 +13,46 @@ int main() int fd1, fd2; fd2 = creat("foobar1",S_IREAD|S_IWRITE); - //staptest// open ("foobar1", O_WRONLY|O_CREAT|O_TRUNC, 0600) = NNNN + //staptest// open ("foobar1", O_WRONLY|O_CREAT[[[[.O_LARGEFILE]]]]?|O_TRUNC, 0600) = NNNN fd1 = open("foobar2",O_WRONLY|O_CREAT, S_IRWXU); - //staptest// open ("foobar2", O_WRONLY|O_CREAT, 0700) = NNNN + //staptest// open ("foobar2", O_WRONLY|O_CREAT[[[[.O_LARGEFILE]]]]?, 0700) = NNNN close(fd1); //staptest// close (NNNN) = 0 fd1 = open("foobar2",O_RDONLY); - //staptest// open ("foobar2", O_RDONLY) = NNNN + //staptest// open ("foobar2", O_RDONLY[[[[.O_LARGEFILE]]]]?) = NNNN close(fd1); //staptest// close (NNNN) = 0 fd1 = open("foobar2",O_RDWR); - //staptest// open ("foobar2", O_RDWR) = NNNN + //staptest// open ("foobar2", O_RDWR[[[[.O_LARGEFILE]]]]?) = NNNN close(fd1); //staptest// close (NNNN) = 0 fd1 = open("foobar2",O_APPEND|O_WRONLY); - //staptest// open ("foobar2", O_WRONLY|O_APPEND) = NNNN + //staptest// open ("foobar2", O_WRONLY|O_APPEND[[[[.O_LARGEFILE]]]]?) = NNNN close(fd1); //staptest// close (NNNN) = 0 fd1 = open("foobar2",O_DIRECT|O_RDWR); - //staptest// open ("foobar2", O_RDWR|O_DIRECT) = NNNN + //staptest// open ("foobar2", O_RDWR|O_DIRECT[[[[.O_LARGEFILE]]]]?) = NNNN close(fd1); //staptest// close (NNNN) = 0 fd1 = open("foobar2",O_NOATIME|O_SYNC|O_RDWR); - //staptest// open ("foobar2", O_RDWR|O_NOATIME|O_SYNC) = NNNN + //staptest// open ("foobar2", O_RDWR[[[[.O_LARGEFILE]]]]?|O_NOATIME|O_SYNC) = NNNN close(fd1); //staptest// close (NNNN) = 0 /* Now test some bad opens */ fd1 = open("/",O_WRONLY); - //staptest// open ("/", O_WRONLY) = -NNNN (EISDIR) + //staptest// open ("/", O_WRONLY[[[[.O_LARGEFILE]]]]?) = -NNNN (EISDIR) close (fd1); //staptest// close (NNNN) = -NNNN (EBADF) fd1 = open("foobar2",O_WRONLY|O_CREAT|O_EXCL, S_IRWXU); - //staptest// open ("foobar2", O_WRONLY|O_CREAT|O_EXCL, 0700) = -NNNN (EEXIST) + //staptest// open ("foobar2", O_WRONLY|O_CREAT|O_EXCL[[[[.O_LARGEFILE]]]]?, 0700) = -NNNN (EEXIST) return 0; } diff --git a/testsuite/systemtap.syscall/readwrite.c b/testsuite/systemtap.syscall/readwrite.c index bd0914cc..d966c0a8 100644 --- a/testsuite/systemtap.syscall/readwrite.c +++ b/testsuite/systemtap.syscall/readwrite.c @@ -26,7 +26,7 @@ int main() v[2].iov_len = sizeof(STRING3); fd = open("foobar1",O_WRONLY|O_CREAT, 0666); - //staptest// open ("foobar1", O_WRONLY|O_CREAT, 0666) = NNNN + //staptest// open ("foobar1", O_WRONLY|O_CREAT[[[[.O_LARGEFILE]]]]?, 0666) = NNNN write(fd,"Hello world", 11); //staptest// write (NNNN, "Hello world", 11) = 11 @@ -66,7 +66,7 @@ int main() close (fd); fd = open("foobar1",O_RDONLY); - //staptest// open ("foobar1", O_RDONLY) = NNNN + //staptest// open ("foobar1", O_RDONLY[[[[.O_LARGEFILE]]]]?) = NNNN read(fd, buf, 11); //staptest// read (NNNN, XXXX, 11) = 11 diff --git a/testsuite/systemtap.syscall/stat.c b/testsuite/systemtap.syscall/stat.c index d47c1440..20a66b09 100644 --- a/testsuite/systemtap.syscall/stat.c +++ b/testsuite/systemtap.syscall/stat.c @@ -20,7 +20,7 @@ int main() //staptest// getcwd (XXXX, 128) = NNNN fd = creat("foobar",S_IREAD|S_IWRITE); - //staptest// open ("foobar", O_WRONLY|O_CREAT|O_TRUNC, 0600) = NNNN + //staptest// open ("foobar", O_WRONLY|O_CREAT[[[[.O_LARGEFILE]]]]?|O_TRUNC, 0600) = NNNN fstat(fd, &sbuf); //staptest// fstat (NNNN, XXXX) = 0 diff --git a/testsuite/systemtap.syscall/test-debug.tcl b/testsuite/systemtap.syscall/test-debug.tcl index eb730459..3eb6bbf0 100755 --- a/testsuite/systemtap.syscall/test-debug.tcl +++ b/testsuite/systemtap.syscall/test-debug.tcl @@ -50,9 +50,20 @@ foreach line [split $output "\n"] { if {[regsub {//} $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 + # + 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 + + # Turn '[[[[' and ']]]]' into '(' and ')' respectively. + # Because normally parens get quoted, this allows us to + # have non-quoted parens. + regsub -all {\[\[\[\[} $line {(} line + regsub -all {\]\]\]\]} $line {)} line regsub -all NNNN $line {[\-0-9]+} line regsub -all XXXX $line {[x0-9a-fA-F]+} line diff --git a/testsuite/systemtap.syscall/test.tcl b/testsuite/systemtap.syscall/test.tcl index b9d3c0d9..e640db66 100755 --- a/testsuite/systemtap.syscall/test.tcl +++ b/testsuite/systemtap.syscall/test.tcl @@ -67,6 +67,12 @@ proc run_one_test {filename flags bits} { #regsub -all {\+} $line {\\+} line #regsub -all {\*} $line {\\*} line + # Turn '[[[[' and ']]]]' into '(' and ')' respectively. + # Because normally parens get quoted, this allows us to + # have non-quoted parens. + 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 052e68d45e5511234b592d47ad1444bae62c35fc Mon Sep 17 00:00:00 2001 From: David Smith Date: Fri, 30 Oct 2009 10:03:52 -0500 Subject: context.exp test improvements. * testsuite/systemtap.context/args.tcl: Increased timeout. If tests do timeout, fail (instead of silently failing). * testsuite/systemtap.context/num_args.tcl: Ditto. * testsuite/systemtap.context/backtrace.tcl: Increase timeout. * testsuite/systemtap.context/pid.tcl: Ditto. --- testsuite/systemtap.context/args.tcl | 3 ++- testsuite/systemtap.context/backtrace.tcl | 2 +- testsuite/systemtap.context/num_args.tcl | 3 ++- testsuite/systemtap.context/pid.tcl | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) (limited to 'testsuite') diff --git a/testsuite/systemtap.context/args.tcl b/testsuite/systemtap.context/args.tcl index fb8aecb4..c5aed203 100644 --- a/testsuite/systemtap.context/args.tcl +++ b/testsuite/systemtap.context/args.tcl @@ -1,6 +1,6 @@ spawn stap $srcdir/$subdir/args.stp expect { - -timeout 60 + -timeout 120 "READY" { exec echo 1 > /proc/stap_test_cmd expect { @@ -51,6 +51,7 @@ expect { timeout {fail "string function arguments"} } } + timeout {fail "all args tests - timeout"} eof {fail "function arguments: unexpected timeout"} } exec kill -INT -[exp_pid] diff --git a/testsuite/systemtap.context/backtrace.tcl b/testsuite/systemtap.context/backtrace.tcl index 5e7b1536..d436ab5c 100644 --- a/testsuite/systemtap.context/backtrace.tcl +++ b/testsuite/systemtap.context/backtrace.tcl @@ -9,7 +9,7 @@ set m6 0 spawn stap $srcdir/$subdir/backtrace.stp #exp_internal 1 expect { - -timeout 60 + -timeout 120 "Systemtap probe: begin\r\n" { pass "backtrace of begin probe" exec echo 0 > /proc/stap_test_cmd diff --git a/testsuite/systemtap.context/num_args.tcl b/testsuite/systemtap.context/num_args.tcl index 62ac8dd3..d677f849 100644 --- a/testsuite/systemtap.context/num_args.tcl +++ b/testsuite/systemtap.context/num_args.tcl @@ -3,7 +3,7 @@ foreach arglist $arglists { set tag [concat numeric $arglist] eval spawn stap $arglist $srcdir/$subdir/num_args.stp expect { - -timeout 60 + -timeout 120 "READY" { exec echo 1 > /proc/stap_test_cmd expect { @@ -57,6 +57,7 @@ expect { -re "semantic error:" { fail "function arguments -- $tag: compilation failed" } + timeout {fail "all function arguments tests - timeout"} eof {fail "function arguments -- $tag: unexpected timeout"} } exec kill -INT -[exp_pid] diff --git a/testsuite/systemtap.context/pid.tcl b/testsuite/systemtap.context/pid.tcl index 70a87345..350a05b2 100644 --- a/testsuite/systemtap.context/pid.tcl +++ b/testsuite/systemtap.context/pid.tcl @@ -2,7 +2,7 @@ set tests [list execname pexecname pid ppid tid uid euid gid egid] spawn stap $srcdir/$subdir/pid.stp #exp_internal 1 expect { - -timeout 60 + -timeout 120 "READY" { set pid [exec echo 1 > /proc/stap_test_cmd &] set ppid {[0-9]*} -- cgit From 9996b615a6ad49ba8adccf7c9395045016ef74e0 Mon Sep 17 00:00:00 2001 From: Eugene Teo Date: Fri, 30 Oct 2009 19:52:23 -0400 Subject: plimit: Add plimit.stp sample script --- testsuite/systemtap.examples/process/plimit.meta | 7 +++ testsuite/systemtap.examples/process/plimit.stp | 78 ++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 testsuite/systemtap.examples/process/plimit.meta create mode 100755 testsuite/systemtap.examples/process/plimit.stp (limited to 'testsuite') diff --git a/testsuite/systemtap.examples/process/plimit.meta b/testsuite/systemtap.examples/process/plimit.meta new file mode 100644 index 00000000..d5cd4e8b --- /dev/null +++ b/testsuite/systemtap.examples/process/plimit.meta @@ -0,0 +1,7 @@ +title: print resource limits +name: plimit.stp +keywords: process +subsystem: general +description: The script prints a variety of resource limits for a given pid, like /proc/$$/limits on recent kernels. +test_check: stap -gp4 plimit.stp $$ +test_installcheck: stap -g plimit.stp $$ diff --git a/testsuite/systemtap.examples/process/plimit.stp b/testsuite/systemtap.examples/process/plimit.stp new file mode 100755 index 00000000..1a389468 --- /dev/null +++ b/testsuite/systemtap.examples/process/plimit.stp @@ -0,0 +1,78 @@ +#!/usr/bin/env stap +# plimit.stp +# Copyright (C) 2006 Red Hat, Inc., Eugene Teo +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# + +%{ + #include + #include +%} + +function getrlimit:string (rlim:long, pid:long) %{ /* pure */ + struct task_struct *p; + struct list_head *_p, *_n; + static char cur_buf[24], max_buf[24]; + long int cur, max; + + list_for_each_safe(_p, _n, ¤t->tasks) { + p = list_entry(_p, struct task_struct, tasks); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12) + cur = p->signal->rlim[THIS->rlim].rlim_cur; + max = p->signal->rlim[THIS->rlim].rlim_max; +#else + cur = p->rlim[THIS->rlim].rlim_cur; + max = p->rlim[THIS->rlim].rlim_max; +#endif + if (p->pid == (int)THIS->pid) { + if (cur == -1 && max == -1) + strcat(THIS->__retvalue, "unlimited unlimited"); + else if (cur == -1) + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%-9s %-9ld", + "unlimited", max); + else if (max == -1) + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%-9ld %-9s", + cur, "unlimited"); + else + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%-9ld %-9ld", + cur, max); + } + } +%} + +function task_execname_by_pid:string (pid:long) %{ /* pure */ + struct task_struct *p; + struct list_head *_p, *_n; + list_for_each_safe(_p, _n, ¤t->tasks) { + p = list_entry(_p, struct task_struct, tasks); + if (p->pid == (int)THIS->pid) + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", p->comm); + } +%} + +probe begin +{ + printf("%d: -%s\n", $1, task_execname_by_pid($1)) + /* include/asm-generic/resource.h */ + printf(" resource current maximum\n") + printf("coredump(blocks) %s\n", getrlimit(4, $1)) + printf("data(bytes) %s\n", getrlimit(2, $1)) + printf("max nice %s\n", getrlimit(13, $1)) + printf("file size(blocks) %s\n", getrlimit(1, $1)) + printf("pending signals %s\n", getrlimit(11, $1)) + printf("max locked memory(bytes) %s\n", getrlimit(8, $1)) + printf("max memory size(bytes) %s\n", getrlimit(5, $1)) + printf("open files %s\n", getrlimit(7, $1)) + printf("POSIX message queues(bytes) %s\n", getrlimit(12, $1)) + printf("max rt priority %s\n", getrlimit(14, $1)) + printf("stack size(bytes) %s\n", getrlimit(3, $1)) + printf("cpu time(seconds) %s\n", getrlimit(0, $1)) + printf("max user processes %s\n", getrlimit(6, $1)) + printf("virtual memory(bytes) %s\n", getrlimit(9, $1)) + printf("file locks %s\n", getrlimit(10, $1)) + + exit() +} -- cgit From 5b8642a208b614769f934c6a4ce2991658025a57 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Fri, 30 Oct 2009 19:53:03 -0400 Subject: regen sample indexes with plimit.stp --- testsuite/systemtap.examples/index.html | 3 +++ testsuite/systemtap.examples/index.txt | 7 +++++++ testsuite/systemtap.examples/keyword-index.html | 3 +++ testsuite/systemtap.examples/keyword-index.txt | 7 +++++++ 4 files changed, 20 insertions(+) (limited to 'testsuite') diff --git a/testsuite/systemtap.examples/index.html b/testsuite/systemtap.examples/index.html index f2b7066f..55fea0fb 100644 --- a/testsuite/systemtap.examples/index.html +++ b/testsuite/systemtap.examples/index.html @@ -169,6 +169,9 @@ keywords: SCHEDULER
  • process/pf2.stp - Profile kernel functions
    keywords: PROFILING

    The pf2.stp script sets up time-based sampling. Every five seconds it prints out a sorted list with the top ten kernel functions with samples.

  • +
  • process/plimit.stp - print resource limits
    +keywords: PROCESS
    +

    The script prints a variety of resource limits for a given pid, like /proc/$$/limits on recent kernels.

  • process/schedtimes.stp - Track Time Processes Spend in Various States using Tracepoints
    keywords: PROCESS SCHEDULER TIME TRACEPOINT

    The schedtimes.stp script instruments the scheduler to track the amount of time that each process spends running, sleeping, queued, and waiting for io. On exit the script prints out the accumulated time for each state of processes observed. Optionally, this script can be used with the '-c' or '-x' options to focus on a specific PID.

  • diff --git a/testsuite/systemtap.examples/index.txt b/testsuite/systemtap.examples/index.txt index e880c746..16b45aac 100644 --- a/testsuite/systemtap.examples/index.txt +++ b/testsuite/systemtap.examples/index.txt @@ -407,6 +407,13 @@ keywords: profiling samples. +process/plimit.stp - print resource limits +keywords: process + + The script prints a variety of resource limits for a given pid, like + /proc/$$/limits on recent kernels. + + process/schedtimes.stp - Track Time Processes Spend in Various States using Tracepoints keywords: process scheduler time tracepoint diff --git a/testsuite/systemtap.examples/keyword-index.html b/testsuite/systemtap.examples/keyword-index.html index f09a20b3..1a2855e1 100644 --- a/testsuite/systemtap.examples/keyword-index.html +++ b/testsuite/systemtap.examples/keyword-index.html @@ -297,6 +297,9 @@ keywords: PROCESS process/forktracker.stp - Trace Creation of Processes
    keywords: PROCESS SCHEDULER

    The forktracker.stp script prints out a time-stamped entry showing each fork and exec operation on the machine. This can be useful for determine what process is creating a flurry of short-lived processes.

    +
  • process/plimit.stp - print resource limits
    +keywords: PROCESS
    +

    The script prints a variety of resource limits for a given pid, like /proc/$$/limits on recent kernels.

  • process/schedtimes.stp - Track Time Processes Spend in Various States using Tracepoints
    keywords: PROCESS SCHEDULER TIME TRACEPOINT

    The schedtimes.stp script instruments the scheduler to track the amount of time that each process spends running, sleeping, queued, and waiting for io. On exit the script prints out the accumulated time for each state of processes observed. Optionally, this script can be used with the '-c' or '-x' options to focus on a specific PID.

  • diff --git a/testsuite/systemtap.examples/keyword-index.txt b/testsuite/systemtap.examples/keyword-index.txt index 853198d3..6de9c330 100644 --- a/testsuite/systemtap.examples/keyword-index.txt +++ b/testsuite/systemtap.examples/keyword-index.txt @@ -605,6 +605,13 @@ keywords: process scheduler determine what process is creating a flurry of short-lived processes. +process/plimit.stp - print resource limits +keywords: process + + The script prints a variety of resource limits for a given pid, like + /proc/$$/limits on recent kernels. + + process/schedtimes.stp - Track Time Processes Spend in Various States using Tracepoints keywords: process scheduler time tracepoint -- cgit From 2c279bc4231e44dba80e5fdb10aa1626e412eab3 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Sat, 31 Oct 2009 13:54:41 -0400 Subject: reorganize app tests; rewrite tcl as sample of improvements * testsuite/configure.ac (--enable-testapps): New option. * testsuite/Makefile.am (TESTAPPS): Pass to dejagnu. * testsuite/systemtap.base/{xulrunner,tcl,mysql,postgres}: Moved under new systemtap.apps/ subdirectory. * testsuite/systemtap.apps/stap-tcl.sh: New file to build tcl. * testsuite/systemtap.apps/stap-tcl.stp: New file to test tcl. * testsuite/systemtap.apps/tcl.exp: New simplified test driver. * dtrace.in: Disable STAP_HAS_SEMAPHORES as they don't work on shlibs yet. * includes/sys/sdt.h (STAP_SEMAPHORE): Include __builtin_expect for unlikely. --- testsuite/Makefile.am | 4 +- testsuite/Makefile.in | 4 +- testsuite/configure | 20 ++ testsuite/configure.ac | 12 ++ testsuite/systemtap.apps/mysql.exp | 344 +++++++++++++++++++++++++++++++++ testsuite/systemtap.apps/postgres.exp | 166 ++++++++++++++++ testsuite/systemtap.apps/stap-tcl.sh | 25 +++ testsuite/systemtap.apps/stap-tcl.stp | 30 +++ testsuite/systemtap.apps/tcl.exp | 67 +++++++ testsuite/systemtap.apps/xulrunner.exp | 133 +++++++++++++ testsuite/systemtap.base/mysql.exp | 344 --------------------------------- testsuite/systemtap.base/postgres.exp | 166 ---------------- testsuite/systemtap.base/tcl.exp | 165 ---------------- testsuite/systemtap.base/xulrunner.exp | 133 ------------- 14 files changed, 802 insertions(+), 811 deletions(-) create mode 100644 testsuite/systemtap.apps/mysql.exp create mode 100644 testsuite/systemtap.apps/postgres.exp create mode 100644 testsuite/systemtap.apps/stap-tcl.sh create mode 100644 testsuite/systemtap.apps/stap-tcl.stp create mode 100644 testsuite/systemtap.apps/tcl.exp create mode 100644 testsuite/systemtap.apps/xulrunner.exp delete mode 100644 testsuite/systemtap.base/mysql.exp delete mode 100644 testsuite/systemtap.base/postgres.exp delete mode 100644 testsuite/systemtap.base/tcl.exp delete mode 100644 testsuite/systemtap.base/xulrunner.exp (limited to 'testsuite') diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index 9607ebe3..248a0fb3 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -12,7 +12,7 @@ clean-local: -rm -rf .systemtap* .cache_test* 2>/dev/null DEJAZILLA=@dejazilla@ - +TESTAPPS=@enable_testapps@ TOOL_OPTS= # automake's dejagnu library already runs check-DEJAGNU before check-local @@ -37,4 +37,4 @@ SYSTEMTAP_INCLUDES=$(DESTDIR)$(includedir) RUNTESTDEFAULTFLAGS = --tool $$tool --tool_opts \'$(TOOL_OPTS)\' --srcdir $$srcdir EXPECT = expect -RUNTEST="env SYSTEMTAP_RUNTIME=$(SYSTEMTAP_RUNTIME) SYSTEMTAP_TAPSET=$(SYSTEMTAP_TAPSET) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) CRASH_LIBDIR=$(CRASH_LIBDIR) PATH=$(SYSTEMTAP_PATH):$$PATH SYSTEMTAP_PATH=$(SYSTEMTAP_PATH) SYSTEMTAP_INCLUDES=$(SYSTEMTAP_INCLUDES) $(srcdir)/execrc runtest" +RUNTEST="env SYSTEMTAP_TESTAPPS=$(TESTAPPS) SYSTEMTAP_RUNTIME=$(SYSTEMTAP_RUNTIME) SYSTEMTAP_TAPSET=$(SYSTEMTAP_TAPSET) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) CRASH_LIBDIR=$(CRASH_LIBDIR) PATH=$(SYSTEMTAP_PATH):$$PATH SYSTEMTAP_PATH=$(SYSTEMTAP_PATH) SYSTEMTAP_INCLUDES=$(SYSTEMTAP_INCLUDES) $(srcdir)/execrc runtest" diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in index 7358bd2c..3853cdd4 100644 --- a/testsuite/Makefile.in +++ b/testsuite/Makefile.in @@ -95,6 +95,7 @@ datarootdir = @datarootdir@ dejazilla = @dejazilla@ docdir = @docdir@ dvidir = @dvidir@ +enable_testapps = @enable_testapps@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ @@ -122,6 +123,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = dejagnu no-dist DEJAZILLA = @dejazilla@ +TESTAPPS = @enable_testapps@ TOOL_OPTS = # $(srcdir)/These values point the test suite to the install tree, and @@ -134,7 +136,7 @@ SYSTEMTAP_PATH = $(DESTDIR)$(bindir) SYSTEMTAP_INCLUDES = $(DESTDIR)$(includedir) RUNTESTDEFAULTFLAGS = --tool $$tool --tool_opts \'$(TOOL_OPTS)\' --srcdir $$srcdir EXPECT = expect -RUNTEST = "env SYSTEMTAP_RUNTIME=$(SYSTEMTAP_RUNTIME) SYSTEMTAP_TAPSET=$(SYSTEMTAP_TAPSET) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) CRASH_LIBDIR=$(CRASH_LIBDIR) PATH=$(SYSTEMTAP_PATH):$$PATH SYSTEMTAP_PATH=$(SYSTEMTAP_PATH) SYSTEMTAP_INCLUDES=$(SYSTEMTAP_INCLUDES) $(srcdir)/execrc runtest" +RUNTEST = "env SYSTEMTAP_TESTAPPS=$(TESTAPPS) SYSTEMTAP_RUNTIME=$(SYSTEMTAP_RUNTIME) SYSTEMTAP_TAPSET=$(SYSTEMTAP_TAPSET) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) CRASH_LIBDIR=$(CRASH_LIBDIR) PATH=$(SYSTEMTAP_PATH):$$PATH SYSTEMTAP_PATH=$(SYSTEMTAP_PATH) SYSTEMTAP_INCLUDES=$(SYSTEMTAP_INCLUDES) $(srcdir)/execrc runtest" all: all-am .SUFFIXES: diff --git a/testsuite/configure b/testsuite/configure index 5e75929c..d64ca089 100755 --- a/testsuite/configure +++ b/testsuite/configure @@ -602,6 +602,7 @@ PACKAGE_BUGREPORT='systemtap@sources.redhat.com' ac_subst_vars='LTLIBOBJS LIBOBJS +enable_testapps dejazilla MAINT MAINTAINER_MODE_FALSE @@ -671,6 +672,7 @@ ac_user_opts=' enable_option_checking enable_maintainer_mode enable_dejazilla +enable_testapps ' ac_precious_vars='build_alias host_alias @@ -1308,6 +1310,9 @@ Optional Features: results to a central public collection point (default is disabled). Optional EMAIL overrides the default email address. + --enable-testapps=foo,bar or all + enable rebuilding of large external apps for testing + markers Report bugs to . _ACEOF @@ -2317,6 +2322,21 @@ $as_echo "$as_me: A \"make *check\" will email results to $dejazilla" >&6;} fi +apps= +for exp in $srcdir/systemtap.apps/*.exp +do + app=`basename $exp .exp` + apps="$app $apps" +done +# Check whether --enable-testapps was given. +if test "${enable_testapps+set}" = set; then + enableval=$enable_testapps; +fi + +{ $as_echo "$as_me:$LINENO: Will test ${enable_testapps-none} from: $apps" >&5 +$as_echo "$as_me: Will test ${enable_testapps-none} from: $apps" >&6;} + + ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF diff --git a/testsuite/configure.ac b/testsuite/configure.ac index 5166d226..bc5aed17 100644 --- a/testsuite/configure.ac +++ b/testsuite/configure.ac @@ -23,5 +23,17 @@ if test -n "$dejazilla"; then fi AC_SUBST(dejazilla) +apps= +for exp in $srcdir/systemtap.apps/*.exp +do + app=`basename $exp .exp` + apps="$app $apps" +done +AC_ARG_ENABLE([testapps], + AC_HELP_STRING([--enable-testapps=foo,bar or all], + [enable rebuilding of large external apps for testing markers])) +AC_MSG_NOTICE([Will test ${enable_testapps-no} apps from: $apps]) +AC_SUBST(enable_testapps) + AC_CONFIG_FILES(Makefile) AC_OUTPUT diff --git a/testsuite/systemtap.apps/mysql.exp b/testsuite/systemtap.apps/mysql.exp new file mode 100644 index 00000000..efeffbae --- /dev/null +++ b/testsuite/systemtap.apps/mysql.exp @@ -0,0 +1,344 @@ +set test "mysql" + +# Test sdt support in mysql. + +global env + +if {! [info exists env(SYSTEMTAP_TEST_SDT)]} { + unsupported "mysql (\"SYSTEMTAP_TEST_SDT\" not in env)" + return +} + +########## Create /tmp/stap-mysql.stp ########## +set msdata "[pwd]/stap-mysql" +set mysqlrelease "mysql-5.4.1-beta" +set mysqldir "[pwd]/mysql/install/" +set testsuite "[pwd]" + +set fp [open "$testsuite/stap-mysql.stp" "w"] +puts $fp " +probe process(@1).mark(\"connection__start\") +{ + arg2 = user_string(\$arg2) + arg3 = user_string(\$arg3) + printf(\"%s %#x %s %s\\n\",\"connection__start\", \$arg1, arg2, arg3); +} +probe process(@1).mark(\"connection__done\") +{ + printf(\"%s %#x %#x \\n\",\"connection__done\", \$arg1, \$arg2); +} +probe process(@1).mark(\"command__start\") +{ + arg3 = user_string(\$arg3) + arg4 = user_string(\$arg4) + printf(\"%s %#x %#x %s %s\\n\",\"command__start\", \$arg1, \$arg2, arg3, arg4); +} +probe process(@1).mark(\"command__done\") +{ + printf(\"%s %#x\\n\",\"command__done\", \$arg1); +} +probe process(@1).mark(\"query__start\") +{ + arg1 = user_string(\$arg1) + arg3 = user_string(\$arg3) + arg4 = user_string(\$arg4) + arg5 = user_string(\$arg5) + printf(\"%s %s %#x %s %s %s\\n\",\"query__start\", arg1, \$arg2, + arg3, arg4, arg5); +} +probe process(@1).mark(\"query__done\") +{ + printf(\"%s %#x\\n\",\"query__done\", \$arg1); +} +probe process(@1).mark(\"query__parse__start\") +{ + arg1 = user_string(\$arg1) + printf(\"%s %s\\n\",\"query__parse__start\", arg1); +} +probe process(@1).mark(\"query__parse__done\") +{ + printf(\"%s %#x\\n\",\"query__parse__done\", \$arg1); +} +probe process(@1).mark(\"query__cache__hit\") +{ + arg1=user_string(\$arg1) + arg2=user_string(\$arg2) + printf(\"%s %s %s \\n\",\"query__cache__hit\", arg1, arg2); +} +probe process(@1).mark(\"query__cache__miss\") +{ + arg1=user_string(\$arg1) + printf(\"%s %s\\n\",\"query__cache__miss\", arg1); +} +probe process(@1).mark(\"query__exec__start\") +{ + arg1=user_string(\$arg1) + arg3=user_string(\$arg3) + arg4=user_string(\$arg4) + arg5=user_string(\$arg5) + printf(\"%s %s %#x %s %s %s\\n\",\"query__exec__start\", arg1, \$arg2, + arg3, arg4, arg5); +} +probe process(@1).mark(\"query__exec__done\") +{ + printf(\"%s %#x\\n\",\"query__exec__done\", \$arg1); +} +probe process(@1).mark(\"insert__row__start\") +{ + arg1=user_string(\$arg1) + arg2=user_string(\$arg2) + printf(\"%s %s %s \\n\",\"insert__row__start\", arg1, arg2); +} +probe process(@1).mark(\"insert__row__done\") +{ + printf(\"%s %#x\\n\",\"insert__row__done\", \$arg1); +} +probe process(@1).mark(\"update__row__start\") +{ + arg1=user_string(\$arg1) + arg2=user_string(\$arg2) + printf(\"%s %s %s \\n\",\"update__row__start\", arg1, arg2); +} +probe process(@1).mark(\"update__row__done\") +{ + printf(\"%s %#x\\n\",\"update__row__done\", \$arg1); +} +probe process(@1).mark(\"delete__row__start\") +{ + arg1=user_string(\$arg1) + arg2=user_string(\$arg2) + printf(\"%s %s %s \\n\",\"delete__row__start\", arg1, arg2); +} +probe process(@1).mark(\"delete__row__done\") +{ + printf(\"%s %#x\\n\",\"delete__row__done\", \$arg1); +} +probe process(@1).mark(\"handler__rdlock__start\") +{ + arg1=user_string(\$arg1) + arg2=user_string(\$arg2) + printf(\"%s %s %s \\n\",\"handler__rdlock__start\", arg1, arg2); +} +probe process(@1).mark(\"handler__wrlock__start\") +{ + arg1=user_string(\$arg1) + arg2=user_string(\$arg2) + printf(\"%s %s %s \\n\",\"handler__wrlock__start\", arg1, arg2); +} +probe process(@1).mark(\"handler__unlock__start\") +{ + arg1=user_string(\$arg1) + arg2=user_string(\$arg2) + printf(\"%s %s %s \\n\",\"handler__unlock__start\", arg1, arg2); +} +probe process(@1).mark(\"handler__rdlock__done\") +{ + printf(\"%s %#x\\n\",\"handler__rdlock__done\", \$arg1); +} +probe process(@1).mark(\"handler__wrlock__done\") +{ + printf(\"%s %#x\\n\",\"handler__wrlock__done\", \$arg1); +} +probe process(@1).mark(\"handler__unlock__done\") +{ + printf(\"%s %#x\\n\",\"handler__unlock__done\", \$arg1); +} +probe process(@1).mark(\"filesort__start\") +{ + printf(\"%s %#x %#x \\n\",\"filesort__start\", \$arg1, \$arg2); +} +probe process(@1).mark(\"filesort__done\") +{ + printf(\"%s %#x %#x \\n\",\"filesort__done\", \$arg1, \$arg2); +} +probe process(@1).mark(\"select__start\") +{ + arg1=user_string(\$arg1) + printf(\"%s %s\\n\",\"select__start\", arg1); +} +probe process(@1).mark(\"select__done\") +{ + printf(\"%s %#x %#x \\n\",\"select__done\", \$arg1, \$arg2); +} +probe process(@1).mark(\"insert__start\") +{ + arg1=user_string(\$arg1) + printf(\"%s %s\\n\",\"insert__start\", arg1); +} +probe process(@1).mark(\"insert__done\") +{ + printf(\"%s %#x %#x \\n\",\"insert__done\", \$arg1, \$arg2); +} +probe process(@1).mark(\"insert__select__start\") +{ + arg1=user_string(\$arg1) + printf(\"%s %s\\n\",\"insert__select__start\", arg1); +} +probe process(@1).mark(\"insert__select__done\") +{ + printf(\"%s %#x %#x \\n\",\"insert__select__done\", \$arg1, \$arg2); +} +probe process(@1).mark(\"update__start\") +{ + arg1=user_string(\$arg1) + printf(\"%s %s\\n\",\"update__start\", arg1); +} +probe process(@1).mark(\"update__done\") +{ + printf(\"%s %#x %#x %#x\\n\",\"update__done\", \$arg1, \$arg2, \$arg3); +} +probe process(@1).mark(\"multi__update__start\") +{ + arg1=user_string(\$arg1) + printf(\"%s %s\\n\",\"multi__update__start\", arg1); +} +probe process(@1).mark(\"multi__update__done\") +{ + printf(\"%s %#x %#x %#x\\n\",\"multi__update__done\", \$arg1, \$arg2, \$arg3); +} +probe process(@1).mark(\"delete__start\") +{ + arg1=user_string(\$arg1) + printf(\"%s %s\\n\",\"delete__start\", arg1); +} +probe process(@1).mark(\"delete__done\") +{ + printf(\"%s %#x %#x \\n\",\"delete__done\", \$arg1, \$arg2); +} +probe process(@1).mark(\"multi__delete__start\") +{ + arg1=user_string(\$arg1) + printf(\"%s %s\\n\",\"multi__delete__start\", arg1); +} +probe process(@1).mark(\"multi__delete__done\") +{ + printf(\"%s %#x %#x \\n\",\"multi__delete__done\", \$arg1, \$arg2); +} +probe process(@1).mark(\"net__read__start\") +{ + printf(\"%s \\n\",\"net__read__start\"); +} +probe process(@1).mark(\"net__read__done\") +{ + printf(\"%s %#x %#x \\n\",\"net__read__done\", \$arg1, \$arg2); +} +probe process(@1).mark(\"net__write__start\") +{ + printf(\"%s %#x\\n\",\"net__write__start\", \$arg1); +} +probe process(@1).mark(\"net__write__done\") +{ + printf(\"%s %#x\\n\",\"net__write__done\", \$arg1); +} +" +close $fp + +########## Begin /tmp/stap-mysql.sh ########## +set fp [open "$testsuite/stap-mysql.sh" "w"] +puts $fp " +##### begin run_tests ##### +function run_tests \{ +/bin/rm -rf $testsuite/stap-mysql +$mysqldir/bin/mysql_install_db --basedir=$mysqldir --datadir=$msdata + +(cd $mysqldir/mysql-test +# wait until mysql is running +MOD=stapsdt_\$(date +%j%k%M%N | sed 's/ //') +$env(SYSTEMTAP_PATH)/stap -m \$MOD -c \"$mysqldir/libexec/mysqld --basedir=$mysqldir --datadir=$msdata --log-error=$msdata/mysql.log --pid-file=$msdata/mysql.pid --socket=$msdata/mysql.sock\" $testsuite/stap-mysql.stp $mysqldir/libexec/mysqld >$testsuite/stap-mysql-markers.log 2>&1 & +STAPPID=\$! + +for i in \$(seq 0 10) ; do + if $mysqldir/bin/mysqladmin ping --socket=$msdata/mysql.sock + then break; + fi + sleep 5 +done + +for i in select join insert query +do + echo '##### ' \$i + ./mysql-test-run.pl --force --extern socket=$msdata/mysql.sock \ + --tmpdir=/tmp/,mysql --vardir=/tmp/,mysql --do-test=\$i +done > $testsuite/stap-mysql.log +) + +ACQUIRE=\$(grep 'handler__unlock__start' $testsuite/stap-mysql-markers.log | wc -l) +RELEASE=\$(grep 'handler__unlock__done' $testsuite/stap-mysql-markers.log | wc -l) +COMMAND=\$(grep 'command__start' $testsuite/stap-mysql-markers.log | wc -l) +QUERY=\$(grep 'query__start' $testsuite/stap-mysql-markers.log | wc -l) +RDLOCK=\$(grep 'handler__rdlock__start' $testsuite/stap-mysql-markers.log | wc -l) +SELECT=\$(grep 'select_start' $testsuite/stap-mysql-markers.log | wc -l) +OKAY=\$(grep 'All.*tests were successful' $testsuite/stap-mysql.log | wc -l) + +echo ACQUIRE=\$ACQUIRE RELEASE=\$RELEASE COMMAND=\$COMMAND QUERY=\$QUERY RDLOCK=\$RDLOCK SELECT=\$SELECT OKAY=\$OKAY +if \[ \$ACQUIRE -gt 10000 -a \$RELEASE -gt 1000 -a \$COMMAND -gt 12000 -a \$QUERY -gt 13000 -a \$RDLOCK -gt 3000 \] ; then + echo PASS: mysql markers \$1 +else + echo FAIL: mysql markers \$1 +fi + +if \[ \$OKAY -eq 4 \] ; then + echo PASS: mysql tests \$1 +else + echo FAIL: mysql tests \$1 +fi + +$mysqldir/bin/mysqladmin shutdown -u root --socket=stap-mysql/mysql.sock +kill \$STAPPID +\} +##### end run_tests ##### + +if \[ ! -r $mysqlrelease.tar.gz \] ; then +wget http://dev.mysql.com/get/Downloads/MySQL-5.4/$mysqlrelease.tar.gz/from/ftp://mirror.services.wisc.edu/mirrors/mysql/ +fi + +if \[ ! -d mysql/src \] ; then +tar -x -z -f $mysqlrelease.tar.gz +mkdir mysql +mv $mysqlrelease mysql/src +fi + +if \[ ! -f mysql/install/bin/mysql \] ; then +cd mysql +mkdir bld +cd bld +# Force the use of dtrace +sed -i -e 's/HAVE_DTRACE_DASH_G=\"no\"/HAVE_DTRACE_DASH_G=\"yes\"/' ../src/configure +../src/configure --enable-dtrace --prefix=$mysqldir +for i in \$(find . -name Makefile) ; do + sed -i -e 's/^CXXFLAGS =/& -g/' \$i +done + +make -j2 +cp ./abi_check.out ../../src/include/mysql.h.pp +make -j2 +make install +fi + +run_tests uprobe +" +########## End /tmp/stap-mysql.sh ########## +close $fp + +########## /tmp/stap-mysql.sh does most of the work ########## +verbose -log Running mysql testsuite +spawn sh stap-mysql.sh 2>&1 +expect { + -timeout 1000 + -re {FAIL: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s; + fail "$s"; exp_continue } + -re {PASS: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s; + pass "$s"; exp_continue } + -re {UNSUPPORTED: [a-zA-Z_/: ]+} { regexp " .*$" $expect_out(0,string) s; + verbose -log "$s" + unsupported "$s"; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} + +if { $verbose == 0 } { +catch {exec rm -rf $msdata} +catch {exec rm -rf $testsuite/stap-mysql.stp $testsuite/stap-mysql.log \ + $testsuite/stap-mysql-markers.log $testsuite/stap-mysql.sh $mysqlrelease.tar.gz} +catch {exec rm -rf mysql} +} diff --git a/testsuite/systemtap.apps/postgres.exp b/testsuite/systemtap.apps/postgres.exp new file mode 100644 index 00000000..2d58a54f --- /dev/null +++ b/testsuite/systemtap.apps/postgres.exp @@ -0,0 +1,166 @@ +set test "postgres" + +# Test sdt support in postgres. + +global env + +if {! [info exists env(SYSTEMTAP_TEST_SDT)]} { + unsupported "postgres (\"SYSTEMTAP_TEST_SDT\" not in env)" + return +} + +########## Create /tmp/stap-postgres.stp ########## +set postgresbuild "[pwd]/postgresql-8.3.6/bld" +set postgresdir "[pwd]/postgresql-8.3.6/install/" +set pgdata "/tmp/stap-postgres" + + +set fp [open "$pgdata.stp" "w"] +puts $fp " +probe process(\"$postgresdir/bin/postgres\").mark(\"transaction__start\") +{ + printf(\"%s %#x\\n\", \$\$name, \$arg1); +} +probe process(\"$postgresdir/bin/postgres\").mark(\"transaction__commit\") +{ + printf(\"%s %#x\\n\", \$\$name, \$arg1); +} +probe process(\"$postgresdir/bin/postgres\").mark(\"transaction__abort\") +{ + printf(\"%s %#x\\n\", \$\$name, \$arg1); +} +probe process(\"$postgresdir/bin/postgres\").mark(\"lock__startwait\") +{ + printf(\"%s %#x %#x\\n\", \$\$name, \$arg1, \$arg2); +} +probe process(\"$postgresdir/bin/postgres\").mark(\"lock__endwait\") +{ + printf(\"%s %#x %#x\\n\", \$\$name, \$arg1, \$arg2); +} +probe process(\"$postgresdir/bin/postgres\").mark(\"lwlock__endwait\") +{ + printf(\"%s %#x %#x\\n\", \$\$name, \$arg1, \$arg2); +} +probe process(\"$postgresdir/bin/postgres\").mark(\"lwlock__acquire\") +{ + printf(\"%s %#x %#x\\n\", \$\$name, \$arg1, \$arg2); +} +probe process(\"$postgresdir/bin/postgres\").mark(\"lwlock__condacquire__fail\") +{ + printf(\"%s %#x %#x\\n\", \$\$name, + \$arg1, \$arg2); +} +probe process(\"$postgresdir/bin/postgres\").mark(\"lwlock__condacquire\") +{ + printf(\"%s %#x %#x\\n\", \$\$name, \$arg1, \$arg2); +} +probe process(\"$postgresdir/bin/postgres\").mark(\"lwlock__release\") +{ + printf(\"%s %#x\\n\", \$\$name, \$arg1); +} +" +close $fp + +########## Begin /tmp/stap-postgres.sh ########## +set fp [open "$pgdata.sh" "w"] +puts $fp " +function run_tests \{ +/bin/rm -rf $pgdata +$postgresdir/bin/initdb $pgdata + +which stap +$env(SYSTEMTAP_PATH)/stap -m \$(date +stapsdt_%j%k%M%N | sed 's/ //') -c \"$postgresdir/bin/postgres -D $pgdata\" $pgdata.stp >$pgdata-markers.log 2>&1 & +STAPPID=\$! + +# wait until postgres is running +for i in \$(seq 0 10) ; do + if $postgresdir/bin/pg_ctl status -D $pgdata + then break; + fi + sleep 5 +done + +(cd $postgresbuild/src/test/regress/ + make installcheck > $pgdata.log 2>&1) + +ACQUIRE=\$(grep 'lwlock__acquire 0x\[0-9\]* 0x\[0-9\]*' $pgdata-markers.log | wc -l) +RELEASE=\$(grep 'lwlock__release 0x\[0-9\]*' $pgdata-markers.log | wc -l) +START=\$(grep 'transaction__start 0x\[0-9\]*' $pgdata-markers.log | wc -l) +COMMIT=\$(grep 'transaction__commit 0x\[0-9\]*' $pgdata-markers.log | wc -l) +OKAY=\$(grep 'test .*ok' $pgdata.log | wc -l) + +echo lwlock__acquire=\$ACQUIRE lwlock__release=\$RELEASE transaction__start=\$START transaction__commit=\$COMMIT test-ok=\$OKAY +: 44873 75325 591 489 0 + +if \[ \$ACQUIRE -gt 40000 -a \$RELEASE -gt 70000 -a \$START -gt 500 -a \$COMMIT -gt 400 \] ; then + echo PASS: postgres tests \$1 +else + echo FAIL: postgres tests \$1 +fi + +if \[ \$OKAY -gt 100 \] ; then + echo PASS: postgres markers \$1 +else + echo FAIL: postgres markers \$1 +fi + +/usr/local/pgsql/bin/pg_ctl stop -D $pgdata +kill \$STAPPID +\} + +if \[ ! -r postgresql-8.3.6.tar.bz2 \] ; then +wget http://wwwmaster.postgresql.org/redir/198/h/source/v8.3.6/postgresql-8.3.6.tar.bz2 +fi + +if \[ ! -d $postgresbuild/src/backend \] ; then +tar -x -f postgresql-8.3.6.tar.bz2 +fi + +cd postgresql-8.3.6/ +mkdir bld;cd bld +../configure --enable-dtrace --prefix=$postgresdir +# sed -i -e 's/ifeq (\$(PORTNAME), solaris)/ifeq (\$(enable_dtrace), yes)/' src/backend/Makefile +sed -i -e 's/^CFLAGS = -O2.*\$/& -g -DEXPERIMENTAL_UTRACE_SDT/' src/Makefile.global +make +make install +run_tests utrace + +sed -i -e 's/UTRACE/KPROBE/' src/Makefile.global +(cd src/backend/utils/ + make clean) +make +make install +run_tests kprobe + +sed -i -e 's/-DEXPERIMENTAL_KPROBE_SDT//' src/Makefile.global +(cd src/backend/utils/ + make clean) +make +make install +run_tests uprobe +" +########## End /tmp/stap-postgres.sh ########## +close $fp + +########## /tmp/stap-postgres.sh does most of the work ########## +verbose -log Running postgres testsuite +spawn sh $pgdata.sh 2>&1 +expect { + -timeout 1000 + -re {FAIL: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s; + fail "$s"; exp_continue } + -re {PASS: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s; + pass "$s"; exp_continue } + -re {UNSUPPORTED: [a-zA-Z_/: ]+} { regexp " .*$" $expect_out(0,string) s; + verbose -log "$s" + unsupported "$s"; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} + +if { $verbose == 0 } { +catch {exec rm -rf $pgdata} +catch {exec rm -rf $pgdata.stp $pgdata.log \ + $pgdata-markers.log $pgdata.sh postgresql-8.3.6.tar.bz2} +catch {exec rm -rf postgresql-8.3.6} +} diff --git a/testsuite/systemtap.apps/stap-tcl.sh b/testsuite/systemtap.apps/stap-tcl.sh new file mode 100644 index 00000000..919f632d --- /dev/null +++ b/testsuite/systemtap.apps/stap-tcl.sh @@ -0,0 +1,25 @@ +#! /bin/sh + +set -e + +tclreleasemajor="8.6" +tclrelease="8.6b1" +tcldir=`pwd`/tcl/install/ + +mkdir -p tcl + +if [ ! -r tcl$tclrelease-src.tar.gz ] ; then + wget http://sourceforge.net/projects/tcl/files/Tcl/$tclrelease/tcl$tclrelease-src.tar.gz/download +fi + +if [ ! -d tcl/src ] ; then + tar -x -z -f tcl$tclrelease-src.tar.gz + mv tcl$tclrelease tcl/src +fi + +cd tcl/src/unix +env CPPFLAGS="-I$SYSTEMTAP_INCLUDES" CFLAGS="-g -O2" ./configure --prefix=$tcldir --enable-dtrace +make -j2 +make install + +exit 0 diff --git a/testsuite/systemtap.apps/stap-tcl.stp b/testsuite/systemtap.apps/stap-tcl.stp new file mode 100644 index 00000000..d3293b09 --- /dev/null +++ b/testsuite/systemtap.apps/stap-tcl.stp @@ -0,0 +1,30 @@ +global counts + +probe process(@1).mark("*") { + counts[$$name]<<<1 # PR10878; check also $$parms length +} + +function judge(name, minvalue) { + value = @count(counts[name]) + printf("%s %s %d %d\n", ((value>=minvalue)?"OK":"KO"), name, value, minvalue) +} + +probe end,error { + /* foreach (name in counts-) { + printf("== %s %d\n", name, @count(counts[name])) + } */ + judge("proc__entry", 9000) + judge("proc__return", 9000) + judge("proc__result", 9000) + judge("proc__args", 9000) + judge("proc__info", 9000) + judge("cmd__entry", 37000) + judge("cmd__return", 37000) + judge("cmd__result", 37000) + judge("cmd__args", 3700 /* not 37000? */) + judge("cmd__info", 37000) + judge("inst__start", 542000) + judge("inst__done", 542000) + judge("obj__create", 723000) + judge("obj__free", 704000) +} diff --git a/testsuite/systemtap.apps/tcl.exp b/testsuite/systemtap.apps/tcl.exp new file mode 100644 index 00000000..bfcf2239 --- /dev/null +++ b/testsuite/systemtap.apps/tcl.exp @@ -0,0 +1,67 @@ +set test "tcl" + +# Test sdt support in tcl. + +global env + +if {! [info exists env(SYSTEMTAP_TESTAPPS)] || ( + ! [string match "tcl" $env(SYSTEMTAP_TESTAPPS)] && + ! [string match "all" $env(SYSTEMTAP_TESTAPPS)])} { + untested "$test sdt app" + return +} + +########## Create /tmp/stap-tcl.stp ########## +set tclreleasemajor "8.6" +set tclrelease "8.6b1" +set tcldir "[pwd]/tcl/install/" +set testsuite "[pwd]" + +verbose -log "Building tcl" +set test "tcl${tclreleasemajor} build" +set rc [catch {exec sh $srcdir/$subdir/stap-tcl.sh 2>@ stdout} out] +if {$rc != 0} { + clone_output $out + fail $test + return +} else { + pass $test +} + +set test "stap-tcl.stp compilation" +set rc [catch {exec stap -DMAXSKIPPED=8024 -t -p4 $srcdir/$subdir/stap-tcl.stp tcl/install/lib/libtcl${tclreleasemajor}.so} out] +clone_output $out +if {$rc != 0} { + fail $test + return +} else { + pass $test +} + +set test "stap-tcl.stp execution" +if {![installtest_p]} { + untested $test + return +} + +set ok 0 +set ko 0 +set lines 0 +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/lib/libtcl${tclreleasemajor}.so +expect { + -timeout 1000 + -re {^OK [^\r\n]*[\r\n]} { incr ok; exp_continue } + -re {^KO [^\r\n]*[\r\n]} { incr ko; exp_continue } + -re {^ERROR[^\r\n]*[\r\n]} { incr ko; exp_continue } + -re {^[^\r\n]*[\r\n]} { incr lines; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} +catch {close}; catch {wait} + +if {$ok == 14 && $ko == 0} { + pass "$test ($ok $ko $lines)" +} else { + fail "$test ($ok $ko $lines)" +} + diff --git a/testsuite/systemtap.apps/xulrunner.exp b/testsuite/systemtap.apps/xulrunner.exp new file mode 100644 index 00000000..be2db0c7 --- /dev/null +++ b/testsuite/systemtap.apps/xulrunner.exp @@ -0,0 +1,133 @@ +set test "xulrunner" + +# Test sdt support in xulrunner. + +global env + +if {! [info exists env(SYSTEMTAP_TEST_SDT)]} { + unsupported "xulrunner (\"SYSTEMTAP_TEST_SDT\" not in env)" + return +} + +########## Create /tmp/stap-xul.stp ########## +set xulrelease "1.9.1.3" +set xuldir "[pwd]/xul/" +set testsuite "[pwd]" + +set fp [open "$testsuite/stap-xul.stp" "w"] +puts $fp " +global funcinfo +global objinfo + +probe process(@1).mark(\"function__info\") +{ + file = user_string (\$arg1) + func = user_string (\$arg3) + funcinfo\[file,func\] <<< 1 +} + +probe process(@1).mark(\"object__create\") +{ + file = user_string (\$arg1) + class = user_string (\$arg2) + objinfo\[file,class\] <<< 1 +} + +probe end +{ + foreach (\[i,j\] in funcinfo+) + { + printf (\"probes: %-20s %-25s %d\\n\", substr(i,strlen(i)-20,strlen(i)), j, @count(funcinfo\[i,j\])) + } + foreach (\[i,j\] in objinfo+) + { + printf (\"probes: %-20s %-25s %d\\n\", substr(i,strlen(i)-20,strlen(i)), j, @count(funcinfo\[i,j\])) + } +} +" +close $fp + +########## Begin /tmp/stap-xul.sh ########## +set fp [open "$testsuite/stap-xul.sh" "w"] +puts $fp " +##### begin run_tests ##### +function run_tests \{ +cd $testsuite/xul/bld/js/src +pwd +for i in call trace-test math-trace-tests ; do +$env(SYSTEMTAP_PATH)/stap -c \"./js $xuldir/src/js/src/\$i.js\" $testsuite/stap-xul.stp ./js +done | tee $testsuite/stap-xul-markers.log +PROBES=\$(grep 'probes: ' $testsuite/stap-xul-markers.log | wc -l) +TESTS=\$(grep '-FAIL' $testsuite/stap-xul-markers.log) +echo PROBES=\$PROBES TESTS=\$TESTS + +if \[ \$PROBES -gt 400 \] ; then + echo PASS: xulrunner javascript markers \$1 +else + echo FAIL: xulrunner javascript markers \$1 +fi + +if \[ -z \$TESTS \] ; then + echo PASS: xulrunner javascript testsuite \$1 +else + echo FAIL: xulrunner javascript testsuite \$1 +fi + +\} +##### end run_tests ##### + +if \[ ! -r xulrunner-$xulrelease-source.tar \] ; then +wget ftp://ftp.mozilla.org/pub/mozilla.org/xul/releases/$xulrelease/source/xulrunner-$xulrelease-source.tar.bz2 +bunzip2 xulrunner-$xulrelease-source.tar.bz2 +fi + +if \[ ! -d xul/src \] ; then +tar -x -f xulrunner-$xulrelease-source.tar +mkdir xul +xulrelease=$xulrelease +mv mozilla-\${xulrelease%.\[0-9\]} xul/src +fi + +if \[ ! -f xul/bld/js/src/js \] ; then +mkdir xul/bld +cd xul/bld +if rpm -q java-1.6.0-openjdk ; then : +else + echo FAIL: Need java-1.6.0-openjdk-devel + exit +fi +JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64 \ +CXXFLAGS='-g -I$env(SYSTEMTAP_INCLUDES)' \ +CFLAGS='-g -I$env(SYSTEMTAP_INCLUDES)' \ +PATH=$env(SYSTEMTAP_PATH)/:\$PATH \ +../src/configure --prefix=$xuldir --enable-dtrace --enable-application=xulrunner +J=\$(getconf _NPROCESSORS_CONF) +make -j \$J +fi + +run_tests uprobe +" +########## End /tmp/stap-xul.sh ########## +close $fp + +########## /tmp/stap-xul.sh does most of the work ########## +verbose -log Running xul testsuite +spawn sh stap-xul.sh 2>&1 +expect { + -timeout 10000 + -re {FAIL: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s; + fail "$s"; exp_continue } + -re {PASS: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s; + pass "$s"; exp_continue } + -re {UNSUPPORTED: [a-zA-Z_/: ]+} { regexp " .*$" $expect_out(0,string) s; + verbose -log "$s" + unsupported "$s"; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} + +if { $verbose == 0 } { +catch {exec rm -rf $testsuite/stap-xul.stp xulrunner-$xulrelease-source.tar \ + $testsuite/stap-xul-markers.log $testsuite/stap-xul.sh } +catch {exec rm -rf xul} +} diff --git a/testsuite/systemtap.base/mysql.exp b/testsuite/systemtap.base/mysql.exp deleted file mode 100644 index efeffbae..00000000 --- a/testsuite/systemtap.base/mysql.exp +++ /dev/null @@ -1,344 +0,0 @@ -set test "mysql" - -# Test sdt support in mysql. - -global env - -if {! [info exists env(SYSTEMTAP_TEST_SDT)]} { - unsupported "mysql (\"SYSTEMTAP_TEST_SDT\" not in env)" - return -} - -########## Create /tmp/stap-mysql.stp ########## -set msdata "[pwd]/stap-mysql" -set mysqlrelease "mysql-5.4.1-beta" -set mysqldir "[pwd]/mysql/install/" -set testsuite "[pwd]" - -set fp [open "$testsuite/stap-mysql.stp" "w"] -puts $fp " -probe process(@1).mark(\"connection__start\") -{ - arg2 = user_string(\$arg2) - arg3 = user_string(\$arg3) - printf(\"%s %#x %s %s\\n\",\"connection__start\", \$arg1, arg2, arg3); -} -probe process(@1).mark(\"connection__done\") -{ - printf(\"%s %#x %#x \\n\",\"connection__done\", \$arg1, \$arg2); -} -probe process(@1).mark(\"command__start\") -{ - arg3 = user_string(\$arg3) - arg4 = user_string(\$arg4) - printf(\"%s %#x %#x %s %s\\n\",\"command__start\", \$arg1, \$arg2, arg3, arg4); -} -probe process(@1).mark(\"command__done\") -{ - printf(\"%s %#x\\n\",\"command__done\", \$arg1); -} -probe process(@1).mark(\"query__start\") -{ - arg1 = user_string(\$arg1) - arg3 = user_string(\$arg3) - arg4 = user_string(\$arg4) - arg5 = user_string(\$arg5) - printf(\"%s %s %#x %s %s %s\\n\",\"query__start\", arg1, \$arg2, - arg3, arg4, arg5); -} -probe process(@1).mark(\"query__done\") -{ - printf(\"%s %#x\\n\",\"query__done\", \$arg1); -} -probe process(@1).mark(\"query__parse__start\") -{ - arg1 = user_string(\$arg1) - printf(\"%s %s\\n\",\"query__parse__start\", arg1); -} -probe process(@1).mark(\"query__parse__done\") -{ - printf(\"%s %#x\\n\",\"query__parse__done\", \$arg1); -} -probe process(@1).mark(\"query__cache__hit\") -{ - arg1=user_string(\$arg1) - arg2=user_string(\$arg2) - printf(\"%s %s %s \\n\",\"query__cache__hit\", arg1, arg2); -} -probe process(@1).mark(\"query__cache__miss\") -{ - arg1=user_string(\$arg1) - printf(\"%s %s\\n\",\"query__cache__miss\", arg1); -} -probe process(@1).mark(\"query__exec__start\") -{ - arg1=user_string(\$arg1) - arg3=user_string(\$arg3) - arg4=user_string(\$arg4) - arg5=user_string(\$arg5) - printf(\"%s %s %#x %s %s %s\\n\",\"query__exec__start\", arg1, \$arg2, - arg3, arg4, arg5); -} -probe process(@1).mark(\"query__exec__done\") -{ - printf(\"%s %#x\\n\",\"query__exec__done\", \$arg1); -} -probe process(@1).mark(\"insert__row__start\") -{ - arg1=user_string(\$arg1) - arg2=user_string(\$arg2) - printf(\"%s %s %s \\n\",\"insert__row__start\", arg1, arg2); -} -probe process(@1).mark(\"insert__row__done\") -{ - printf(\"%s %#x\\n\",\"insert__row__done\", \$arg1); -} -probe process(@1).mark(\"update__row__start\") -{ - arg1=user_string(\$arg1) - arg2=user_string(\$arg2) - printf(\"%s %s %s \\n\",\"update__row__start\", arg1, arg2); -} -probe process(@1).mark(\"update__row__done\") -{ - printf(\"%s %#x\\n\",\"update__row__done\", \$arg1); -} -probe process(@1).mark(\"delete__row__start\") -{ - arg1=user_string(\$arg1) - arg2=user_string(\$arg2) - printf(\"%s %s %s \\n\",\"delete__row__start\", arg1, arg2); -} -probe process(@1).mark(\"delete__row__done\") -{ - printf(\"%s %#x\\n\",\"delete__row__done\", \$arg1); -} -probe process(@1).mark(\"handler__rdlock__start\") -{ - arg1=user_string(\$arg1) - arg2=user_string(\$arg2) - printf(\"%s %s %s \\n\",\"handler__rdlock__start\", arg1, arg2); -} -probe process(@1).mark(\"handler__wrlock__start\") -{ - arg1=user_string(\$arg1) - arg2=user_string(\$arg2) - printf(\"%s %s %s \\n\",\"handler__wrlock__start\", arg1, arg2); -} -probe process(@1).mark(\"handler__unlock__start\") -{ - arg1=user_string(\$arg1) - arg2=user_string(\$arg2) - printf(\"%s %s %s \\n\",\"handler__unlock__start\", arg1, arg2); -} -probe process(@1).mark(\"handler__rdlock__done\") -{ - printf(\"%s %#x\\n\",\"handler__rdlock__done\", \$arg1); -} -probe process(@1).mark(\"handler__wrlock__done\") -{ - printf(\"%s %#x\\n\",\"handler__wrlock__done\", \$arg1); -} -probe process(@1).mark(\"handler__unlock__done\") -{ - printf(\"%s %#x\\n\",\"handler__unlock__done\", \$arg1); -} -probe process(@1).mark(\"filesort__start\") -{ - printf(\"%s %#x %#x \\n\",\"filesort__start\", \$arg1, \$arg2); -} -probe process(@1).mark(\"filesort__done\") -{ - printf(\"%s %#x %#x \\n\",\"filesort__done\", \$arg1, \$arg2); -} -probe process(@1).mark(\"select__start\") -{ - arg1=user_string(\$arg1) - printf(\"%s %s\\n\",\"select__start\", arg1); -} -probe process(@1).mark(\"select__done\") -{ - printf(\"%s %#x %#x \\n\",\"select__done\", \$arg1, \$arg2); -} -probe process(@1).mark(\"insert__start\") -{ - arg1=user_string(\$arg1) - printf(\"%s %s\\n\",\"insert__start\", arg1); -} -probe process(@1).mark(\"insert__done\") -{ - printf(\"%s %#x %#x \\n\",\"insert__done\", \$arg1, \$arg2); -} -probe process(@1).mark(\"insert__select__start\") -{ - arg1=user_string(\$arg1) - printf(\"%s %s\\n\",\"insert__select__start\", arg1); -} -probe process(@1).mark(\"insert__select__done\") -{ - printf(\"%s %#x %#x \\n\",\"insert__select__done\", \$arg1, \$arg2); -} -probe process(@1).mark(\"update__start\") -{ - arg1=user_string(\$arg1) - printf(\"%s %s\\n\",\"update__start\", arg1); -} -probe process(@1).mark(\"update__done\") -{ - printf(\"%s %#x %#x %#x\\n\",\"update__done\", \$arg1, \$arg2, \$arg3); -} -probe process(@1).mark(\"multi__update__start\") -{ - arg1=user_string(\$arg1) - printf(\"%s %s\\n\",\"multi__update__start\", arg1); -} -probe process(@1).mark(\"multi__update__done\") -{ - printf(\"%s %#x %#x %#x\\n\",\"multi__update__done\", \$arg1, \$arg2, \$arg3); -} -probe process(@1).mark(\"delete__start\") -{ - arg1=user_string(\$arg1) - printf(\"%s %s\\n\",\"delete__start\", arg1); -} -probe process(@1).mark(\"delete__done\") -{ - printf(\"%s %#x %#x \\n\",\"delete__done\", \$arg1, \$arg2); -} -probe process(@1).mark(\"multi__delete__start\") -{ - arg1=user_string(\$arg1) - printf(\"%s %s\\n\",\"multi__delete__start\", arg1); -} -probe process(@1).mark(\"multi__delete__done\") -{ - printf(\"%s %#x %#x \\n\",\"multi__delete__done\", \$arg1, \$arg2); -} -probe process(@1).mark(\"net__read__start\") -{ - printf(\"%s \\n\",\"net__read__start\"); -} -probe process(@1).mark(\"net__read__done\") -{ - printf(\"%s %#x %#x \\n\",\"net__read__done\", \$arg1, \$arg2); -} -probe process(@1).mark(\"net__write__start\") -{ - printf(\"%s %#x\\n\",\"net__write__start\", \$arg1); -} -probe process(@1).mark(\"net__write__done\") -{ - printf(\"%s %#x\\n\",\"net__write__done\", \$arg1); -} -" -close $fp - -########## Begin /tmp/stap-mysql.sh ########## -set fp [open "$testsuite/stap-mysql.sh" "w"] -puts $fp " -##### begin run_tests ##### -function run_tests \{ -/bin/rm -rf $testsuite/stap-mysql -$mysqldir/bin/mysql_install_db --basedir=$mysqldir --datadir=$msdata - -(cd $mysqldir/mysql-test -# wait until mysql is running -MOD=stapsdt_\$(date +%j%k%M%N | sed 's/ //') -$env(SYSTEMTAP_PATH)/stap -m \$MOD -c \"$mysqldir/libexec/mysqld --basedir=$mysqldir --datadir=$msdata --log-error=$msdata/mysql.log --pid-file=$msdata/mysql.pid --socket=$msdata/mysql.sock\" $testsuite/stap-mysql.stp $mysqldir/libexec/mysqld >$testsuite/stap-mysql-markers.log 2>&1 & -STAPPID=\$! - -for i in \$(seq 0 10) ; do - if $mysqldir/bin/mysqladmin ping --socket=$msdata/mysql.sock - then break; - fi - sleep 5 -done - -for i in select join insert query -do - echo '##### ' \$i - ./mysql-test-run.pl --force --extern socket=$msdata/mysql.sock \ - --tmpdir=/tmp/,mysql --vardir=/tmp/,mysql --do-test=\$i -done > $testsuite/stap-mysql.log -) - -ACQUIRE=\$(grep 'handler__unlock__start' $testsuite/stap-mysql-markers.log | wc -l) -RELEASE=\$(grep 'handler__unlock__done' $testsuite/stap-mysql-markers.log | wc -l) -COMMAND=\$(grep 'command__start' $testsuite/stap-mysql-markers.log | wc -l) -QUERY=\$(grep 'query__start' $testsuite/stap-mysql-markers.log | wc -l) -RDLOCK=\$(grep 'handler__rdlock__start' $testsuite/stap-mysql-markers.log | wc -l) -SELECT=\$(grep 'select_start' $testsuite/stap-mysql-markers.log | wc -l) -OKAY=\$(grep 'All.*tests were successful' $testsuite/stap-mysql.log | wc -l) - -echo ACQUIRE=\$ACQUIRE RELEASE=\$RELEASE COMMAND=\$COMMAND QUERY=\$QUERY RDLOCK=\$RDLOCK SELECT=\$SELECT OKAY=\$OKAY -if \[ \$ACQUIRE -gt 10000 -a \$RELEASE -gt 1000 -a \$COMMAND -gt 12000 -a \$QUERY -gt 13000 -a \$RDLOCK -gt 3000 \] ; then - echo PASS: mysql markers \$1 -else - echo FAIL: mysql markers \$1 -fi - -if \[ \$OKAY -eq 4 \] ; then - echo PASS: mysql tests \$1 -else - echo FAIL: mysql tests \$1 -fi - -$mysqldir/bin/mysqladmin shutdown -u root --socket=stap-mysql/mysql.sock -kill \$STAPPID -\} -##### end run_tests ##### - -if \[ ! -r $mysqlrelease.tar.gz \] ; then -wget http://dev.mysql.com/get/Downloads/MySQL-5.4/$mysqlrelease.tar.gz/from/ftp://mirror.services.wisc.edu/mirrors/mysql/ -fi - -if \[ ! -d mysql/src \] ; then -tar -x -z -f $mysqlrelease.tar.gz -mkdir mysql -mv $mysqlrelease mysql/src -fi - -if \[ ! -f mysql/install/bin/mysql \] ; then -cd mysql -mkdir bld -cd bld -# Force the use of dtrace -sed -i -e 's/HAVE_DTRACE_DASH_G=\"no\"/HAVE_DTRACE_DASH_G=\"yes\"/' ../src/configure -../src/configure --enable-dtrace --prefix=$mysqldir -for i in \$(find . -name Makefile) ; do - sed -i -e 's/^CXXFLAGS =/& -g/' \$i -done - -make -j2 -cp ./abi_check.out ../../src/include/mysql.h.pp -make -j2 -make install -fi - -run_tests uprobe -" -########## End /tmp/stap-mysql.sh ########## -close $fp - -########## /tmp/stap-mysql.sh does most of the work ########## -verbose -log Running mysql testsuite -spawn sh stap-mysql.sh 2>&1 -expect { - -timeout 1000 - -re {FAIL: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s; - fail "$s"; exp_continue } - -re {PASS: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s; - pass "$s"; exp_continue } - -re {UNSUPPORTED: [a-zA-Z_/: ]+} { regexp " .*$" $expect_out(0,string) s; - verbose -log "$s" - unsupported "$s"; exp_continue } - timeout { fail "$test (timeout)" } - eof { } -} - -if { $verbose == 0 } { -catch {exec rm -rf $msdata} -catch {exec rm -rf $testsuite/stap-mysql.stp $testsuite/stap-mysql.log \ - $testsuite/stap-mysql-markers.log $testsuite/stap-mysql.sh $mysqlrelease.tar.gz} -catch {exec rm -rf mysql} -} diff --git a/testsuite/systemtap.base/postgres.exp b/testsuite/systemtap.base/postgres.exp deleted file mode 100644 index 2d58a54f..00000000 --- a/testsuite/systemtap.base/postgres.exp +++ /dev/null @@ -1,166 +0,0 @@ -set test "postgres" - -# Test sdt support in postgres. - -global env - -if {! [info exists env(SYSTEMTAP_TEST_SDT)]} { - unsupported "postgres (\"SYSTEMTAP_TEST_SDT\" not in env)" - return -} - -########## Create /tmp/stap-postgres.stp ########## -set postgresbuild "[pwd]/postgresql-8.3.6/bld" -set postgresdir "[pwd]/postgresql-8.3.6/install/" -set pgdata "/tmp/stap-postgres" - - -set fp [open "$pgdata.stp" "w"] -puts $fp " -probe process(\"$postgresdir/bin/postgres\").mark(\"transaction__start\") -{ - printf(\"%s %#x\\n\", \$\$name, \$arg1); -} -probe process(\"$postgresdir/bin/postgres\").mark(\"transaction__commit\") -{ - printf(\"%s %#x\\n\", \$\$name, \$arg1); -} -probe process(\"$postgresdir/bin/postgres\").mark(\"transaction__abort\") -{ - printf(\"%s %#x\\n\", \$\$name, \$arg1); -} -probe process(\"$postgresdir/bin/postgres\").mark(\"lock__startwait\") -{ - printf(\"%s %#x %#x\\n\", \$\$name, \$arg1, \$arg2); -} -probe process(\"$postgresdir/bin/postgres\").mark(\"lock__endwait\") -{ - printf(\"%s %#x %#x\\n\", \$\$name, \$arg1, \$arg2); -} -probe process(\"$postgresdir/bin/postgres\").mark(\"lwlock__endwait\") -{ - printf(\"%s %#x %#x\\n\", \$\$name, \$arg1, \$arg2); -} -probe process(\"$postgresdir/bin/postgres\").mark(\"lwlock__acquire\") -{ - printf(\"%s %#x %#x\\n\", \$\$name, \$arg1, \$arg2); -} -probe process(\"$postgresdir/bin/postgres\").mark(\"lwlock__condacquire__fail\") -{ - printf(\"%s %#x %#x\\n\", \$\$name, - \$arg1, \$arg2); -} -probe process(\"$postgresdir/bin/postgres\").mark(\"lwlock__condacquire\") -{ - printf(\"%s %#x %#x\\n\", \$\$name, \$arg1, \$arg2); -} -probe process(\"$postgresdir/bin/postgres\").mark(\"lwlock__release\") -{ - printf(\"%s %#x\\n\", \$\$name, \$arg1); -} -" -close $fp - -########## Begin /tmp/stap-postgres.sh ########## -set fp [open "$pgdata.sh" "w"] -puts $fp " -function run_tests \{ -/bin/rm -rf $pgdata -$postgresdir/bin/initdb $pgdata - -which stap -$env(SYSTEMTAP_PATH)/stap -m \$(date +stapsdt_%j%k%M%N | sed 's/ //') -c \"$postgresdir/bin/postgres -D $pgdata\" $pgdata.stp >$pgdata-markers.log 2>&1 & -STAPPID=\$! - -# wait until postgres is running -for i in \$(seq 0 10) ; do - if $postgresdir/bin/pg_ctl status -D $pgdata - then break; - fi - sleep 5 -done - -(cd $postgresbuild/src/test/regress/ - make installcheck > $pgdata.log 2>&1) - -ACQUIRE=\$(grep 'lwlock__acquire 0x\[0-9\]* 0x\[0-9\]*' $pgdata-markers.log | wc -l) -RELEASE=\$(grep 'lwlock__release 0x\[0-9\]*' $pgdata-markers.log | wc -l) -START=\$(grep 'transaction__start 0x\[0-9\]*' $pgdata-markers.log | wc -l) -COMMIT=\$(grep 'transaction__commit 0x\[0-9\]*' $pgdata-markers.log | wc -l) -OKAY=\$(grep 'test .*ok' $pgdata.log | wc -l) - -echo lwlock__acquire=\$ACQUIRE lwlock__release=\$RELEASE transaction__start=\$START transaction__commit=\$COMMIT test-ok=\$OKAY -: 44873 75325 591 489 0 - -if \[ \$ACQUIRE -gt 40000 -a \$RELEASE -gt 70000 -a \$START -gt 500 -a \$COMMIT -gt 400 \] ; then - echo PASS: postgres tests \$1 -else - echo FAIL: postgres tests \$1 -fi - -if \[ \$OKAY -gt 100 \] ; then - echo PASS: postgres markers \$1 -else - echo FAIL: postgres markers \$1 -fi - -/usr/local/pgsql/bin/pg_ctl stop -D $pgdata -kill \$STAPPID -\} - -if \[ ! -r postgresql-8.3.6.tar.bz2 \] ; then -wget http://wwwmaster.postgresql.org/redir/198/h/source/v8.3.6/postgresql-8.3.6.tar.bz2 -fi - -if \[ ! -d $postgresbuild/src/backend \] ; then -tar -x -f postgresql-8.3.6.tar.bz2 -fi - -cd postgresql-8.3.6/ -mkdir bld;cd bld -../configure --enable-dtrace --prefix=$postgresdir -# sed -i -e 's/ifeq (\$(PORTNAME), solaris)/ifeq (\$(enable_dtrace), yes)/' src/backend/Makefile -sed -i -e 's/^CFLAGS = -O2.*\$/& -g -DEXPERIMENTAL_UTRACE_SDT/' src/Makefile.global -make -make install -run_tests utrace - -sed -i -e 's/UTRACE/KPROBE/' src/Makefile.global -(cd src/backend/utils/ - make clean) -make -make install -run_tests kprobe - -sed -i -e 's/-DEXPERIMENTAL_KPROBE_SDT//' src/Makefile.global -(cd src/backend/utils/ - make clean) -make -make install -run_tests uprobe -" -########## End /tmp/stap-postgres.sh ########## -close $fp - -########## /tmp/stap-postgres.sh does most of the work ########## -verbose -log Running postgres testsuite -spawn sh $pgdata.sh 2>&1 -expect { - -timeout 1000 - -re {FAIL: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s; - fail "$s"; exp_continue } - -re {PASS: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s; - pass "$s"; exp_continue } - -re {UNSUPPORTED: [a-zA-Z_/: ]+} { regexp " .*$" $expect_out(0,string) s; - verbose -log "$s" - unsupported "$s"; exp_continue } - timeout { fail "$test (timeout)" } - eof { } -} - -if { $verbose == 0 } { -catch {exec rm -rf $pgdata} -catch {exec rm -rf $pgdata.stp $pgdata.log \ - $pgdata-markers.log $pgdata.sh postgresql-8.3.6.tar.bz2} -catch {exec rm -rf postgresql-8.3.6} -} diff --git a/testsuite/systemtap.base/tcl.exp b/testsuite/systemtap.base/tcl.exp deleted file mode 100644 index 8056f5e5..00000000 --- a/testsuite/systemtap.base/tcl.exp +++ /dev/null @@ -1,165 +0,0 @@ -set test "tcl" - -# Test sdt support in tcl. - -global env - -if {! [info exists env(SYSTEMTAP_TEST_SDT)]} { - unsupported "tcl (\"SYSTEMTAP_TEST_SDT\" not in env)" - return -} - -########## Create /tmp/stap-tcl.stp ########## -set tclreleasemajor "8.6" -set tclrelease "8.6b1" -set tcldir "[pwd]/tcl/install/" -set testsuite "[pwd]" - -set fp [open "$testsuite/stap-tcl.stp" "w"] -puts $fp " -probe process(@1).mark(\"proc__entry\") -{ - printf (\"%s %#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3) -} -probe process(@1).mark(\"proc__return\") -{ - printf (\"%s %#x,%#x\\n\",\$\$name, \$arg1,\$arg2) -} -probe process(@1).mark(\"proc__result\") -{ - printf (\"%s %#x,%#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3,\$arg4) -} -probe process(@1).mark(\"proc__args\") -{ - printf (\"%s %#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3,\$arg4,\$arg5,\$arg6,\$arg7,\$arg8,\$arg9,\$arg10) -} -probe process(@1).mark(\"proc__info\") -{ - printf (\"%s %#x,%#x,%#x,%#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3,\$arg4,\$arg5,\$arg6) -} -probe process(@1).mark(\"cmd__entry\") -{ - printf (\"%s %#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3) -} -probe process(@1).mark(\"cmd__return\") -{ - printf (\"%s %#x,%#x\\n\",\$\$name, \$arg1,\$arg2) -} -probe process(@1).mark(\"cmd__result\") -{ - printf (\"%s %#x,%#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3,\$arg4) -} -probe process(@1).mark(\"cmd__args\") -{ - printf (\"%s %#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3,\$arg4,\$arg5,\$arg6,\$arg7,\$arg8,\$arg9,\$arg10) -} -probe process(@1).mark(\"cmd__info\") -{ - printf (\"%s %#x,%#x,%#x,%#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3,\$arg4,\$arg5,\$arg6) -} -probe process(@1).mark(\"inst__start\") -{ - printf (\"%s %#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3) -} -probe process(@1).mark(\"inst__done\") -{ - printf (\"%s %#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3) -} -probe process(@1).mark(\"obj__create\") -{ - printf (\"%s %#x\\n\",\$\$name, \$arg1) -} -probe process(@1).mark(\"obj__free\") -{ - printf (\"%s %#x\\n\",\$\$name, \$arg1) -} -probe process(@1).mark(\"tcl__probe\") -{ - printf (\"%s %#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x\\n\",\$\$name, \$arg1,\$arg2,\$arg3,\$arg4,\$arg5,\$arg6,\$arg7,\$arg8,\$arg9,\$arg10) -} -" -close $fp - -########## Begin /tmp/stap-tcl.sh ########## -set fp [open "$testsuite/stap-tcl.sh" "w"] -puts $fp " -##### begin run_tests ##### -function run_tests \{ -(cd $tcldir/.. -MOD=stapsdt_\$(date +%j%k%M%N | sed 's/ //') -$env(SYSTEMTAP_PATH)/stap -m \$MOD -c install/bin/tclsh$tclreleasemajor $testsuite/stap-tcl.stp $testsuite/tcl/install/lib//libtcl$tclreleasemajor.so << END >$testsuite/stap-tcl-markers.log 2>&1 -source src/tests/all.tcl -quit -END -) - -PROC_ENTRY=\$(grep 'proc__entry' $testsuite/stap-tcl-markers.log | wc -l) -PROC_RETURN=\$(grep 'proc__return' $testsuite/stap-tcl-markers.log | wc -l) -PROC_RESULT=\$(grep 'proc__result' $testsuite/stap-tcl-markers.log | wc -l) -PROC_ARGS=\$(grep 'proc__args' $testsuite/stap-tcl-markers.log | wc -l) -PROC_INFO=\$(grep 'proc__info' $testsuite/stap-tcl-markers.log | wc -l) -CMD_ENTRY=\$(grep 'cmd__entry' $testsuite/stap-tcl-markers.log | wc -l) -CMD_RETURN=\$(grep 'cmd__return' $testsuite/stap-tcl-markers.log | wc -l) -CMD_RESULT=\$(grep 'cmd__result' $testsuite/stap-tcl-markers.log | wc -l) -CMD_ARGS=\$(grep 'cmd__args' $testsuite/stap-tcl-markers.log | wc -l) -CMD_INFO=\$(grep 'cmd__info' $testsuite/stap-tcl-markers.log | wc -l) -INST_START=\$(grep 'inst__start' $testsuite/stap-tcl-markers.log | wc -l) -INST_DONE=\$(grep 'inst__done' $testsuite/stap-tcl-markers.log | wc -l) -OBJ_CREATE=\$(grep 'obj__create' $testsuite/stap-tcl-markers.log | wc -l) -OBJ_FREE=\$(grep 'obj__free' $testsuite/stap-tcl-markers.log | wc -l) - -echo PROC_ENTRY=\$PROC_ENTRY PROC_RETURN=\$PROC_RETURN PROC_RESULT=\$PROC_RESULT PROC_ARGS=\$PROC_ARGS PROC_INFO=\$PROC_INFO CMD_ENTRY=\$CMD_ENTRY CMD_RETURN=\$CMD_RETURN CMD_RESULT=\$CMD_RESULT CMD_ARGS=\$CMD_ARGS CMD_INFO=\$CMD_INFO INST_START=\$INST_START INST_DONE=\$INST_DONE OBJ_CREATE=\$OBJ_CREATE OBJ_FREE=\$OBJ_FREE - -if \[ \$PROC_ENTRY -gt 9000 -a \$PROC_RETURN -gt 9000 -a \$PROC_RESULT -gt 9000 -a \$PROC_ARGS -gt 9000 -a \$PROC_INFO -gt 9000 -a \$CMD_ENTRY -gt 37000 -a \$CMD_RETURN -gt 37000 -a \$CMD_RESULT -gt 37000 -a \$CMD_ARGS -gt 3700 -a \$CMD_INFO -gt 37000 -a \$INST_START -gt 542000 -a \$INST_DONE -gt 542000 -a \$OBJ_CREATE -gt 723000 -a \$OBJ_FREE -gt 704000 \] ; then - echo PASS: tcl markers \$1 -else - echo FAIL: tcl markers \$1 -fi - -\} -##### end run_tests ##### - -if \[ ! -r tcl$tclrelease-src.tar.gz \] ; then -wget http://sourceforge.net/projects/tcl/files/Tcl/$tclrelease/tcl$tclrelease-src.tar.gz/download -fi - -if \[ ! -d tcl/src \] ; then -tar -x -z -f tcl$tclrelease-src.tar.gz -mkdir tcl -mv tcl$tclrelease tcl/src -fi - -if \[ ! -d tcl/install/bin \] ; then -cd tcl/src/unix -./configure --prefix=$tcldir --enable-dtrace CFLAGS='-I$env(SYSTEMTAP_INCLUDES) -g' - -make -j2 -make install -fi - -run_tests uprobe -" -########## End /tmp/stap-tcl.sh ########## -close $fp - -########## /tmp/stap-tcl.sh does most of the work ########## -verbose -log Running tcl testsuite -spawn sh stap-tcl.sh 2>&1 -expect { - -timeout 1000 - -re {FAIL: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s; - fail "$s"; exp_continue } - -re {PASS: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s; - pass "$s"; exp_continue } - -re {UNSUPPORTED: [a-zA-Z_/: ]+} { regexp " .*$" $expect_out(0,string) s; - verbose -log "$s" - unsupported "$s"; exp_continue } - timeout { fail "$test (timeout)" } - eof { } -} - -if { $verbose == 0 } { -catch {exec rm -rf $testsuite/stap-tcl.stp tcl$tclrelease-src.tar.gz \ - $testsuite/stap-tcl-markers.log $testsuite/stap-tcl.sh } -catch {exec rm -rf tcl} -} diff --git a/testsuite/systemtap.base/xulrunner.exp b/testsuite/systemtap.base/xulrunner.exp deleted file mode 100644 index be2db0c7..00000000 --- a/testsuite/systemtap.base/xulrunner.exp +++ /dev/null @@ -1,133 +0,0 @@ -set test "xulrunner" - -# Test sdt support in xulrunner. - -global env - -if {! [info exists env(SYSTEMTAP_TEST_SDT)]} { - unsupported "xulrunner (\"SYSTEMTAP_TEST_SDT\" not in env)" - return -} - -########## Create /tmp/stap-xul.stp ########## -set xulrelease "1.9.1.3" -set xuldir "[pwd]/xul/" -set testsuite "[pwd]" - -set fp [open "$testsuite/stap-xul.stp" "w"] -puts $fp " -global funcinfo -global objinfo - -probe process(@1).mark(\"function__info\") -{ - file = user_string (\$arg1) - func = user_string (\$arg3) - funcinfo\[file,func\] <<< 1 -} - -probe process(@1).mark(\"object__create\") -{ - file = user_string (\$arg1) - class = user_string (\$arg2) - objinfo\[file,class\] <<< 1 -} - -probe end -{ - foreach (\[i,j\] in funcinfo+) - { - printf (\"probes: %-20s %-25s %d\\n\", substr(i,strlen(i)-20,strlen(i)), j, @count(funcinfo\[i,j\])) - } - foreach (\[i,j\] in objinfo+) - { - printf (\"probes: %-20s %-25s %d\\n\", substr(i,strlen(i)-20,strlen(i)), j, @count(funcinfo\[i,j\])) - } -} -" -close $fp - -########## Begin /tmp/stap-xul.sh ########## -set fp [open "$testsuite/stap-xul.sh" "w"] -puts $fp " -##### begin run_tests ##### -function run_tests \{ -cd $testsuite/xul/bld/js/src -pwd -for i in call trace-test math-trace-tests ; do -$env(SYSTEMTAP_PATH)/stap -c \"./js $xuldir/src/js/src/\$i.js\" $testsuite/stap-xul.stp ./js -done | tee $testsuite/stap-xul-markers.log -PROBES=\$(grep 'probes: ' $testsuite/stap-xul-markers.log | wc -l) -TESTS=\$(grep '-FAIL' $testsuite/stap-xul-markers.log) -echo PROBES=\$PROBES TESTS=\$TESTS - -if \[ \$PROBES -gt 400 \] ; then - echo PASS: xulrunner javascript markers \$1 -else - echo FAIL: xulrunner javascript markers \$1 -fi - -if \[ -z \$TESTS \] ; then - echo PASS: xulrunner javascript testsuite \$1 -else - echo FAIL: xulrunner javascript testsuite \$1 -fi - -\} -##### end run_tests ##### - -if \[ ! -r xulrunner-$xulrelease-source.tar \] ; then -wget ftp://ftp.mozilla.org/pub/mozilla.org/xul/releases/$xulrelease/source/xulrunner-$xulrelease-source.tar.bz2 -bunzip2 xulrunner-$xulrelease-source.tar.bz2 -fi - -if \[ ! -d xul/src \] ; then -tar -x -f xulrunner-$xulrelease-source.tar -mkdir xul -xulrelease=$xulrelease -mv mozilla-\${xulrelease%.\[0-9\]} xul/src -fi - -if \[ ! -f xul/bld/js/src/js \] ; then -mkdir xul/bld -cd xul/bld -if rpm -q java-1.6.0-openjdk ; then : -else - echo FAIL: Need java-1.6.0-openjdk-devel - exit -fi -JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64 \ -CXXFLAGS='-g -I$env(SYSTEMTAP_INCLUDES)' \ -CFLAGS='-g -I$env(SYSTEMTAP_INCLUDES)' \ -PATH=$env(SYSTEMTAP_PATH)/:\$PATH \ -../src/configure --prefix=$xuldir --enable-dtrace --enable-application=xulrunner -J=\$(getconf _NPROCESSORS_CONF) -make -j \$J -fi - -run_tests uprobe -" -########## End /tmp/stap-xul.sh ########## -close $fp - -########## /tmp/stap-xul.sh does most of the work ########## -verbose -log Running xul testsuite -spawn sh stap-xul.sh 2>&1 -expect { - -timeout 10000 - -re {FAIL: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s; - fail "$s"; exp_continue } - -re {PASS: [a-z_ ]+} { regexp " .*$" $expect_out(0,string) s; - pass "$s"; exp_continue } - -re {UNSUPPORTED: [a-zA-Z_/: ]+} { regexp " .*$" $expect_out(0,string) s; - verbose -log "$s" - unsupported "$s"; exp_continue } - timeout { fail "$test (timeout)" } - eof { } -} - -if { $verbose == 0 } { -catch {exec rm -rf $testsuite/stap-xul.stp xulrunner-$xulrelease-source.tar \ - $testsuite/stap-xul-markers.log $testsuite/stap-xul.sh } -catch {exec rm -rf xul} -} -- cgit From 9f61c5d4c3487aa8225d5271c798f5ebaafc398a Mon Sep 17 00:00:00 2001 From: David Smith Date: Mon, 2 Nov 2009 12:51:12 -0600 Subject: PR 6691 fixed by adding support for sys_accept4. * tapset/aux_syscalls.stp(_sock_type_str): Rewrote in embedded-C and added socket flags support. (_sock_flags_str): New function. * tapset/syscalls.stp: syscall.accept prefers to use sys_accept4 when it exists. Added support for sys_accept4's 'flag' parameter. * testsuite/systemtap.syscall/net1.c (main): Updated regular expression to handle the new 'flags' argument. --- testsuite/systemtap.syscall/net1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testsuite') diff --git a/testsuite/systemtap.syscall/net1.c b/testsuite/systemtap.syscall/net1.c index f8079ffd..b7f1d6cb 100644 --- a/testsuite/systemtap.syscall/net1.c +++ b/testsuite/systemtap.syscall/net1.c @@ -32,7 +32,7 @@ int main() //staptest// listen (NNNN, 7) = 0 cfd = accept(listenfd, (struct sockaddr *)NULL, NULL); - //staptest// accept (NNNN, 0x[0]+, 0x[0]+) = -NNNN (EAGAIN) + //staptest// accept (NNNN, 0x[0]+, 0x[0]+, 0) = -NNNN (EAGAIN) close(cfd); close(listenfd); -- cgit