summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStan Cox <scox@redhat.com>2009-08-18 10:50:05 -0400
committerStan Cox <scox@redhat.com>2009-08-18 10:50:05 -0400
commite4c3091f27b43a631dfbdb1ada1b121f8e581cd2 (patch)
tree8e64c15dd42d274e7217dc8b0c91d823282e1d19
parent21c38ccc872a9b8c340e15545dc37ff8474f4109 (diff)
downloadsystemtap-steved-e4c3091f27b43a631dfbdb1ada1b121f8e581cd2.tar.gz
systemtap-steved-e4c3091f27b43a631dfbdb1ada1b121f8e581cd2.tar.xz
systemtap-steved-e4c3091f27b43a631dfbdb1ada1b121f8e581cd2.zip
* dtrace.in: Honor the dirname for the output file.
* testsuite/systemtap.base/dtrace.exp: New test.
-rwxr-xr-xdtrace.in3
-rw-r--r--testsuite/systemtap.base/dtrace.exp118
2 files changed, 119 insertions, 2 deletions
diff --git a/dtrace.in b/dtrace.in
index 168bfb18..990d62fe 100755
--- a/dtrace.in
+++ b/dtrace.in
@@ -175,10 +175,9 @@ if (build_header):
providers.generate(s_filename, filename + h_ext, add_typedefs)
elif (build_source):
(basename,ext) = os.path.splitext(s_filename)
- basename = os.path.basename(basename)
(d,fn) = mkstemp(suffix=".c",prefix=basename)
f = open(fn,mode='w')
f.write("static __dtrace () {}\n")
f.close()
- call(["gcc", "-fPIC", "-I.", "-I@prefix@/include", "-g", "-c", fn, "-o", os.path.basename(filename) + ".o"], shell=False)
+ call(["gcc", "-fPIC", "-I.", "-I@prefix@/include", "-g", "-c", fn, "-o", filename + ".o"], shell=False)
os.remove(fn)
diff --git a/testsuite/systemtap.base/dtrace.exp b/testsuite/systemtap.base/dtrace.exp
new file mode 100644
index 00000000..11a4b608
--- /dev/null
+++ b/testsuite/systemtap.base/dtrace.exp
@@ -0,0 +1,118 @@
+set test "dtrace"
+
+# Test the dtrace compatible python script
+
+if {[installtest_p]} {
+ set dtrace $env(SYSTEMTAP_PATH)/dtrace
+} else {
+ set dtrace $srcdir/../dtrace
+}
+
+exec mkdir /tmp/dtrace
+
+set dpath "/tmp/dtrace/test.d"
+set fp [open $dpath "w"]
+puts $fp "
+provider tstsyscall
+{
+ probe test(short arg1, int arg2, int arg3, int arg4, struct astruct arg5)
+}
+"
+close $fp
+
+# -----------------------------------------------------------------
+# test command line option and file handling
+
+verbose -log "$dtrace -G -s $dpath -o XXX.o"
+exec $dtrace -G -s $dpath -o XXX.o
+if {[file exists XXX.o]} then {
+ pass "dtrace -G -o XXX.o"
+} else {
+ fail "dtrace -G -o XXX.o"
+}
+exec rm -f XXX.o
+
+verbose -log "$dtrace -G -s $dpath -o XXX"
+exec $dtrace -G -s $dpath -o XXX
+if {[file exists XXX.o]} then {
+ pass "dtrace -G -o XXX"
+} else {
+ fail "dtrace -G -o XXX"
+}
+exec rm -f XXX.o
+
+verbose -log "$dtrace -h -s $dpath -o XXX.h"
+exec $dtrace -h -s $dpath -o XXX.h
+if {[file exists XXX.h]} then {
+ pass "dtrace -h -o XXX.h"
+} else {
+ fail "dtrace -h -o XXX.h"
+}
+exec rm -f XXX.h
+
+verbose -log "$dtrace -h -s $dpath -o XXX"
+exec $dtrace -h -s $dpath -o XXX
+if {[file exists XXX]} then {
+ pass "dtrace -h -o XXX"
+} else {
+ fail "dtrace -h -o XXX"
+}
+exec rm -f XXX.h
+
+verbose -log "$dtrace -G -s $dpath -o /tmp/XXX.o"
+exec $dtrace -G -s $dpath -o /tmp/XXX.o
+if {[file exists /tmp/XXX.o]} then {
+ pass "dtrace -G -o /tmp/XXX.o"
+} else {
+ fail "dtrace -G -o /tmp/XXX.o"
+}
+exec rm -f /tmp/XXX.o
+
+verbose -log "$dtrace -G -s $dpath -o /tmp/XXX"
+exec $dtrace -G -s $dpath -o /tmp/XXX
+if {[file exists /tmp/XXX.o]} then {
+ pass "dtrace -G -o /tmp/XXX.o"
+} else {
+ fail "dtrace -G -o /tmp/XXX.o"
+}
+exec rm -f /tmp/XXX.o
+
+verbose -log "$dtrace -h -s $dpath -o /tmp/XXX.h"
+exec $dtrace -h -s $dpath -o /tmp/XXX.h
+if {[file exists /tmp/XXX.h]} then {
+ pass "dtrace -h -o /tmp/XXX.h"
+} else {
+ fail "dtrace -h -o /tmp/XXX.h"
+}
+exec rm -f /tmp/XXX.h
+
+verbose -log "$dtrace -h -s $dpath -o /tmp/XXX"
+exec $dtrace -h -s $dpath -o /tmp/XXX
+if {[file exists /tmp/XXX]} then {
+ pass "dtrace -h -o /tmp/XXX"
+} else {
+ fail "dtrace -h -o /tmp/XXX"
+}
+exec rm -f /tmp/XXX
+
+verbose -log "$dtrace -G -s $dpath"
+exec $dtrace -G -s $dpath
+if {[file exists /tmp/dtrace/test.o]} then {
+ pass "dtrace -G"
+} else {
+ fail "dtrace -G"
+}
+exec rm -f /tmp/dtrace/test.o
+
+verbose -log "$dtrace -h -s $dpath"
+exec $dtrace -h -s $dpath
+if {[file exists /tmp/dtrace/test.h]} then {
+ pass "dtrace -h"
+} else {
+ fail "dtrace -h"
+}
+exec rm -f /tmp/dtrace/test.o
+
+exec /bin/rm -r /tmp/dtrace
+# -----------------------------------------------------------------
+