# ... 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
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 {} {
# 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
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;
}
# 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)"
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
}
}
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}
if {![installtest_p]} { untested "MAXACTIVE"; return }
proc sleep_one_sec {} {
- after 1000;
+ wait_n_secs 1;
return 0;
}
}
proc sleep_one_sec {} {
- after 1000;
+ wait_n_secs 1;
return 0;
}
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;
# See bug #2525 for more details.
proc sleep_one_sec {} {
- after 1000;
+ wait_n_secs 1;
return 0;
}
# A simple load that give the timers a chance to run
proc sleep_ten_secs {} {
- after 10000;
+ wait_n_secs 10;
return 0;
}
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}
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]}
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"
# ^^^^^ 10 procs spinning on sqrt
} else {
# sleep for a bit
- after 10000
+ wait_n_secs 10
}
return 0
}
# ^^^^^ 10 procs spinning on sqrt
} else {
# sleep for a bit
- after 10000
+ wait_n_secs 10
}
return 0
}