[PATCH 3/3] tests: add pause.test

Fei Jie feij.fnst at cn.fujitsu.com
Wed Apr 27 08:54:21 UTC 2016


* tests/pause.c: New file.
* tests/pause.test: New test.
* tests/.gitignore: Add pause.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add pause.test.
---
 tests/.gitignore  |  1 +
 tests/Makefile.am |  2 ++
 tests/pause.c     | 32 ++++++++++++++++++++++++++++++++
 tests/pause.test  |  6 ++++++
 4 files changed, 41 insertions(+)
 create mode 100644 tests/pause.c
 create mode 100755 tests/pause.test

diff --git a/tests/.gitignore b/tests/.gitignore
index d5f16c5..9f0c7dd 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -130,6 +130,7 @@ old_mmap
 oldselect
 open
 openat
+pause
 pc
 personality
 pipe
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c98c660..4b43baa 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -182,6 +182,7 @@ check_PROGRAMS = \
 	oldselect \
 	open \
 	openat \
+	pause \
 	pc \
 	personality \
 	pipe \
@@ -448,6 +449,7 @@ DECODER_TESTS = \
 	oldselect.test \
 	open.test \
 	openat.test \
+	pause.test \
 	personality.test \
 	pipe.test \
 	poll.test \
diff --git a/tests/pause.c b/tests/pause.c
new file mode 100644
index 0000000..286b6ca
--- /dev/null
+++ b/tests/pause.c
@@ -0,0 +1,32 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_pause
+
+# include <signal.h>
+# include <stdio.h>
+# include <unistd.h>
+
+void
+sig_handler(int sig)
+{
+}
+
+int
+main(void)
+{
+    signal(SIGALRM, sig_handler);
+    alarm(3);
+    pause();
+    printf("pause() = ? ERESTARTNOHAND"
+	       " (To be restarted if no handler)\n");
+
+    puts("+++ exited with 0 +++");
+    return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_pause")
+
+#endif
diff --git a/tests/pause.test b/tests/pause.test
new file mode 100755
index 0000000..8487426
--- /dev/null
+++ b/tests/pause.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check pause syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -esignal=none -a8
-- 
1.8.3.1







More information about the Strace-devel mailing list