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

diff --git a/tests/.gitignore b/tests/.gitignore
index c05ffb6..82f08ee 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -94,6 +94,7 @@ rt_tgsigqueueinfo
 sched_get_priority_mxx
 sched_xetaffinity
 sched_xetattr
+sched_xetparam
 scm_rights
 seccomp
 select
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8f7aa4e..27acefd 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -142,6 +142,7 @@ check_PROGRAMS = \
        sched_get_priority_mxx \
        sched_xetaffinity \
        sched_xetattr \
+       sched_xetparam \
        scm_rights \
        seccomp \
        select \
@@ -305,6 +306,7 @@ TESTS = \
        sched_get_priority_mxx.test \
        sched_xetaffinity.test \
        sched_xetattr.test \
+       sched_xetparam.test \
        scm_rights-fd.test \
        seccomp.test \
        select.test \
diff --git a/tests/sched_xetparam.c b/tests/sched_xetparam.c
new file mode 100644
index 0000000..d968a2c
--- /dev/null
+++ b/tests/sched_xetparam.c
@@ -0,0 +1,33 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#if defined __NR_sched_getparam && defined __NR_sched_setparam
+
+# include <errno.h>
+# include <sched.h>
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+       struct sched_param *const param = tail_alloc(sizeof(struct 
sched_param));
+       int rc = syscall(__NR_sched_getparam, 0, param);
+       printf("sched_getparam(0, [%d]) = %d\n",
+              param->sched_priority, rc);
+
+       param->sched_priority = -1;
+       rc = syscall(__NR_sched_setparam, 0, param);
+       printf("sched_setparam(0, [%d]) = %d %s (%m)\n",
+              param->sched_priority, rc,
+              errno == EPERM ? "EPERM" : "EINVAL");
+
+       puts("+++ exited with 0 +++");
+       return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_sched_getparam && __NR_sched_setparam")
+
+#endif
diff --git a/tests/sched_xetparam.test b/tests/sched_xetparam.test
new file mode 100755
index 0000000..9627598
--- /dev/null
+++ b/tests/sched_xetparam.test
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# Check sched_getparam and sched_setparam syscalls decoding.
+
+. "${srcdir=.}/init.sh"
+
+run_prog > /dev/null
+OUT="$LOG.out"
+run_strace -esched_getparam,sched_setparam -a23 $args > "$OUT"
+match_diff "$LOG" "$OUT"
+rm -f "$OUT"
-- 
1.8.3.1




------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to