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:
parent
5d3fc1ff66
commit
9ed9976cd9
@ -37,7 +37,8 @@ script()
|
||||
$dtrace -s /dev/stdin <<EOF
|
||||
proc:::signal-discard
|
||||
/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);
|
||||
}
|
||||
@ -48,7 +49,7 @@ killer()
|
||||
{
|
||||
while true; do
|
||||
sleep 1
|
||||
/usr/bin/kill -HUP $child
|
||||
kill -HUP $child
|
||||
done
|
||||
}
|
||||
|
||||
@ -58,7 +59,7 @@ if [ $# != 1 ]; then
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
longsleep="/usr/bin/sleep 10000"
|
||||
longsleep="/bin/sleep 10000"
|
||||
|
||||
/usr/bin/nohup $longsleep &
|
||||
child=$!
|
||||
|
@ -48,7 +48,7 @@ sleeper()
|
||||
{
|
||||
while true; do
|
||||
$longsleep &
|
||||
/usr/bin/sleep 1
|
||||
sleep 1
|
||||
kill -9 $!
|
||||
done
|
||||
}
|
||||
@ -59,7 +59,7 @@ if [ $# != 1 ]; then
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
longsleep="/usr/bin/sleep 10000"
|
||||
longsleep="/bin/sleep 10000"
|
||||
|
||||
sleeper &
|
||||
child=$!
|
||||
@ -67,9 +67,9 @@ child=$!
|
||||
script
|
||||
status=$?
|
||||
|
||||
pstop $child
|
||||
kill -STOP $child
|
||||
pkill -P $child
|
||||
kill $child
|
||||
prun $child
|
||||
kill -CONT $child
|
||||
|
||||
exit $status
|
||||
|
@ -37,7 +37,8 @@ script()
|
||||
$dtrace -s /dev/stdin <<EOF
|
||||
proc:::signal-send
|
||||
/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.
|
||||
@ -58,7 +59,7 @@ sleeper()
|
||||
while true; do
|
||||
$longsleep &
|
||||
sleep 1
|
||||
/usr/bin/kill -USR1 $!
|
||||
kill -USR1 $!
|
||||
done
|
||||
}
|
||||
|
||||
@ -68,7 +69,7 @@ if [ $# != 1 ]; then
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
longsleep="/usr/bin/sleep 10000"
|
||||
longsleep="/bin/sleep 10000"
|
||||
|
||||
sleeper &
|
||||
child=$!
|
||||
@ -76,9 +77,9 @@ child=$!
|
||||
script
|
||||
status=$?
|
||||
|
||||
pstop $child
|
||||
kill -STOP $child
|
||||
pkill -P $child
|
||||
kill $child
|
||||
prun $child
|
||||
kill -CONT $child
|
||||
|
||||
exit $status
|
||||
|
Loading…
Reference in New Issue
Block a user