From 6781111857017f0587d41001ba50a0db0d6d4a5e Mon Sep 17 00:00:00 2001 From: Fei Jie Date: Thu, 5 May 2016 15:19:51 +0800 Subject: [PATCH] tests: add strace-S.test * tests/strace-S.test: New test. * tests/Makefile.am (MISC_TESTS): Add it. --- tests/Makefile.am | 1 + tests/strace-S.test | 52 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100755 tests/strace-S.test diff --git a/tests/Makefile.am b/tests/Makefile.am index 74012afb..c17caa0d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 \ diff --git a/tests/strace-S.test b/tests/strace-S.test new file mode 100755 index 00000000..97a5f7b9 --- /dev/null +++ b/tests/strace-S.test @@ -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"