1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
#!/usr/bin/env sh
# REQUIRES: preload, shell, dynamic-shell
# RUN: %{shell} -c "%{intercept} --verbose --output %t.json -- %{shell} %s --sleep %{sleep} --true %{true} & %{sleep} 1; kill -15 %1; wait;"
# RUN: assert_intercepted %t.json count -eq 3
# RUN: assert_intercepted %t.json contains -program %{true}
# RUN: assert_intercepted %t.json contains -program %{sleep} -arguments %{sleep} 5
for i in "$@"
do
case $i in
--sleep)
SLEEP=$2
shift
shift
;;
--true)
TRUE=$2
shift
shift
;;
*)
# unknown option
;;
esac
done
echo "SLEEP = $SLEEP"
echo "TRUE = $TRUE"
if [ -z "$SLEEP" ]; then
echo "SLEEP is not defined";
exit 1;
fi
if [ -z "$TRUE" ]; then
echo "TRUE is not defined";
exit 1;
fi
forward() {
kill -15 $child;
}
trap forward SIGTERM
# do the test
$TRUE
$SLEEP 5&
child=$!
wait $child
|