]> sourceware.org Git - systemtap.git/commitdiff
Add stress package use to testsuite.
authorStan Cox <scox@redhat.com>
Thu, 16 Jan 2014 19:42:07 +0000 (14:42 -0500)
committerStan Cox <scox@redhat.com>
Thu, 16 Jan 2014 19:42:07 +0000 (14:42 -0500)
* systemtap.spec (testsuite): Add stress requirement
* stap_run.exp (wait_n_secs): New.  Use stress if available.
* itrace.exp, maxactive.exp, probefunc.exp, proc_, exec.exp,
  timeofday.exp, timers.exp, utrace_p5.exp, probe_by_pid.exp,
  check.exp, functions.exp, current.exp: Use it.

14 files changed:
systemtap.spec
testsuite/lib/stap_run.exp
testsuite/lib/systemtap.exp
testsuite/systemtap.base/itrace.exp
testsuite/systemtap.base/maxactive.exp
testsuite/systemtap.base/probefunc.exp
testsuite/systemtap.base/proc_exec.exp
testsuite/systemtap.base/timeofday.exp
testsuite/systemtap.base/timers.exp
testsuite/systemtap.base/utrace_p5.exp
testsuite/systemtap.clone/probe_by_pid.exp
testsuite/systemtap.examples/check.exp
testsuite/systemtap.stress/all_kernel_functions.exp
testsuite/systemtap.stress/current.exp

index f29a201a484cf0cf217354d23c5e5b84cc8082cd..ad7d4bb49b12057f6113fc63f8f2adc4b1861018 100644 (file)
@@ -304,6 +304,9 @@ Requires: /usr/lib/libc.so
 # ... and /usr/lib/libgcc_s.so.*
 # ... and /usr/lib/libstdc++.so.*
 %endif
+%if 0%{?fedora} >= 18
+Requires: stress
+%endif
 
 %description testsuite
 This package includes the dejagnu-based systemtap stress self-testing
index b7c0a8ab494ee6732b95dccd85c17749a1564804..a6d1e811608b0b7edbd1535092aaa298ce6dec91 100644 (file)
@@ -113,12 +113,31 @@ proc no_load {} {
     return 0
 }
 
