* [LTP] [PATCH] Add TEST_LOOPING in userns01.
@ 2015-06-09 9:28 Yuan Sun
2015-06-09 9:30 ` Jan Stancek
0 siblings, 1 reply; 2+ messages in thread
From: Yuan Sun @ 2015-06-09 9:28 UTC (permalink / raw)
To: jstancek; +Cc: ltp-list
Signed-off-by: Yuan Sun <sunyuan3@huawei.com>
---
testcases/kernel/containers/userns/userns01.c | 31 +++++++++++++++------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/testcases/kernel/containers/userns/userns01.c b/testcases/kernel/containers/userns/userns01.c
index 6e313c0..9cada5e 100644
--- a/testcases/kernel/containers/userns/userns01.c
+++ b/testcases/kernel/containers/userns/userns01.c
@@ -71,25 +71,28 @@ static void setup(void)
int main(int argc, char *argv[])
{
int status;
+ int lc;
tst_parse_opts(argc, argv, NULL, NULL);
setup();
- TEST(do_clone_unshare_test(T_CLONE, CLONE_NEWUSER, child_fn1, NULL));
-
- if (TEST_RETURN == -1)
- tst_brkm(TFAIL | TTERRNO, NULL, "clone failed");
- else if ((wait(&status)) == -1)
- tst_brkm(TWARN | TERRNO, NULL, "wait failed");
-
- if (WIFEXITED(status) && WEXITSTATUS(status) != 0)
- tst_resm(TFAIL, "child exited abnormally");
- else if (WIFSIGNALED(status)) {
- tst_resm(TFAIL, "child was killed with signal = %d",
- WTERMSIG(status));
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ TEST(do_clone_unshare_test(T_CLONE, CLONE_NEWUSER,
+ child_fn1, NULL));
+
+ if (TEST_RETURN == -1)
+ tst_brkm(TFAIL | TTERRNO, NULL, "clone failed");
+ else if ((wait(&status)) == -1)
+ tst_brkm(TWARN | TERRNO, NULL, "wait failed");
+
+ if (WIFEXITED(status) && WEXITSTATUS(status) != 0)
+ tst_resm(TFAIL, "child exited abnormally");
+ else if (WIFSIGNALED(status)) {
+ tst_resm(TFAIL, "child was killed with signal = %d",
+ WTERMSIG(status));
+ } else
+ tst_resm(TPASS, "uid and gid are right");
}
-
- tst_resm(TPASS, "the uid and the gid are right inside the container");
tst_exit();
}
--
1.9.1
------------------------------------------------------------------------------
_______________________________________________
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] Add TEST_LOOPING in userns01.
2015-06-09 9:28 [LTP] [PATCH] Add TEST_LOOPING in userns01 Yuan Sun
@ 2015-06-09 9:30 ` Jan Stancek
0 siblings, 0 replies; 2+ messages in thread
From: Jan Stancek @ 2015-06-09 9:30 UTC (permalink / raw)
To: Yuan Sun; +Cc: ltp-list
----- Original Message -----
> From: "Yuan Sun" <sunyuan3@huawei.com>
> To: jstancek@redhat.com
> Cc: ltp-list@lists.sourceforge.net
> Sent: Tuesday, 9 June, 2015 11:28:39 AM
> Subject: [PATCH] Add TEST_LOOPING in userns01.
>
> Signed-off-by: Yuan Sun <sunyuan3@huawei.com>
Thanks for following-up on this, applied.
Regards,
Jan
> ---
> testcases/kernel/containers/userns/userns01.c | 31
> +++++++++++++++------------
> 1 file changed, 17 insertions(+), 14 deletions(-)
>
> diff --git a/testcases/kernel/containers/userns/userns01.c
> b/testcases/kernel/containers/userns/userns01.c
> index 6e313c0..9cada5e 100644
> --- a/testcases/kernel/containers/userns/userns01.c
> +++ b/testcases/kernel/containers/userns/userns01.c
> @@ -71,25 +71,28 @@ static void setup(void)
> int main(int argc, char *argv[])
> {
> int status;
> + int lc;
>
> tst_parse_opts(argc, argv, NULL, NULL);
> setup();
>
> - TEST(do_clone_unshare_test(T_CLONE, CLONE_NEWUSER, child_fn1, NULL));
> -
> - if (TEST_RETURN == -1)
> - tst_brkm(TFAIL | TTERRNO, NULL, "clone failed");
> - else if ((wait(&status)) == -1)
> - tst_brkm(TWARN | TERRNO, NULL, "wait failed");
> -
> - if (WIFEXITED(status) && WEXITSTATUS(status) != 0)
> - tst_resm(TFAIL, "child exited abnormally");
> - else if (WIFSIGNALED(status)) {
> - tst_resm(TFAIL, "child was killed with signal = %d",
> - WTERMSIG(status));
> + for (lc = 0; TEST_LOOPING(lc); lc++) {
> + TEST(do_clone_unshare_test(T_CLONE, CLONE_NEWUSER,
> + child_fn1, NULL));
> +
> + if (TEST_RETURN == -1)
> + tst_brkm(TFAIL | TTERRNO, NULL, "clone failed");
> + else if ((wait(&status)) == -1)
> + tst_brkm(TWARN | TERRNO, NULL, "wait failed");
> +
> + if (WIFEXITED(status) && WEXITSTATUS(status) != 0)
> + tst_resm(TFAIL, "child exited abnormally");
> + else if (WIFSIGNALED(status)) {
> + tst_resm(TFAIL, "child was killed with signal = %d",
> + WTERMSIG(status));
> + } else
> + tst_resm(TPASS, "uid and gid are right");
> }
> -
> - tst_resm(TPASS, "the uid and the gid are right inside the container");
> tst_exit();
> }
>
> --
> 1.9.1
>
>
------------------------------------------------------------------------------
_______________________________________________
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:[~2015-06-09 9:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-09 9:28 [LTP] [PATCH] Add TEST_LOOPING in userns01 Yuan Sun
2015-06-09 9:30 ` Jan Stancek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox