[PATCH 3/9] tests: Additional decoder tests in sched_xetscheduler

Eugene Syromyatnikov evgsyr at gmail.com
Mon Sep 5 01:31:35 UTC 2016


Some additional syscall parser tests:
 * Incorrect (negative) PID in sched_getscheduler, sched_setscheduler
 * Incorrect address of sched_param structure.
 * Incorrect policy value.

* tests/sched_xetscheduler.c: additional tests.
---
 tests/sched_xetscheduler.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tests/sched_xetscheduler.c b/tests/sched_xetscheduler.c
index ffb3307..7faee8c 100644
--- a/tests/sched_xetscheduler.c
+++ b/tests/sched_xetscheduler.c
@@ -46,7 +46,26 @@ main(void)
 	printf("sched_getscheduler(0) = %ld (%s)\n",
 	       rc, scheduler);
 
+	rc = syscall(__NR_sched_getscheduler, -1);
+	printf("sched_getscheduler(-1) = %s\n", sprintrc(rc));
+
 	param->sched_priority = -1;
+
+	rc = syscall(__NR_sched_setscheduler, 0, SCHED_FIFO, NULL);
+	printf("sched_setscheduler(0, SCHED_FIFO, NULL) = %s\n", sprintrc(rc));
+
+	rc = syscall(__NR_sched_setscheduler, 0, SCHED_FIFO, param + 1);
+	printf("sched_setscheduler(0, SCHED_FIFO, %p) = %s\n", param + 1,
+	       sprintrc(rc));
+
+	rc = syscall(__NR_sched_setscheduler, 0, 0xfaceda7a, param);
+	printf("sched_setscheduler(0, %#x /* SCHED_??? */, [%d]) = %s\n",
+	       0xfaceda7a, param->sched_priority, sprintrc(rc));
+
+	rc = syscall(__NR_sched_setscheduler, -1, SCHED_FIFO, param);
+	printf("sched_setscheduler(-1, SCHED_FIFO, [%d]) = %s\n",
+	       param->sched_priority, sprintrc(rc));
+
 	rc = syscall(__NR_sched_setscheduler, 0, SCHED_FIFO, param);
 	printf("sched_setscheduler(0, SCHED_FIFO, [%d]) = %s\n",
 	       param->sched_priority, sprintrc(rc));
-- 
1.7.10.4





More information about the Strace-devel mailing list