tests: add strace-S.test

* tests/strace-S.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.
This commit is contained in:
Fei Jie 2016-05-05 15:19:51 +08:00 committed by Dmitry V. Levin
parent 58ab8b49e0
commit 6781111857
2 changed files with 53 additions and 0 deletions

View File

@ -605,6 +605,7 @@ MISC_TESTS = \
qual_syscall.test \
redirect.test \
restart_syscall.test \
strace-S.test \
strace-T.test \
strace-V.test \
strace-f.test \

52
tests/strace-S.test Executable file
View File

@ -0,0 +1,52 @@
#!/bin/sh
# Check -S option.
. "${srcdir=.}/init.sh"
run_prog_skip_if_failed date > /dev/null
run_strace -c -S calls $args
OUT="$LOG.out"
EXP="$LOG.exp"
rm -f "$OUT" "$EXP"
check_prog awk
check_prog sort
awk '{print $4}' "$LOG" > "$OUT"
exec 4<&0 0<"$OUT"
while
read item
do
if [ "$item" = "---------" ]
then
break
fi
done
while
read item
do
if [ "$item" = "---------" ]
then
break
fi
echo "$item" >> "$EXP"
done
exec 0<&4
if [ -s $EXP ]
then
sort -c -g -r "$EXP"
if [ "$?" = "1" ]
then
fail_ "not sorted"
fi
else
fail_ "no file"
fi
rm -f "$OUT" "$EXP"