summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfche <fche>2008-01-25 04:47:11 +0000
committerfche <fche>2008-01-25 04:47:11 +0000
commit674427d3a018d0f89c9669db8dcf952aab8b4423 (patch)
tree29e3f9c4405e1fd1f81b8c87ac2e485855541a66
parent7ae8037e595d8da298c83cdc059db6ac5b68d8dc (diff)
downloadsystemtap-steved-674427d3a018d0f89c9669db8dcf952aab8b4423.tar.gz
systemtap-steved-674427d3a018d0f89c9669db8dcf952aab8b4423.tar.xz
systemtap-steved-674427d3a018d0f89c9669db8dcf952aab8b4423.zip
staplog crash(8) module tests
2008-01-24 Frank Ch. Eigler <fche@elastic.org> * Makefile.am: Make another $(MKDIR) call visible. * Makefile.in: Regenerated. 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.
-rw-r--r--ChangeLog5
-rw-r--r--Makefile.am2
-rw-r--r--Makefile.in3
-rw-r--r--testsuite/ChangeLog9
-rw-r--r--testsuite/Makefile.am3
-rw-r--r--testsuite/Makefile.in6
-rw-r--r--testsuite/lib/systemtap.exp3
-rw-r--r--testsuite/systemtap.samples/crash.exp45
-rwxr-xr-xtestsuite/systemtap.samples/crash.sh8
-rw-r--r--testsuite/systemtap.samples/testlog.stp6
10 files changed, 85 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 09b8f05f..810a4d1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-01-24 Frank Ch. Eigler <fche@elastic.org>
+
+ * Makefile.am: Make another $(MKDIR) call visible.
+ * Makefile.in: Regenerated.
+
2008-01-24 David Smith <dsmith@redhat.com>
PR 5661 (reverted).
diff --git a/Makefile.am b/Makefile.am
index df86dc80..291adfd9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -91,7 +91,7 @@ $(STAPLOG): staplog.c
$(CC) -Wall -shared -rdynamic $(LDFLAGS) $(CFLAGS) -fPIC -o $@ $<
all-local: $(STAPLOG)
install-exec-local: $(STAPLOG)
- -$(MKDIR_P) $(DESTDIR)$(pkglibdir)
+ $(MKDIR_P) $(DESTDIR)$(pkglibdir)
$(INSTALL) $(STAPLOG) $(DESTDIR)$(pkglibdir)
else
endif
diff --git a/Makefile.in b/Makefile.in
index 27577e66..d92d7a94 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -181,6 +181,7 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ELFUTILS_REQUIRED_VERSION = @ELFUTILS_REQUIRED_VERSION@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
@@ -1476,7 +1477,7 @@ install-exec-hook:
@BUILD_CRASHMOD_TRUE@ $(CC) -Wall -shared -rdynamic $(LDFLAGS) $(CFLAGS) -fPIC -o $@ $<
@BUILD_CRASHMOD_TRUE@all-local: $(STAPLOG)
@BUILD_CRASHMOD_TRUE@install-exec-local: $(STAPLOG)
-@BUILD_CRASHMOD_TRUE@ -$(MKDIR_P) $(DESTDIR)$(pkglibdir)
+@BUILD_CRASHMOD_TRUE@ $(MKDIR_P) $(DESTDIR)$(pkglibdir)
@BUILD_CRASHMOD_TRUE@ $(INSTALL) $(STAPLOG) $(DESTDIR)$(pkglibdir)
# Copy some of the testsuite sample scripts to the distdir
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index 6d3bf44d..f30b9891 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+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.
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/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/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");
+}