[PATCH 5/5] tests: add sched_yield.test

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


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

diff --git a/tests/.gitignore b/tests/.gitignore
index 4d1d8cb..4eb3f49 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -162,6 +162,7 @@ sched_xetaffinity
 sched_xetattr
 sched_xetparam
 sched_xetscheduler
+sched_yield
 scm_rights
 seccomp-filter
 seccomp-filter-v
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9f1f8b4..1e11db8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -214,6 +214,7 @@ check_PROGRAMS = \
 	sched_xetattr \
 	sched_xetparam \
 	sched_xetscheduler \
+	sched_yield \
 	scm_rights \
 	seccomp-filter \
 	seccomp-filter-v \
@@ -472,6 +473,7 @@ DECODER_TESTS = \
 	sched_xetattr.test \
 	sched_xetparam.test \
 	sched_xetscheduler.test \
+	sched_yield.test \
 	scm_rights-fd.test \
 	seccomp-filter-v.test \
 	seccomp-filter.test \
diff --git a/tests/sched_yield.c b/tests/sched_yield.c
new file mode 100644
index 0000000..a804773
--- /dev/null
+++ b/tests/sched_yield.c
@@ -0,0 +1,23 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_sched_yield
+
+# include <sched.h>
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	printf("sched_yield() = %ld\n", syscall(__NR_sched_yield));
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_sched_yield")
+
+#endif
diff --git a/tests/sched_yield.test b/tests/sched_yield.test
new file mode 100755
index 0000000..f0c2c30
--- /dev/null
+++ b/tests/sched_yield.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check sched_yield syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a14
-- 
1.8.3.1







More information about the Strace-devel mailing list