[PATCH 3/3] tests: add strace-S.test

Fei Jie feij.fnst at cn.fujitsu.com
Thu May 5 07:19:51 UTC 2016


* 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 25afb99..b2fc6cc 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -599,6 +599,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 0000000..97a5f7b
--- /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"
-- 
1.8.3.1







More information about the Strace-devel mailing list