Fix some proc provider tests:

* Avoid hard-coding program paths, except when it's necessary in order to
  override the use of a shell builtin.
* Translate struct proc through psinfo_t so that we can access process
  arguments via the pr_psargs field of psinfo_t.
* Replace uses of pstop and prun with kill(1).

MFC after:	1 week
This commit is contained in:
Mark Johnston 2015-01-31 22:38:43 +00:00
parent 5d3fc1ff66
commit 9ed9976cd9
3 changed files with 14 additions and 12 deletions

View File

@ -37,7 +37,8 @@ script()
$dtrace -s /dev/stdin <<EOF $dtrace -s /dev/stdin <<EOF
proc:::signal-discard proc:::signal-discard
/args[1]->p_pid == $child && /args[1]->p_pid == $child &&
args[1]->pr_psargs == "$longsleep" && args[2] == SIGHUP/ xlate<psinfo_t *>(args[1])->pr_psargs == "$longsleep" &&
args[2] == SIGHUP/
{ {
exit(0); exit(0);
} }
@ -48,7 +49,7 @@ killer()
{ {
while true; do while true; do
sleep 1 sleep 1
/usr/bin/kill -HUP $child kill -HUP $child
done done
} }
@ -58,7 +59,7 @@ if [ $# != 1 ]; then
fi fi
dtrace=$1 dtrace=$1
longsleep="/usr/bin/sleep 10000" longsleep="/bin/sleep 10000"
/usr/bin/nohup $longsleep & /usr/bin/nohup $longsleep &
child=$! child=$!

View File

@ -48,7 +48,7 @@ sleeper()
{ {
while true; do while true; do
$longsleep & $longsleep &
/usr/bin/sleep 1 sleep 1
kill -9 $! kill -9 $!
done done
} }
@ -59,7 +59,7 @@ if [ $# != 1 ]; then
fi fi
dtrace=$1 dtrace=$1
longsleep="/usr/bin/sleep 10000" longsleep="/bin/sleep 10000"
sleeper & sleeper &
child=$! child=$!
@ -67,9 +67,9 @@ child=$!
script script
status=$? status=$?
pstop $child kill -STOP $child
pkill -P $child pkill -P $child
kill $child kill $child
prun $child kill -CONT $child
exit $status exit $status

View File

@ -37,7 +37,8 @@ script()
$dtrace -s /dev/stdin <<EOF $dtrace -s /dev/stdin <<EOF
proc:::signal-send proc:::signal-send
/execname == "kill" && curpsinfo->pr_ppid == $child && /execname == "kill" && curpsinfo->pr_ppid == $child &&
args[1]->pr_psargs == "$longsleep" && args[2] == SIGUSR1/ xlate<psinfo_t *>(args[1])->pr_psargs == "$longsleep" &&
args[2] == SIGUSR1/
{ {
/* /*
* This is guaranteed to not race with signal-handle. * This is guaranteed to not race with signal-handle.
@ -58,7 +59,7 @@ sleeper()
while true; do while true; do
$longsleep & $longsleep &
sleep 1 sleep 1
/usr/bin/kill -USR1 $! kill -USR1 $!
done done
} }
@ -68,7 +69,7 @@ if [ $# != 1 ]; then
fi fi
dtrace=$1 dtrace=$1
longsleep="/usr/bin/sleep 10000" longsleep="/bin/sleep 10000"
sleeper & sleeper &
child=$! child=$!
@ -76,9 +77,9 @@ child=$!
script script
status=$? status=$?
pstop $child kill -STOP $child
pkill -P $child pkill -P $child
kill $child kill $child
prun $child kill -CONT $child
exit $status exit $status