getcontext01: check getcontext function in libc
PATCH 1/1 getcontext01: check getcontext function in libc
getcontext function is implemented depends on libc version and arch. Some libc version for specific arch does not implement getcontext yet. In that case, getcontext just sets errno to ENOSYS and returns -1. For example, getcontext is not implemented before libc-2.17 in ARM. Current test goes to TFAIL when lower version of libc is used in ARM.
This patch sets the test as TCONF if libc does not implement getcontext. If ENOSYS is not set, it goes to TFAIL as it was.
--- .../kernel/syscalls/getcontext/getcontext01.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
(quoted diff) +0 -0
b/testcases/kernel/syscalls/getcontext/getcontext01.c index 03b2df9..860d208 100644
testcases/kernel/syscalls/getcontext/getcontext01.c +3 -2
@@ -73,8 +73,12 @@ int main(int ac, char **av)TEST (getcontext (&ptr)); -if (TEST_RETURN ==-1 ) -tst_resm (TFAIL |TTERRNO ,"getcontext failed" ); +if (TEST_RETURN ==-1 ) { +if (errno ==ENOSYS ) + tst_resm(TCONF, "getcontext is not
implemented in the current libc");
+ else
+ tst_resm(TFAIL | TTERRNO, "getcontext
failed");
+ }
else if (TEST_RETURN >= 0)
tst_resm(TPASS, "getcontext passed");
Signature · 14 lines
1.7.9.5 ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi!
Quoted 34 lines
getcontext function is implemented depends on libc version and arch. Some libc version for specific arch does not implement getcontext yet. In that case, getcontext just sets errno to ENOSYS and returns -1. For example, getcontext is not implemented before libc-2.17 in ARM. Current test goes to TFAIL when lower version of libc is used in ARM.
This patch sets the test as TCONF if libc does not implement getcontext. If ENOSYS is not set, it goes to TFAIL as it was.
Signed-off-by Honggyu Kim <[email protected]>--- .../kernel/syscalls/getcontext/getcontext01.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)testcases/kernel/syscalls/getcontext/getcontext01.c +6
-2@@ -73,8 +73,12 @@ int main(int ac, char **av)TEST (getcontext (&ptr)); -if (TEST_RETURN ==-1 ) -tst_resm (TFAIL |TTERRNO ,"getcontext failed" ); +if (TEST_RETURN ==-1 ) { +if (errno ==ENOSYS ) + tst_resm(TCONF, "getcontext is not implemented in the current libc"); + else + tst_resm(TFAIL |TTERRNO ,"getcontext failed"); + }else if (TEST_RETURN >=0 )
Quoted 2 lines
tst_resm(TPASS, "getcontext passed");
Can you please fix the over 80 chars lines?
In this case I would moved the inner part of the loop (from TEST(getcontext(&ptr)) to a function called test() and shortened the TCONF message to simple "getcontext is not implemented".
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list