+proc wait_n_secs {N_SECS} {
+    if {[file executable /usr/bin/stress]} {
+       # stress package is installed
+       set STRESS /usr/bin/stress 
+    }
+    if {$N_SECS > 0 && [info exists STRESS]} {
+       set ncpu [exec getconf _NPROCESSORS_CONF]
+       if {$ncpu > 2} {
+           set ncpu [expr $ncpu - 2]
+       }
+       puts "$STRESS -c $ncpu -t $N_SECS"
+       exec $STRESS -c $ncpu -t $N_SECS
+    } else {
+       # fallback method
+       # Tcl_Sleep does not always handle the system clock jumping, 
+       # so instead of the built-in "after", use /usr/bin/sleep.
+       catch { exec sleep $N_SECS }
+    }
+    return 0;
+}
+
+
 # Load function to use when you need to wait 5 seconds.
 proc wait_5_secs {} {
-    # Tcl_Sleep appears to have a cow if the systme clock jumps, so
-    # instead of the built-in "after", use /usr/bin/sleep.
-    catch { exec sleep 5 }
-    return 0;
+    return [wait_n_secs 5];
 }
 
 proc print_system_info {} {
index e1f3c15f5cf5be999983765d1d2b6db20ff5e932..348aa0955b715d0433b118a5e56e22d63fe43f9d 100644 (file)
@@ -166,7 +166,7 @@ proc setup_systemtap_environment {} {
 
     # Use a local systemtap directory and cache.  Add user name so
     # make check and sudo make check don't clobber each other.
-    set env(SYSTEMTAP_DIR) [exec pwd]/.systemtap-[exec whoami]
+    set env(SYSTEMTAP_DIR) [pwd]/.systemtap-[exec whoami]
     exec mkdir -p $env(SYSTEMTAP_DIR)
 
     # Start with fresh server certificates
@@ -181,7 +181,7 @@ proc setup_systemtap_environment {} {
     close $chan
 
     # Erase the old server log file.
-    set logfile "[exec pwd]/server.log"
+    set logfile "[pwd]/server.log"
     if {[file exists $logfile]} then {
        exec rm -f $logfile;
     }
@@ -300,8 +300,8 @@ proc start_server { options } {
     # install test, otherwise there is some setup to do.
     # Make sure the server management scripts and tools are on the $PATH.
     if {! [installtest_p]} then {
-       set env(PATH) "$srcdir/..:[exec pwd]/..:$env(PATH)"
-        set installed_stap "[exec pwd]/../stap"
+       set env(PATH) "$srcdir/..:[pwd]/..:$env(PATH)"
+        set installed_stap "[pwd]/../stap"
        set env(SYSTEMTAP_SERVER_SCRIPTS) "$srcdir/.."
     } else {
        set env(PATH) "$env(PKGLIBDIR):$env(PATH)"
@@ -338,10 +338,10 @@ proc shutdown_server {} {
        set server_pid 0
     }
 
-    foreach module [glob -nocomplain [exec pwd]/stap_*.ko] {
+    foreach module [glob -nocomplain [pwd]/stap_*.ko] {
        exec /bin/rm -f $module
     }
-    foreach sig [glob -nocomplain [exec pwd]/stap_*.ko.sgn] {
+    foreach sig [glob -nocomplain [pwd]/stap_*.ko.sgn] {
        exec /bin/rm -f $sig
     }
 }
index 4a77baf1a60210c9ed66fc43fa5c4abe5255b6b2..7359deed2d0f52d80dde69ef5fd71b65497af255 100644 (file)
@@ -153,7 +153,7 @@ proc run_ls_1_sec {} {
 
     spawn $exepath
     set exe_id $spawn_id
-    after 1000;
+    wait_n_secs 1;
     exec kill -INT -- -[exp_pid -i $exe_id]
     catch {close -i $exe_id}
     catch {wait -i $exe_id}
index c31c63865d11b83dff7d8a90af7042d87bc9627d..1994661ddccbdab363764f09e08c783447eef218 100644 (file)
@@ -6,7 +6,7 @@
 if {![installtest_p]} { untested "MAXACTIVE"; return }
 
 proc sleep_one_sec {} {
-    after 1000;
+    wait_n_secs 1;
     return 0;
 }
 
index a8907e0ecc8b01e8fb9717759174a44844dae479..633698860d1345ff660485622a30bcf6f843e640 100644 (file)
@@ -9,7 +9,7 @@ proc grep {fd re } {
 }
 
 proc sleep_one_sec {} {
-    after 1000;
+    wait_n_secs 1;
     return 0;
 }
 
index e7c0d7785c057c094bc7883c00e86f4e15e1956a..43c524362627c2a2eea171bff2f2a64302b01b85 100644 (file)
@@ -11,7 +11,7 @@ proc run_test_exe {} {
 
     spawn $test_exepath $exepath
     set exe_id $spawn_id
-    after 5000
+    wait_n_secs 5
     catch {close -i $exe_id}
     catch {wait -i $exe_id}
     return 0;
index 811ba3801a0c1688875db8bd83d96a87e31d35c1..88a832528ba9aab4926d0dcffca288ba7a1a9382 100644 (file)
@@ -5,7 +5,7 @@
 # See bug #2525 for more details.
 
 proc sleep_one_sec {} {
-    after 1000;
+    wait_n_secs 1;
     return 0;
 }
 
index 9cca0625925b06cc7f0ae712a4307a753541b195..70ed3413a72cb018a9b010a9ffe8ddf52e170850 100644 (file)
@@ -4,7 +4,7 @@ set test "timers"
 
 # A simple load that give the timers a chance to run
 proc sleep_ten_secs {} {
-    after 10000;
+    wait_n_secs 10;
     return 0;
 }
 
index d61399c7e76934f7c6a59a3ca735aad3adf588ff..14bc97ecc6975c3db540ed0d7cc4860be9609aa5 100644 (file)
@@ -118,7 +118,7 @@ proc run_cat_5_sec {} {
 
     spawn $exepath
     set exe_id $spawn_id
-    after 5000;
+    wait_n_secs 5;
     exec kill -INT -- -[exp_pid -i $exe_id]
     catch {close -i $exe_id}
     catch {wait -i $exe_id}
index 6df144ea847bb59811c528b0bf9981184c2ed5d6..9d633ae8c8e1d47b4320beb29366ae519ed86d25 100644 (file)
@@ -17,7 +17,7 @@ proc run_test_prog {} {
     set id $spawn_id
 
     # Wait 3 seconds
-    after 3000
+    wait_n_secs 3
 
     # Kill the test program
     catch {exec kill -INT -- -[exp_pid -i $id]}
index 6e4d923d4d37b628a2999fc52b334b8785e5ef4f..70f4ac83ee5ab02e10dfad20e5e58dde952c1eeb 100644 (file)
@@ -33,6 +33,10 @@ proc extract_tag { META_DATA TAG } {
 proc run_command { test action command } {
     #FIXME tcl says that single quotes not dealt with
     if { $command != "" } then {
+       # use stress instead of sleep if time >= 1
+       if {[file executable /usr/bin/stress]} {
+           regsub {sleep ([1-9])} $command {stress -c 1 -t \1} command
+       }
        verbose -log "attempting command $command"
        set res [catch {exec sh -c $command 2>@1} value]
        verbose -log "OUT $value"
index 6dded7264c215f732069feff8bde4ef8598a9ea1..d7c2fbc7b58f38e9f7a519f5d1bc352ba4494f2e 100644 (file)
@@ -9,7 +9,7 @@ proc genload {} {
         #             ^^^^^ 10 procs spinning on sqrt
     } else {
         # sleep for a bit
-        after 10000
+        wait_n_secs 10
     }
     return 0
 }
index c96b9807c2acf79a9bf305a9a8baf9f64cfdae34..313b67aec4a5f5a8082e2dafc1ecd48ccd96aaac 100644 (file)
@@ -14,7 +14,7 @@ proc current_load {} {
         #             ^^^^^ 10 procs spinning on sqrt
     } else {
         # sleep for a bit
-        after 10000
+        wait_n_secs 10
     }
     return 0
 }
This page took 0.049417 seconds and 5 git commands to generate.