[PATCH 4/5] tests: add sync.test

Fei Jie feij.fnst at cn.fujitsu.com
Tue Apr 26 08:03:10 UTC 2016


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

diff --git a/tests/.gitignore b/tests/.gitignore
index 6f056a2..4d1d8cb 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -206,6 +206,7 @@ statfs64
 swap
 symlink
 symlinkat
+sync
 sync_file_range
 sync_file_range2
 sysinfo
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e3ffc1c..9f1f8b4 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -258,6 +258,7 @@ check_PROGRAMS = \
 	swap \
 	symlink \
 	symlinkat \
+	sync \
 	sync_file_range \
 	sync_file_range2 \
 	sysinfo \
@@ -513,6 +514,7 @@ DECODER_TESTS = \
 	swap.test \
 	symlink.test \
 	symlinkat.test \
+	sync.test \
 	sync_file_range.test \
 	sync_file_range2.test \
 	sysinfo.test \
diff --git a/tests/sync.c b/tests/sync.c
new file mode 100644
index 0000000..132a6f2
--- /dev/null
+++ b/tests/sync.c
@@ -0,0 +1,22 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_sync
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	printf("sync() = %ld\n", syscall(__NR_sync));
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_sync")
+
+#endif
diff --git a/tests/sync.test b/tests/sync.test
new file mode 100755
index 0000000..f6bf6c8
--- /dev/null
+++ b/tests/sync.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check sync syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a7
-- 
1.8.3.1







More information about the Strace-devel mailing list