fix sched_getaffinity01 failure
PATCH 1/1 fix sched_getaffinity01 failure
In reply to a message not in the archiveHi all, when I'm using LTP, sometimes the
test syscalls/sched_getaffinity01 fails by
giving the following output:
sched_getaffinity01 0 TINFO : system has 4 processor(s). sched_getaffinity01 0 TINFO : cpusetsize is 128 sched_getaffinity01 0 TINFO : mask.__bits[0] = 15 sched_getaffinity01 1 TPASS : sched_getaffinity() succeed ,this process 29494 is running processor: 0 sched_getaffinity01 2 TPASS : sched_getaffinity() succeed ,this process 29494 is running processor: 1 sched_getaffinity01 3 TPASS : sched_getaffinity() succeed ,this process 29494 is running processor: 2 sched_getaffinity01 4 TPASS : sched_getaffinity() succeed ,this process 29494 is running processor: 3 sched_getaffinity01 5 TPASS : sched_getaffinity(0, len, (cpu_set_t *)-1): TEST_ERRNO=EFAULT(14): Bad address sched_getaffinity01 6 TPASS : sched_getaffinity(0, 0, mask): TEST_ERRNO=EINVAL(22): Invalid argument sched_getaffinity01 7 TFAIL : sched_getaffinity(getpid() + 1, len, mask): TEST_ERRNO=???(0): Success
Seems that using ``getpid() + 1'' is not
always correct, so I use another non-existed
pid to replace ``getpid() + ''.
--- .../sched_getaffinity/sched_getaffinity01.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c +2 -3
@@ -41,7 +41,7 @@#include <stdio.h> #include <sys/types.h> #include <unistd.h> -#define _GNU_SOURCE +#define _GNU_SOURCE#define __USE_GNU#include <sched.h> #include <string.h>
@@ -201,11 +201,10 @@ realloc:#endif QUICK_TEST (sched_getaffinity (0 , len, (cpu_set_t *)-1 ));QUICK_TEST (sched_getaffinity (0 ,0 , mask)); -QUICK_TEST (sched_getaffinity (getpid () +1 , len, mask)); +QUICK_TEST (sched_getaffinity (65535 , len, mask));CPU_FREE (mask); } }cleanup ();tst_exit (); } -
Signature · 19 lines
1.7.3.1 -- Quality Assurance Associate (Kernel) in Red Hat Software (Beijing) Co., R&D Branch TEL: +86-10-62608150 WEB: http://www.redhat.com/ ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 40 lines · Caspar Zhang
Hi all, when I'm using LTP, sometimes the
test syscalls/sched_getaffinity01 fails by
giving the following output:
sched_getaffinity010 TINFO : system has 4 processor(s).sched_getaffinity010 TINFO : cpusetsize is 128sched_getaffinity010 TINFO : mask.__bits[0] = 15sched_getaffinity011 TPASS : sched_getaffinity() succeed ,this process 29494 is running processor: 0sched_getaffinity012 TPASS : sched_getaffinity() succeed ,this process 29494 is running processor: 1sched_getaffinity013 TPASS : sched_getaffinity() succeed ,this process 29494 is running processor: 2sched_getaffinity014 TPASS : sched_getaffinity() succeed ,this process 29494 is running processor: 3sched_getaffinity015 TPASS : sched_getaffinity(0, len, (cpu_set_t*)-1): TEST_ERRNO=EFAULT(14): Bad addresssched_getaffinity016 TPASS : sched_getaffinity(0, 0, mask): TEST_ERRNO=EINVAL(22): Invalid argumentsched_getaffinity017 TFAIL : sched_getaffinity(getpid() + 1, len, mask): TEST_ERRNO=???(0): SuccessSeems that using ``getpid() + 1'' is not
always correct, so I use another non-existed
pid to replace ``getpid() + ''.Signed-off-by Caspar Zhang <[email protected]>---
.../sched_getaffinity/sched_getaffinity01.c | 5 ++---1 files changed, 2 insertions(+), 3 deletions(-)testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c +1
-1@@ -41,7 +41,7 @@ #include<stdio.h> #include<sys/types.h> #include<unistd.h> -#define _GNU_SOURCE +#define _GNU_SOURCE #define __USE_GNU #include<sched.h> #include<string.h>@@ -201,11 +201,10 @@ realloc: #endif
testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c realloc: · line 210
Quoted 10 lines
testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c +1
-1QUICK_TEST(sched_getaffinity(0, len, (cpu_set_t *)-1)); QUICK_TEST(sched_getaffinity(0, 0, mask)); - QUICK_TEST(sched_getaffinity(getpid() + 1, len, mask)); + QUICK_TEST(sched_getaffinity(65535, len, mask)); CPU_FREE(mask); } } cleanup(); tst_exit(); }
Please try the modified version on git HEAD.
Cheers,
-Garrett
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list