hi,

On linux, I found the scheduling policies are defined as follow:

in /usr/include/bits/sched.h

/* Scheduling algorithms.  */
#define SCHED_OTHER             0
#define SCHED_FIFO              1
#define SCHED_RR                2
#ifdef __USE_GNU
# define SCHED_BATCH            3
# define SCHED_IDLE             5

# define SCHED_RESET_ON_FORK    0x40000000
#endif

So besides SCHED_OTHER, SCHED_FIFO and SCHED_RR, there are another 
two policies, SCHED_BATCH and SCHED_IDLE. And 3 is a valid value 
for the scheduling policy, which causes the test returns UNSOLVED 
on linux system.
 
Here is the patch, please comment!
Thanks.:)


Signed-off-by: Tang Chen <[email protected]>
---
 .../interfaces/sched_setscheduler/17-5.c           |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git 
a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-5.c
 
b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-5.c
index b4f90b3..652db27 100644
--- 
a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-5.c
+++ 
b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-5.c
@@ -17,6 +17,11 @@
  *   2. Call sched_setscheduler with invalid args.
  *   3. Check that the policy and priority have not changed.
  */
+
+#ifdef __linux__
+#define _GNU_SOURCE
+#endif
+
 #include <sched.h>
 #include <stdio.h>
 #include <errno.h>
@@ -31,6 +36,10 @@ int main() {
        invalid_policy = 0;
        /* Linux does not treat minus value as invalid for policy */
        while (invalid_policy == SCHED_OTHER ||
+#ifdef _GNU_SOURCE
+               invalid_policy == SCHED_BATCH ||
+               invalid_policy == SCHED_IDLE ||
+#endif
                invalid_policy == SCHED_FIFO ||
                invalid_policy == SCHED_RR)
        invalid_policy++;
@@ -78,4 +87,4 @@ int main() {
                printf("The policy has changed\n");
        }
        return PTS_FAIL;
-}
\ No newline at end of file
+}
-- 
1.7.1

-- 
Best Regards,
Tang chen


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to