]> sourceware.org Git - systemtap.git/commitdiff
introduce [utrace_p] as dejagnu check for utrace presence in kernel
authorFrank Ch. Eigler <fche@elastic.org>
Thu, 2 Apr 2009 00:33:51 +0000 (20:33 -0400)
committerFrank Ch. Eigler <fche@elastic.org>
Thu, 2 Apr 2009 00:34:52 +0000 (20:34 -0400)
* testsuite/lib/systemtap.exp: Define here.
* testsuite/systemtap.*/*.exp: Use it here.  Eliminate duplicated
  utrace_support_present logic.

testsuite/lib/systemtap.exp
testsuite/systemtap.base/bz5274.exp
testsuite/systemtap.base/bz6850.exp
testsuite/systemtap.base/itrace.exp
testsuite/systemtap.base/labels.exp
testsuite/systemtap.base/static_uprobes.exp
testsuite/systemtap.base/uprobes.exp
testsuite/systemtap.base/uprobes_lib.exp
testsuite/systemtap.base/utrace_p4.exp
testsuite/systemtap.base/utrace_p5.exp
testsuite/systemtap.pass1-4/buildok.exp

index 554e88edd8acb29f7b0e63ae2aedf457563ae063..5311be7be856f0af2bb63d761919c07a0cd01e0f 100644 (file)
@@ -16,6 +16,16 @@ proc use_server_p {} {
 }
 
 
+proc utrace_p {} {
+    set path "/proc/kallsyms"
+    if {! [catch {exec grep -q utrace_attach $path} dummy]} {
+        return 1
+    } else {
+        return 0
+    }
+}
+
+
 proc print_systemtap_version {} {
     set version [exec /bin/uname -r]
     set location "/boot/vmlinux-$version"
index 92441e9e4b2339ace6098812ae8c939ecc8043c9..2f76a43f138953f3732118d58493d3dad7c024af 100755 (executable)
@@ -17,14 +17,7 @@ if {! [installtest_p]} {
     return
 }
 
-# Try to find utrace_attach symbol in /proc/kallsyms
-# copy from utrace_p5.exp
-set utrace_support_found 0
-set path "/proc/kallsyms"
-if {! [catch {exec grep -q utrace_attach $path} dummy]} {
-    set utrace_support_found 1
-}
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     catch {exec rm -f $test}
     untested "$test -p5"
     return
index b96ed95cca46899bd73dd457cd432fc9e0e0a219..32ecdaf5f9676be76a8baeeaa6ea394392ce39be 100644 (file)
@@ -3,14 +3,7 @@ set test bz6850
 catch {exec gcc -g -o bz6850 $srcdir/$subdir/bz6850.c} err
 if {$err == "" && [file exists bz6850]} then { pass "$test compile" } else { fail "$test compile" }
 
-# Try to find utrace_attach symbol in /proc/kallsyms
-# copy from utrace_p5.exp
-set utrace_support_found 0
-set path "/proc/kallsyms"
-if {! [catch {exec grep -q utrace_attach $path} dummy]} {
-    set utrace_support_found 1
-}
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     catch {exec rm -f $test}
     untested "$test -p4"
     untested "$test -p5"
index 504253feb5062ceb9a930f9f5fcbe16419c66d25..c7da39c86b563a6dc32e90e4e0fadf4f7ad3e4df 100644 (file)
@@ -2,7 +2,6 @@
 
 
 # Initialize variables
-set utrace_support_found 0
 set exepath "[pwd]/ls_[pid]"
 
 set itrace1_script {
@@ -92,14 +91,8 @@ proc run_ls_5_sec {} {
 }
 
 
-# Try to find utrace_attach symbol in /proc/kallsyms
-set path "/proc/kallsyms"
-if {! [catch {exec grep -q utrace_attach $path} dummy]} {
-    set utrace_support_found 1
-}
-
 set TEST_NAME "itrace1"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } elseif {![installtest_p]} {
     untested $TEST_NAME
@@ -110,7 +103,7 @@ if {$utrace_support_found == 0} {
 
 
 set TEST_NAME "itrace2"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } elseif {![installtest_p]} {
     untested $TEST_NAME
index 6db81c5473f6e397ae67c2522f3da364bbfed50e..2f79a5028c2c1b1e1579dec42df0770c330c74d0 100644 (file)
@@ -1,14 +1,6 @@
 set test "labels"
 if {![installtest_p]} {untested $test; return}
-
-# Try to find utrace_attach symbol in /proc/kallsyms
-# copy from utrace_p5.exp
-set utrace_support_found 0
-set path "/proc/kallsyms"
-if {! [catch {exec grep -q utrace_attach $path} dummy]} {
-    set utrace_support_found 1
-}
-if {$utrace_support_found == 0} { untested "$test"; return }
+if {![utrace_p]} { untested $test; return }
 
 # Compile a C program to use as the user-space probing target
 set label_srcpath "[pwd]/labels.c"
index d6b6e1e36373e3b9000f723824af7488941adf33..07ff83e9486634be19f3b36abd8f5304fc46b0c5 100644 (file)
@@ -124,15 +124,7 @@ if { $res != "" } {
 }
 
 if {![installtest_p]} {untested $test; return}
-
-# Try to find utrace_attach symbol in /proc/kallsyms
-# copy from utrace_p5.exp
-set utrace_support_found 0
-set path "/proc/kallsyms"
-if {! [catch {exec grep -q utrace_attach $path} dummy]} {
-    set utrace_support_found 1
-}
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$test"
     catch {exec rm -f $sup_srcpath}
     return
index 89250e7b6cb6cf5ddb32817abcdac99f042591c8..6344cbf0ad91c65d65324c373440bff607986ac0 100644 (file)
@@ -18,14 +18,7 @@ if [file exists $path] then { pass "$test prep" } else { fail "$test prep" }
 catch {exec gcc -g -o jennie jennie.c} err
 if {$err == "" && [file exists jennie]} then { pass "$test compile" } else { fail "$test compile" }
 
-# Try to find utrace_attach symbol in /proc/kallsyms
-# copy from utrace_p5.exp
-set utrace_support_found 0
-set path "/proc/kallsyms"
-if {! [catch {exec grep -q utrace_attach $path} dummy]} {
-    set utrace_support_found 1
-}
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$test -p4"; untested "$test -p5"
     catch {exec rm -f jennie.c jennie}
     return
index ae1b72e869bf0c65cecd7af47e8640859947272a..63ef957a85273f378e0526d47d9e65035a4ac154 100644 (file)
@@ -10,21 +10,23 @@ set testflags "additional_flags=-g additional_flags=-O"
 set testlibflags "$testflags additional_flags=-fPIC additional_flags=-shared"
 set maintestflags "$testflags additional_flags=-L$testlibdir additional_flags=-l$testlibname additional_flags=-Wl,-rpath,$testlibdir"
 
-# Only run on make installcheck
-if {! [installtest_p]} { untested "$test"; return }
-
 # Compile our test program and library.
 set res [target_compile $testsrclib $testso executable $testlibflags]
 if { $res != "" } {
     verbose "target_compile for $testso failed: $res" 2
-    fail "unable to compile $testsrclib"
+    fail "$test compile $testsrclib"
     return
+} else {
+    pass "$test compile $testsrclib"
 }
+
 set res [target_compile $testsrc $testexe executable $maintestflags]
 if { $res != "" } {
     verbose "target_compile failed: $res" 2
-    fail "unable to compile $testsrc"
+    fail "$test compile $testsrc"
     return
+} else {
+    pass "$test compile $testsrc"
 }
 
 # XXX main_func needs another/extra test. Disabled for now.
@@ -33,6 +35,9 @@ if { $res != "" } {
 # lib_func}
 set ::result_string {lib_func}
 
+# Only run on make installcheck
+if {! [installtest_p]} { untested "$test"; return }
+if {! [utrace_p]} { untested $test; return }
 stap_run2 $srcdir/$subdir/$test.stp -c $testexe
 
 #exec rm -f $testexe $testso
index 1467d9c8ba0bca5fafbabfc21e98fb6349620614..8d323a8aef4500c5f874c9c876f126778b530258 100644 (file)
@@ -7,8 +7,6 @@
 # utrace doesn't exist in the kernel, marks the tests as 'untested'.
 
 # Initialize variables
-set utrace_support_found 0
-
 set begin_script {"probe process(\"/bin/ls\").begin { print(\"ls begin\") }"}
 set end_script {"probe process(\"/bin/ls\").end { print(\"ls end\") }"}
 set syscall_script {"probe process(\"/bin/ls\").syscall { printf(\"|%d\", \$syscall) }"}
@@ -24,18 +22,12 @@ set pid_syscall_return_script {"probe process(123).syscall.return { printf(\"|%d
 set pid_thread_begin_script {"probe process(123).thread.begin { print(\"123 thread.begin\") }"}
 set pid_thread_end_script {"probe process(123).thread.end { print(\"123 thread.end\") }"}
 
-# Try to find utrace_attach symbol in /proc/kallsyms
-set path "/proc/kallsyms"
-if {! [catch {exec grep -q utrace_attach $path} dummy]} {
-    set utrace_support_found 1
-}
-
 #
 # Do some utrace compile tests.
 #
 
 set TEST_NAME "UTRACE_P4_01"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } else {
     # Try compiling a begin script using a path
@@ -43,7 +35,7 @@ if {$utrace_support_found == 0} {
 }
 
 set TEST_NAME "UTRACE_P4_01_pid"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } else {
     # Try compiling a begin script using a pid
@@ -51,7 +43,7 @@ if {$utrace_support_found == 0} {
 }
 
 set TEST_NAME "UTRACE_P4_02"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } else {
     # Try compiling a end script using a path
@@ -59,7 +51,7 @@ if {$utrace_support_found == 0} {
 }
 
 set TEST_NAME "UTRACE_P4_02_pid"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } else {
     # Try compiling a end script using a pid
@@ -67,7 +59,7 @@ if {$utrace_support_found == 0} {
 }
 
 set TEST_NAME "UTRACE_P4_03"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } else {
     # Try compiling a syscall script using a path
@@ -75,7 +67,7 @@ if {$utrace_support_found == 0} {
 }
 
 set TEST_NAME "UTRACE_P4_03_pid"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } else {
     # Try compiling a syscall script using a pid
@@ -83,7 +75,7 @@ if {$utrace_support_found == 0} {
 }
 
 set TEST_NAME "UTRACE_P4_04"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } else {
     # Try compiling a syscall return script using a path
@@ -91,7 +83,7 @@ if {$utrace_support_found == 0} {
 }
 
 set TEST_NAME "UTRACE_P4_04_pid"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } else {
     # Try compiling a syscall return script using a pid
@@ -99,7 +91,7 @@ if {$utrace_support_found == 0} {
 }
 
 set TEST_NAME "UTRACE_P4_05"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } else {
     # Try compiling an thread.begin script using a path
@@ -107,7 +99,7 @@ if {$utrace_support_found == 0} {
 }
 
 set TEST_NAME "UTRACE_P4_05_pid"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } else {
     # Try compiling an thread.begin script using a pid
@@ -115,7 +107,7 @@ if {$utrace_support_found == 0} {
 }
 
 set TEST_NAME "UTRACE_P4_06"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } else {
     # Try compiling an thread.end script using a path
@@ -123,7 +115,7 @@ if {$utrace_support_found == 0} {
 }
 
 set TEST_NAME "UTRACE_P4_06_pid"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } else {
     # Try compiling an thread.end script using a pid
@@ -131,7 +123,7 @@ if {$utrace_support_found == 0} {
 }
 
 set TEST_NAME "UTRACE_P4_07"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } else {
     # Try compiling an system-wide begin script
index 3328135004b97cc22890db53c9d42f95bf86af2d..3d432dc32b630cfba7417304086e3ae7441b65a9 100644 (file)
@@ -1,7 +1,6 @@
 # Utrace run (pass 5) tests.
 
 # Initialize variables
-set utrace_support_found 0
 set exepath "[pwd]/cat_[pid]"
 set multi_srcpath "$srcdir/systemtap.base/utrace_p5_multi.c"
 set multi_exepath "[pwd]/utrace_p5_multi_[pid]"
@@ -90,12 +89,6 @@ set bz6841_script {
 }
 set bz6841_script_output ".+ issues syscall \\d+ times\r\n"
 
-# Try to find utrace_attach symbol in /proc/kallsyms
-set path "/proc/kallsyms"
-if {! [catch {exec grep -q utrace_attach $path} dummy]} {
-    set utrace_support_found 1
-}
-
 # Set up our own copy of /bin/cat, to make testing for a particular
 # executable easy.  We can't use 'ln' here, since we might be creating
 # a cross-device link.  We can't use 'ln -s' here, since the kernel
@@ -138,7 +131,7 @@ proc run_utrace_p5_multi {} {
 }
 
 set TEST_NAME "UTRACE_P5_01"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } elseif {![installtest_p]} {
     untested "$TEST_NAME"
@@ -148,7 +141,7 @@ if {$utrace_support_found == 0} {
 }
 
 set TEST_NAME "UTRACE_P5_02"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } elseif {![installtest_p]} {
     untested "$TEST_NAME"
@@ -158,7 +151,7 @@ if {$utrace_support_found == 0} {
 }
 
 set TEST_NAME "UTRACE_P5_03"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } elseif {![installtest_p]} {
     untested "$TEST_NAME"
@@ -168,7 +161,7 @@ if {$utrace_support_found == 0} {
 }
 
 set TEST_NAME "UTRACE_P5_04"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } elseif {![installtest_p]} {
     untested "$TEST_NAME"
@@ -178,7 +171,7 @@ if {$utrace_support_found == 0} {
 }
 
 set TEST_NAME "UTRACE_P5_05"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } elseif {![installtest_p]} {
     untested "$TEST_NAME"
@@ -189,7 +182,7 @@ if {$utrace_support_found == 0} {
 }
 
 set TEST_NAME "UTRACE_P5_06"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } elseif {![installtest_p]} {
     untested "$TEST_NAME"
@@ -200,7 +193,7 @@ if {$utrace_support_found == 0} {
 }
 
 set TEST_NAME "UTRACE_P5_07"
-if {$utrace_support_found == 0} {
+if {![utrace_p]} {
     untested "$TEST_NAME : no kernel utrace support found"
 } elseif {![installtest_p]} {
     untested "$TEST_NAME"
index 08d50fb5ce81deb514b2d065f0ce2d825ce8991e..3731fc06d1453ca3b8b78d32b2128da76b3687da 100644 (file)
@@ -12,6 +12,7 @@ foreach file [lsort [glob -nocomplain $srcdir/$self/*.stp]] {
         buildok/process_test.stp {setup_kfail 1155 *-*-*}
         buildok/rpc-all-probes.stp {setup_kfail 4413 *-*-*}
         buildok/nfs-all-probes.stp {setup_kfail 4413 *-*-*}
+        buildok/per-process-syscall.stp {if {![utrace_p]} { setup_kfail 9999 *-*-*} }
     }
     if {$rc == 0} { pass $test } else { fail $test }
 }
This page took 0.044865 seconds and 5 git commands to generate.