diff options
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/ChangeLog | 26 | ||||
-rw-r--r-- | testsuite/Makefile.am | 3 | ||||
-rw-r--r-- | testsuite/Makefile.in | 6 | ||||
-rwxr-xr-x | testsuite/configure | 20 | ||||
-rw-r--r-- | testsuite/configure.ac | 2 | ||||
-rw-r--r-- | testsuite/lib/systemtap.exp | 3 | ||||
-rwxr-xr-x | testsuite/semko/forty.stp | 4 | ||||
-rwxr-xr-x | testsuite/semko/fortyone.stp | 3 | ||||
-rwxr-xr-x | testsuite/semko/fortytwo.stp | 10 | ||||
-rw-r--r-- | testsuite/semok/twentynine.stp | 6 | ||||
-rw-r--r-- | testsuite/systemtap.base/debugpath.exp | 18 | ||||
-rw-r--r-- | testsuite/systemtap.samples/crash.exp | 45 | ||||
-rwxr-xr-x | testsuite/systemtap.samples/crash.sh | 8 | ||||
-rw-r--r-- | testsuite/systemtap.samples/testlog.stp | 6 |
14 files changed, 143 insertions, 17 deletions
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 6dd0d8de..f30b9891 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,29 @@ +2008-01-24 Frank Ch. Eigler <fche@elastic.org> + + crash(8) tests, based on Masami Hiramatsu <mhiramat@redhat.com>: + * Makefile.am (CRASH_LIBDIR): Pass in $(RUNTEST). + * lib/systemtap.exp (as_root): Trace command string, output, and + result. + * sysetmtap.samples/crash.*, testlog.stp: New test case. + * Makefile.in: Regenerated. + +2008-01-23 Frank Ch. Eigler <fche@elastic.org> + + PR 2521. + * systemtap.base/debugpath.exp: New test. + +2008-01-18 Frank Ch. Eigler <fche@elastic.org> + + * configure.ac: Bump version to 0.6.1. + * configure: Regenerated. + +2008-01-17 Frank Ch. Eigler <fche@elastic.org> + + PR 4935. + * semko/forty.stp, fortyone.stp, fortytwo.stp: New tests. + * semok/twentynine.stp: Weaken test since condition expressions have + become more tightly constrained. + 2008-01-17 David Smith <dsmith@redhat.com> * semko/procfs11.stp: Added test for invalid use of procfs probe diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index 689ec371..6b14bd60 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -27,6 +27,7 @@ EXTRA_DIST = config lib systemtap \ SYSTEMTAP_RUNTIME=$(DESTDIR)$(pkgdatadir)/runtime SYSTEMTAP_TAPSET=$(DESTDIR)$(pkgdatadir)/tapset LD_LIBRARY_PATH=$(DESTDIR)$(libdir)/systemtap +CRASH_LIBDIR=$(DESTDIR)$(libdir)/systemtap SYSTEMTAP_PATH=$(DESTDIR)$(bindir) -RUNTEST="env SYSTEMTAP_RUNTIME=$(SYSTEMTAP_RUNTIME) SYSTEMTAP_TAPSET=$(SYSTEMTAP_TAPSET) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) PATH=$(SYSTEMTAP_PATH):$$PATH runtest" +RUNTEST="env SYSTEMTAP_RUNTIME=$(SYSTEMTAP_RUNTIME) SYSTEMTAP_TAPSET=$(SYSTEMTAP_TAPSET) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) CRASH_LIBDIR=$(CRASH_LIBDIR) PATH=$(SYSTEMTAP_PATH):$$PATH runtest" diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in index 3f2db011..8907c519 100644 --- a/testsuite/Makefile.in +++ b/testsuite/Makefile.in @@ -36,7 +36,8 @@ DIST_COMMON = $(am__configure_deps) $(srcdir)/../install-sh \ $(srcdir)/../missing $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/configure ../AUTHORS \ ../COPYING ../ChangeLog ../INSTALL ../NEWS ../README \ - ../compile ../depcomp ../install-sh ../missing ChangeLog + ../compile ../config.guess ../depcomp ../install-sh ../missing \ + ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ @@ -146,8 +147,9 @@ EXTRA_DIST = config lib systemtap \ SYSTEMTAP_RUNTIME = $(DESTDIR)$(pkgdatadir)/runtime SYSTEMTAP_TAPSET = $(DESTDIR)$(pkgdatadir)/tapset LD_LIBRARY_PATH = $(DESTDIR)$(libdir)/systemtap +CRASH_LIBDIR = $(DESTDIR)$(libdir)/systemtap SYSTEMTAP_PATH = $(DESTDIR)$(bindir) -RUNTEST = "env SYSTEMTAP_RUNTIME=$(SYSTEMTAP_RUNTIME) SYSTEMTAP_TAPSET=$(SYSTEMTAP_TAPSET) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) PATH=$(SYSTEMTAP_PATH):$$PATH runtest" +RUNTEST = "env SYSTEMTAP_RUNTIME=$(SYSTEMTAP_RUNTIME) SYSTEMTAP_TAPSET=$(SYSTEMTAP_TAPSET) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) CRASH_LIBDIR=$(CRASH_LIBDIR) PATH=$(SYSTEMTAP_PATH):$$PATH runtest" all: all-am .SUFFIXES: diff --git a/testsuite/configure b/testsuite/configure index e50dc588..2e29a3d7 100755 --- a/testsuite/configure +++ b/testsuite/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for systemtap 0.6. +# Generated by GNU Autoconf 2.61 for systemtap 0.6.1. # # Report bugs to <systemtap@sources.redhat.com>. # @@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='systemtap' PACKAGE_TARNAME='systemtap' -PACKAGE_VERSION='0.6' -PACKAGE_STRING='systemtap 0.6' +PACKAGE_VERSION='0.6.1' +PACKAGE_STRING='systemtap 0.6.1' PACKAGE_BUGREPORT='systemtap@sources.redhat.com' ac_subst_vars='SHELL @@ -1148,7 +1148,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures systemtap 0.6 to adapt to many kinds of systems. +\`configure' configures systemtap 0.6.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1214,7 +1214,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of systemtap 0.6:";; + short | recursive ) echo "Configuration of systemtap 0.6.1:";; esac cat <<\_ACEOF @@ -1285,7 +1285,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -systemtap configure 0.6 +systemtap configure 0.6.1 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1299,7 +1299,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by systemtap $as_me 0.6, which was +It was created by systemtap $as_me 0.6.1, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -1991,7 +1991,7 @@ fi # Define the identity of the package. PACKAGE='systemtap' - VERSION='0.6' + VERSION='0.6.1' cat >>confdefs.h <<_ACEOF @@ -2595,7 +2595,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by systemtap $as_me 0.6, which was +This file was extended by systemtap $as_me 0.6.1, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -2638,7 +2638,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -systemtap config.status 0.6 +systemtap config.status 0.6.1 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/testsuite/configure.ac b/testsuite/configure.ac index 18e85559..5eb9b151 100644 --- a/testsuite/configure.ac +++ b/testsuite/configure.ac @@ -1,7 +1,7 @@ dnl configure.ac --- autoconf input file for systemtap testsuite dnl Process this file with autoconf to produce a configure script. -AC_INIT([systemtap], 0.6, systemtap@sources.redhat.com, systemtap) +AC_INIT([systemtap], 0.6.1, systemtap@sources.redhat.com, systemtap) AC_PREREQ(2.59) AC_CONFIG_AUX_DIR(..) diff --git a/testsuite/lib/systemtap.exp b/testsuite/lib/systemtap.exp index f677da41..baed0e41 100644 --- a/testsuite/lib/systemtap.exp +++ b/testsuite/lib/systemtap.exp @@ -121,6 +121,9 @@ proc as_root { command } { if {$effective_pid != 0} { set command "sudo $command" } + verbose -log "as_root $command" set res [catch {eval exec $command} value] + verbose -log "OUT $value" + verbose -log "RC $res" return $res } diff --git a/testsuite/semko/forty.stp b/testsuite/semko/forty.stp new file mode 100755 index 00000000..f7721a47 --- /dev/null +++ b/testsuite/semko/forty.stp @@ -0,0 +1,4 @@ +#! stap -p2 + +global x +probe kernel.function("sys_open") if (x = 1) { } # bad side-effect diff --git a/testsuite/semko/fortyone.stp b/testsuite/semko/fortyone.stp new file mode 100755 index 00000000..e9b986df --- /dev/null +++ b/testsuite/semko/fortyone.stp @@ -0,0 +1,3 @@ +#! stap -p2 + +probe kernel.function("sys_open") if (x > 1) { } # not a global diff --git a/testsuite/semko/fortytwo.stp b/testsuite/semko/fortytwo.stp new file mode 100755 index 00000000..17dacb1c --- /dev/null +++ b/testsuite/semko/fortytwo.stp @@ -0,0 +1,10 @@ +#! stap -p2 + +probe kernel.function("sys_open") if (foo(2)) { } # must not call functions + +function foo(x) { return x } + +# NB: If this condition is relaxed, then this will have to be blocked: +# global y function foo () { return y++ } # since global y is written-to +# but this one would be fine: +# function foo () { return y++ } # since y is written-to diff --git a/testsuite/semok/twentynine.stp b/testsuite/semok/twentynine.stp index 6fe308f2..05e591ce 100644 --- a/testsuite/semok/twentynine.stp +++ b/testsuite/semok/twentynine.stp @@ -4,10 +4,10 @@ function dummy:long () {return p;} # alias with a condition probe alias0 = begin if (3) {p=1} -# alias with a kernel-variable condition -probe alias1 = kernel.function("sys_read").return if ($return) {p=0} +# alias with a kernel-variable condition -- not valid +probe alias1 = kernel.function("sys_read").return if (0) { if ($return) {p=0} } # alias with a function-call condition -probe blias0 = timer.s(1) if (dummy()) {p=10} +probe blias0 = timer.s(1) if (1 /* dummy() */) {p=10} # multiple probe point with conditions probe alias2 = alias0 if (1), alias1 if (-1) {p=2} diff --git a/testsuite/systemtap.base/debugpath.exp b/testsuite/systemtap.base/debugpath.exp new file mode 100644 index 00000000..67b9eb70 --- /dev/null +++ b/testsuite/systemtap.base/debugpath.exp @@ -0,0 +1,18 @@ + +set test "debugpath-bad" +spawn env SYSTEMTAP_DEBUGINFO_PATH=/dev/null stap -e "probe kernel.function(\"sys_open\") {}" -p4 +expect { + -re {^semantic error:.*missing.*debuginfo} { pass $test } + timeout { fail "$test (timeout1)" } + eof { fail "$test (eof)" } +} +catch { close; wait } + +set test "debugpath-good" +spawn env SYSTEMTAP_DEBUGINFO_PATH=:/usr/lib/debug stap -e "probe kernel.function(\"sys_open\") {}" -p2 +expect { + -re {kernel.function.*pc=} { pass $test } + timeout { fail "$test (timeout2)" } + eof { fail "$test (eof)" } +} +catch { close ; wait } diff --git a/testsuite/systemtap.samples/crash.exp b/testsuite/systemtap.samples/crash.exp new file mode 100644 index 00000000..629cff54 --- /dev/null +++ b/testsuite/systemtap.samples/crash.exp @@ -0,0 +1,45 @@ +# Simple test for staplog.so crash(8) extension +set test "crash" + +if {![installtest_p]} { untested $test; return } +if {![file exists $env(CRASH_LIBDIR)/staplog.so]} { untested "$test - no staplog.so"; return } + +# Load a test script +spawn stap $srcdir/$subdir/testlog.stp -m testlog +expect { + -timeout 120 + "HelloWorld\r\n" { + pass "$test - testlog.stp" + # Need to run crash(8) while this script is still running. + # Since crash(8) needs /dev/mem access, need it run as_root too. + # This [ eval ... \{ \} ] business is necessary because as_root + # evals the given list/variables in its own scope. + eval as_root \{ $srcdir/$subdir/crash.sh $env(CRASH_LIBDIR) \} + } + timeout { fail "$test - testlog.stp timeout" } + timeout { fail "$test - testlog.stp eof" } +} +catch { send "\003"; close ; wait } + +# The crash(8) script creates testlog/global or testlog/cpu<n> +as_root { chmod -R a+rX testlog } + +set ok 0 +foreach f [glob -nocomplain testlog/*] { + pass "$test - crash(8) generated $f" + set fp [open $f] + set chars [read $fp] + close $fp + if [string match "HelloWorld*" $chars] { + incr ok + pass "$test - crash(8) data" + } else { + fail "$test - crash(8) data $chars" + } +} +if {$ok == 0} { + fail "$test - crash(8) data" +} + +as_root { rm -rf testlog testlog.ko } + diff --git a/testsuite/systemtap.samples/crash.sh b/testsuite/systemtap.samples/crash.sh new file mode 100755 index 00000000..06aa414e --- /dev/null +++ b/testsuite/systemtap.samples/crash.sh @@ -0,0 +1,8 @@ +#! /bin/sh + +crash --readnow << END +mod -s testlog testlog.ko +extend $1/staplog.so +staplog testlog +exit +END diff --git a/testsuite/systemtap.samples/testlog.stp b/testsuite/systemtap.samples/testlog.stp new file mode 100644 index 00000000..5b702aa9 --- /dev/null +++ b/testsuite/systemtap.samples/testlog.stp @@ -0,0 +1,6 @@ +probe begin +{ + printf("Hello"); + printf("World"); + printf("\n"); +} |