[PATCH 2/4] tests: add sched_get_priority_mxx.test

Fei Jie feij.fnst at cn.fujitsu.com
Tue Mar 8 06:23:20 UTC 2016


* tests/sched_get_priority_mxx.c: New file.
* tests/sched_get_priority_mxx.test: New test.
* tests/.gitignore: Add sched_get_priority_mxx.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add sched_get_priority_mxx.test.
---
 tests/.gitignore                  |  1 +
 tests/Makefile.am                 |  2 ++
 tests/sched_get_priority_mxx.c    | 35 +++++++++++++++++++++++++++++++++++
 tests/sched_get_priority_mxx.test | 11 +++++++++++
 4 files changed, 49 insertions(+)
 create mode 100644 tests/sched_get_priority_mxx.c
 create mode 100755 tests/sched_get_priority_mxx.test

diff --git a/tests/.gitignore b/tests/.gitignore
index c842781..3093adb 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -90,6 +90,7 @@ rt_sigqueueinfo
 rt_sigsuspend
 rt_sigtimedwait
 rt_tgsigqueueinfo
+sched_get_priority_mxx
 sched_xetaffinity
 sched_xetattr
 scm_rights
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 32d7e0a..9cbdfc8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -138,6 +138,7 @@ check_PROGRAMS = \
 	rt_sigsuspend \
 	rt_sigtimedwait \
 	rt_tgsigqueueinfo \
+	sched_get_priority_mxx \
 	sched_xetaffinity \
 	sched_xetattr \
 	scm_rights \
@@ -299,6 +300,7 @@ TESTS = \
 	rt_sigsuspend.test \
 	rt_sigtimedwait.test \
 	rt_tgsigqueueinfo.test \
+	sched_get_priority_mxx.test \
 	sched_xetaffinity.test \
 	sched_xetattr.test \
 	scm_rights-fd.test \
diff --git a/tests/sched_get_priority_mxx.c b/tests/sched_get_priority_mxx.c
new file mode 100644
index 0000000..0dd2689
--- /dev/null
+++ b/tests/sched_get_priority_mxx.c
@@ -0,0 +1,35 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#if defined(__NR_sched_get_priority_min) \
+ && defined(__NR_sched_get_priority_max)
+
+# include <sched.h>
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	int rc = syscall(__NR_sched_get_priority_min, SCHED_FIFO);
+	if (rc == -1)
+		perror_msg_and_fail("sched_get_priority_min");
+
+	printf("sched_get_priority_min(SCHED_FIFO) = %d\n", rc);
+
+	rc = syscall(__NR_sched_get_priority_max, SCHED_RR);
+	if (rc == -1)
+		perror_msg_and_fail("sched_get_priority_max");
+
+	printf("sched_get_priority_max(SCHED_RR) = %d\n", rc);
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_sched_get_priority_min"
+					" && defined __NR_sched_get_priority_max");
+
+#endif
diff --git a/tests/sched_get_priority_mxx.test b/tests/sched_get_priority_mxx.test
new file mode 100755
index 0000000..15d2475
--- /dev/null
+++ b/tests/sched_get_priority_mxx.test
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# Check sched_get_priority_min and sched_get_priority_max syscalls decoding.
+
+. "${srcdir=.}/init.sh"
+
+run_prog > /dev/null
+OUT="$LOG.out"
+run_strace -esched_get_priority_min,sched_get_priority_max -a33 $args > "$OUT"
+match_diff "$LOG" "$OUT"
+rm -f "$OUT"
-- 
1.8.3.1







More information about the Strace-devel mailing list