* [LTP] [PATCH v3] getcontext01: check getcontext function in libc
@ 2013-10-23 13:54 Honggyu Kim
2013-10-23 14:04 ` Jan Stancek
0 siblings, 1 reply; 2+ messages in thread
From: Honggyu Kim @ 2013-10-23 13:54 UTC (permalink / raw)
To: ltp-list
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 and -1 is returned, it goes to TFAIL as it was.
Change-Id: I93cab9805e5bc9cd05f9f473b466e0dc2bc4fa8f
Signed-off-by: Honggyu Kim <hong.gyu.kim@lge.com>
---
.../kernel/syscalls/getcontext/getcontext01.c | 24
+++++++++++++-------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/testcases/kernel/syscalls/getcontext/getcontext01.c
b/testcases/kernel/syscalls/getcontext/getcontext01.c
index 03b2df9..7919fb5 100644
--- a/testcases/kernel/syscalls/getcontext/getcontext01.c
+++ b/testcases/kernel/syscalls/getcontext/getcontext01.c
@@ -54,12 +54,26 @@ int TST_TOTAL = 1;
int exp_enos[] = { 0 }; /* must be a 0 terminated list */
+static void test_getcontext(void)
+{
+ ucontext_t ptr;
+
+ TEST(getcontext(&ptr));
+
+ if (TEST_RETURN == -1) {
+ if (errno == ENOSYS)
+ tst_resm(TCONF, "getcontext is not implemented in
libc");
+ else
+ tst_resm(TFAIL | TTERRNO, "getcontext failed");
+ } else if (TEST_RETURN >= 0)
+ tst_resm(TPASS, "getcontext passed");
+}
+
int main(int ac, char **av)
{
int lc;
char *msg;
- ucontext_t ptr;
if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
@@ -71,13 +85,7 @@ int main(int ac, char **av)
tst_count = 0;
- TEST(getcontext(&ptr));
-
- if (TEST_RETURN == -1)
- tst_resm(TFAIL | TTERRNO, "getcontext failed");
- else if (TEST_RETURN >= 0)
- tst_resm(TPASS, "getcontext passed");
-
+ test_getcontext();
}
cleanup();
--
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [LTP] [PATCH v3] getcontext01: check getcontext function in libc
2013-10-23 13:54 [LTP] [PATCH v3] getcontext01: check getcontext function in libc Honggyu Kim
@ 2013-10-23 14:04 ` Jan Stancek
0 siblings, 0 replies; 2+ messages in thread
From: Jan Stancek @ 2013-10-23 14:04 UTC (permalink / raw)
To: Honggyu Kim; +Cc: ltp-list
----- Original Message -----
> From: "Honggyu Kim" <hong.gyu.kim@lge.com>
> To: ltp-list@lists.sourceforge.net
> Sent: Wednesday, 23 October, 2013 3:54:45 PM
> Subject: [LTP] [PATCH v3] 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 and -1 is returned, it goes to TFAIL as it was.
>
> Change-Id: I93cab9805e5bc9cd05f9f473b466e0dc2bc4fa8f
> Signed-off-by: Honggyu Kim <hong.gyu.kim@lge.com>
> ---
> .../kernel/syscalls/getcontext/getcontext01.c | 24
> +++++++++++++-------
> 1 file changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/getcontext/getcontext01.c
> b/testcases/kernel/syscalls/getcontext/getcontext01.c
> index 03b2df9..7919fb5 100644
> --- a/testcases/kernel/syscalls/getcontext/getcontext01.c
> +++ b/testcases/kernel/syscalls/getcontext/getcontext01.c
> @@ -54,12 +54,26 @@ int TST_TOTAL = 1;
>
> int exp_enos[] = { 0 }; /* must be a 0 terminated list */
>
> +static void test_getcontext(void)
> +{
> + ucontext_t ptr;
> +
> + TEST(getcontext(&ptr));
> +
> + if (TEST_RETURN == -1) {
> + if (errno == ENOSYS)
> + tst_resm(TCONF, "getcontext is not implemented in
> libc");
Hi,
I see the line above getting wrapped. I can recommend "git send-email":
1. git format-patch -1
2. git send-email --to ltp-list@lists.sourceforge.net 0001-...
Regards,
Jan
> + else
> + tst_resm(TFAIL | TTERRNO, "getcontext failed");
> + } else if (TEST_RETURN >= 0)
> + tst_resm(TPASS, "getcontext passed");
> +}
> +
> int main(int ac, char **av)
> {
> int lc;
> char *msg;
>
> - ucontext_t ptr;
> if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
> tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
>
> @@ -71,13 +85,7 @@ int main(int ac, char **av)
>
> tst_count = 0;
>
> - TEST(getcontext(&ptr));
> -
> - if (TEST_RETURN == -1)
> - tst_resm(TFAIL | TTERRNO, "getcontext failed");
> - else if (TEST_RETURN >= 0)
> - tst_resm(TPASS, "getcontext passed");
> -
> + test_getcontext();
> }
>
> cleanup();
> --
> 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
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>
------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-23 14:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-23 13:54 [LTP] [PATCH v3] getcontext01: check getcontext function in libc Honggyu Kim
2013-10-23 14:04 ` Jan Stancek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox