* [LTP] [PATCH 1/4] mqns: strip leading / from mq names
@ 2010-04-28 21:09 Serge E. Hallyn
2010-04-28 21:09 ` [LTP] [PATCH 2/4] pidns30: strip leading / from name passed to mq_open Serge E. Hallyn
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Serge E. Hallyn @ 2010-04-28 21:09 UTC (permalink / raw)
To: Garrett Cooper; +Cc: LTP list
So the tests can pass
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
---
testcases/kernel/containers/mqns/mqns.h | 2 ++
testcases/kernel/containers/mqns/mqns_01.c | 8 ++++----
testcases/kernel/containers/mqns/mqns_02.c | 8 ++++----
testcases/kernel/containers/mqns/mqns_03.c | 2 +-
testcases/kernel/containers/mqns/mqns_04.c | 2 +-
5 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/testcases/kernel/containers/mqns/mqns.h b/testcases/kernel/containers/mqns/mqns.h
index e5912d5..1c624c2 100644
--- a/testcases/kernel/containers/mqns/mqns.h
+++ b/testcases/kernel/containers/mqns/mqns.h
@@ -10,6 +10,8 @@
#define DEV_MQUEUE "/dev/mqueue"
#define DEV_MQUEUE2 "/dev/mqueue2"
#define SLASH_MQ1 "/MQ1"
+#define NOSLASH_MQ1 "MQ1"
#define SLASH_MQ2 "/MQ2"
+#define NOSLASH_MQ2 "MQ2"
#endif /* __MQNS_H */
diff --git a/testcases/kernel/containers/mqns/mqns_01.c b/testcases/kernel/containers/mqns/mqns_01.c
index 7f41b2d..515ed51 100644
--- a/testcases/kernel/containers/mqns/mqns_01.c
+++ b/testcases/kernel/containers/mqns/mqns_01.c
@@ -55,7 +55,7 @@ int check_mqueue(void *vtest)
if (read(p1[0], buf, strlen("go") + 1) < 0)
tst_resm(TBROK | TERRNO, "read(p1[0], ...) failed");
- mqd = syscall(__NR_mq_open, SLASH_MQ1, O_RDONLY);
+ mqd = syscall(__NR_mq_open, NOSLASH_MQ1, O_RDONLY);
if (mqd == -1) {
if (write(p2[1], "notfnd", strlen("notfnd") + 1) < 0)
tst_resm(TBROK | TERRNO, "write(p2[1], ...) failed");
@@ -86,7 +86,7 @@ main(int argc, char *argv[])
if (pipe(p1) == -1) { perror("pipe"); exit(EXIT_FAILURE); }
if (pipe(p2) == -1) { perror("pipe"); exit(EXIT_FAILURE); }
- mqd = syscall(__NR_mq_open, SLASH_MQ1, O_RDWR|O_CREAT|O_EXCL, 0777,
+ mqd = syscall(__NR_mq_open, NOSLASH_MQ1, O_RDWR|O_CREAT|O_EXCL, 0777,
NULL);
if (mqd == -1) {
perror("mq_open");
@@ -100,7 +100,7 @@ main(int argc, char *argv[])
if (r < 0) {
tst_resm(TFAIL, "failed clone/unshare\n");
mq_close(mqd);
- syscall(__NR_mq_unlink, SLASH_MQ1);
+ syscall(__NR_mq_unlink, NOSLASH_MQ1);
tst_exit();
}
@@ -122,7 +122,7 @@ main(int argc, char *argv[])
/* destroy the mqueue */
mq_close(mqd);
- syscall(__NR_mq_unlink, SLASH_MQ1);
+ syscall(__NR_mq_unlink, NOSLASH_MQ1);
tst_exit();
}
diff --git a/testcases/kernel/containers/mqns/mqns_02.c b/testcases/kernel/containers/mqns/mqns_02.c
index aa78f65..8f783ba 100644
--- a/testcases/kernel/containers/mqns/mqns_02.c
+++ b/testcases/kernel/containers/mqns/mqns_02.c
@@ -60,7 +60,7 @@ int check_mqueue(void *vtest)
tst_resm(TBROK | TERRNO, "read(p1[0], ..) failed");
else {
- mqd = syscall(__NR_mq_open, SLASH_MQ1, O_RDWR|O_CREAT|O_EXCL,
+ mqd = syscall(__NR_mq_open, NOSLASH_MQ1, O_RDWR|O_CREAT|O_EXCL,
0777, NULL);
if (mqd == -1) {
if (write(p2[1], "mqfail", strlen("mqfail") + 1) < 0) {
@@ -86,9 +86,9 @@ int check_mqueue(void *vtest)
tst_resm(TBROK | TERRNO,
"mq_close(mqd) failed");
} else if (syscall(__NR_mq_unlink,
- SLASH_MQ1) < 0) {
+ NOSLASH_MQ1) < 0) {
tst_resm(TBROK | TERRNO,
- "mq_unlink(" SLASH_MQ1
+ "mq_unlink(" NOSLASH_MQ1
") failed");
} else if (write(p2[1], "done",
strlen("done") + 1)
@@ -153,7 +153,7 @@ int main(int argc, char *argv[])
tst_exit();
} else {
- mqd = syscall(__NR_mq_open, SLASH_MQ1, O_RDONLY);
+ mqd = syscall(__NR_mq_open, NOSLASH_MQ1, O_RDONLY);
if (mqd == -1) {
tst_resm(TPASS, "Parent process can't see the mqueue\n");
} else {
diff --git a/testcases/kernel/containers/mqns/mqns_03.c b/testcases/kernel/containers/mqns/mqns_03.c
index 3c9e83e..83db75c 100644
--- a/testcases/kernel/containers/mqns/mqns_03.c
+++ b/testcases/kernel/containers/mqns/mqns_03.c
@@ -63,7 +63,7 @@ int check_mqueue(void *vtest)
read(p1[0], buf, 3); /* go */
- mqd = syscall(__NR_mq_open, SLASH_MQ1, O_RDWR|O_CREAT|O_EXCL, 0755,
+ mqd = syscall(__NR_mq_open, NOSLASH_MQ1, O_RDWR|O_CREAT|O_EXCL, 0755,
NULL);
if (mqd == -1) {
write(p2[1], "mqfail", 7);
diff --git a/testcases/kernel/containers/mqns/mqns_04.c b/testcases/kernel/containers/mqns/mqns_04.c
index 8a4a9c2..98d4e39 100644
--- a/testcases/kernel/containers/mqns/mqns_04.c
+++ b/testcases/kernel/containers/mqns/mqns_04.c
@@ -59,7 +59,7 @@ int check_mqueue(void *vtest)
read(p1[0], buf, 3); /* go */
- mqd = syscall(__NR_mq_open, SLASH_MQ1, O_RDWR|O_CREAT|O_EXCL, 0755,
+ mqd = syscall(__NR_mq_open, NOSLASH_MQ1, O_RDWR|O_CREAT|O_EXCL, 0755,
NULL);
if (mqd == -1) {
write(p2[1], "mqfail", 7);
--
1.7.0
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [LTP] [PATCH 2/4] pidns30: strip leading / from name passed to mq_open
2010-04-28 21:09 [LTP] [PATCH 1/4] mqns: strip leading / from mq names Serge E. Hallyn
@ 2010-04-28 21:09 ` Serge E. Hallyn
2010-04-28 23:02 ` Garrett Cooper
2010-04-28 21:09 ` [LTP] [PATCH 3/4] mqns2: fix some error checking and reporting Serge E. Hallyn
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Serge E. Hallyn @ 2010-04-28 21:09 UTC (permalink / raw)
To: Garrett Cooper; +Cc: LTP list
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
---
testcases/kernel/containers/pidns/pidns30.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/testcases/kernel/containers/pidns/pidns30.c b/testcases/kernel/containers/pidns/pidns30.c
index ea8c54c..5975b53 100644
--- a/testcases/kernel/containers/pidns/pidns30.c
+++ b/testcases/kernel/containers/pidns/pidns30.c
@@ -59,7 +59,7 @@
char *TCID = "pidns30";
int TST_TOTAL = 1;
-char *mqname = "/mq1";
+char *mqname = "mq1";
int result = TFAIL;
int errno;
--
1.7.0
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [LTP] [PATCH 3/4] mqns2: fix some error checking and reporting
2010-04-28 21:09 [LTP] [PATCH 1/4] mqns: strip leading / from mq names Serge E. Hallyn
2010-04-28 21:09 ` [LTP] [PATCH 2/4] pidns30: strip leading / from name passed to mq_open Serge E. Hallyn
@ 2010-04-28 21:09 ` Serge E. Hallyn
2010-04-28 23:02 ` Garrett Cooper
2010-04-28 21:10 ` [LTP] [PATCH 4/4] mqns04.c: don't exit strangely in clone case (please read) Serge E. Hallyn
2010-04-28 23:04 ` [LTP] [PATCH 1/4] mqns: strip leading / from mq names Garrett Cooper
3 siblings, 1 reply; 8+ messages in thread
From: Serge E. Hallyn @ 2010-04-28 21:09 UTC (permalink / raw)
To: Garrett Cooper; +Cc: LTP list
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
---
testcases/kernel/containers/mqns/mqns_02.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/testcases/kernel/containers/mqns/mqns_02.c b/testcases/kernel/containers/mqns/mqns_02.c
index 8f783ba..07ab042 100644
--- a/testcases/kernel/containers/mqns/mqns_02.c
+++ b/testcases/kernel/containers/mqns/mqns_02.c
@@ -76,7 +76,7 @@ int check_mqueue(void *vtest)
else {
- if (read(p1[0], buf, 5))
+ if (read(p1[0], buf, 5) < 0)
tst_resm(TBROK | TERRNO,
"read(p1[0], ..) failed");
else {
@@ -142,7 +142,7 @@ int main(int argc, char *argv[])
}
if (read(p2[0], buf, 7) < 0) {
- tst_resm(TBROK, "read(p1[0], ..) failed");
+ tst_resm(TBROK, "read(p2[0], ..) failed");
} else if (!strcmp(buf, "mqfail")) {
tst_resm(TFAIL, "child process could not create mqueue\n");
umount(DEV_MQUEUE);
@@ -160,8 +160,8 @@ int main(int argc, char *argv[])
tst_resm(TFAIL, "Parent process found mqueue\n");
mq_close(mqd);
}
- if (write(p1[1], "cont", 5)) {
- tst_resm(TBROK, "read(p1[0], ..) failed");
+ if (write(p1[1], "cont", 5) < 0) {
+ tst_resm(TBROK, "write(p1[1], ..) failed");
}
}
--
1.7.0
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [LTP] [PATCH 4/4] mqns04.c: don't exit strangely in clone case (please read)
2010-04-28 21:09 [LTP] [PATCH 1/4] mqns: strip leading / from mq names Serge E. Hallyn
2010-04-28 21:09 ` [LTP] [PATCH 2/4] pidns30: strip leading / from name passed to mq_open Serge E. Hallyn
2010-04-28 21:09 ` [LTP] [PATCH 3/4] mqns2: fix some error checking and reporting Serge E. Hallyn
@ 2010-04-28 21:10 ` Serge E. Hallyn
2010-04-28 23:04 ` [LTP] [PATCH 1/4] mqns: strip leading / from mq names Garrett Cooper
3 siblings, 0 replies; 8+ messages in thread
From: Serge E. Hallyn @ 2010-04-28 21:10 UTC (permalink / raw)
To: Garrett Cooper, Matt Helsley; +Cc: LTP list
The child spawned by mqns04.c terminates by calling tst_exit().
tst_exit() basically calls exit(0). In the case where the child
was spawned with fork+unshare that's fine, but in the case where
it was spawned by clone() it is not: it causes the parent to see
the exit status as 4, as in:
posixmq_namespace_04 1 TFAIL : Child did not exit normally (status 4)
This patch simply makes the child do _exit(0) on success, and that
works fine. I wonder if there is some way we can generically do
the right thing at txt_exit()?
Note that other tests have the same problem:
pid_namespace1 0 TWARN : child exited with signal 4
pid_namespace4 2 TFAIL : Container init pid got killed by signal 4
pidns20 1 TBROK : parent: cinit is terminated by 4
Should we just do this same "fix" in those testcases?
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
---
testcases/kernel/containers/mqns/mqns_04.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/testcases/kernel/containers/mqns/mqns_04.c b/testcases/kernel/containers/mqns/mqns_04.c
index 98d4e39..6f4bb8f 100644
--- a/testcases/kernel/containers/mqns/mqns_04.c
+++ b/testcases/kernel/containers/mqns/mqns_04.c
@@ -78,6 +78,7 @@ int check_mqueue(void *vtest)
write(p2[1], "go", 3);
read(p1[0], buf, 3);
+ _exit(0);
tst_exit();
}
--
1.7.0
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH 3/4] mqns2: fix some error checking and reporting
2010-04-28 21:09 ` [LTP] [PATCH 3/4] mqns2: fix some error checking and reporting Serge E. Hallyn
@ 2010-04-28 23:02 ` Garrett Cooper
0 siblings, 0 replies; 8+ messages in thread
From: Garrett Cooper @ 2010-04-28 23:02 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: LTP list
On Wed, Apr 28, 2010 at 2:09 PM, Serge E. Hallyn <serue@us.ibm.com> wrote:
> Signed-off-by: Serge Hallyn <serue@us.ibm.com>
> ---
> testcases/kernel/containers/mqns/mqns_02.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/testcases/kernel/containers/mqns/mqns_02.c b/testcases/kernel/containers/mqns/mqns_02.c
> index 8f783ba..07ab042 100644
> --- a/testcases/kernel/containers/mqns/mqns_02.c
> +++ b/testcases/kernel/containers/mqns/mqns_02.c
> @@ -76,7 +76,7 @@ int check_mqueue(void *vtest)
>
> else {
>
> - if (read(p1[0], buf, 5))
> + if (read(p1[0], buf, 5) < 0)
> tst_resm(TBROK | TERRNO,
> "read(p1[0], ..) failed");
> else {
> @@ -142,7 +142,7 @@ int main(int argc, char *argv[])
> }
>
> if (read(p2[0], buf, 7) < 0) {
> - tst_resm(TBROK, "read(p1[0], ..) failed");
> + tst_resm(TBROK, "read(p2[0], ..) failed");
> } else if (!strcmp(buf, "mqfail")) {
> tst_resm(TFAIL, "child process could not create mqueue\n");
> umount(DEV_MQUEUE);
> @@ -160,8 +160,8 @@ int main(int argc, char *argv[])
> tst_resm(TFAIL, "Parent process found mqueue\n");
> mq_close(mqd);
> }
> - if (write(p1[1], "cont", 5)) {
> - tst_resm(TBROK, "read(p1[0], ..) failed");
> + if (write(p1[1], "cont", 5) < 0) {
> + tst_resm(TBROK, "write(p1[1], ..) failed");
Acked-by: Garrett Cooper <yanegomi@gmail.com>
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH 2/4] pidns30: strip leading / from name passed to mq_open
2010-04-28 21:09 ` [LTP] [PATCH 2/4] pidns30: strip leading / from name passed to mq_open Serge E. Hallyn
@ 2010-04-28 23:02 ` Garrett Cooper
0 siblings, 0 replies; 8+ messages in thread
From: Garrett Cooper @ 2010-04-28 23:02 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: LTP list
On Wed, Apr 28, 2010 at 2:09 PM, Serge E. Hallyn <serue@us.ibm.com> wrote:
> Signed-off-by: Serge Hallyn <serue@us.ibm.com>
> ---
> testcases/kernel/containers/pidns/pidns30.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/testcases/kernel/containers/pidns/pidns30.c b/testcases/kernel/containers/pidns/pidns30.c
> index ea8c54c..5975b53 100644
> --- a/testcases/kernel/containers/pidns/pidns30.c
> +++ b/testcases/kernel/containers/pidns/pidns30.c
> @@ -59,7 +59,7 @@
> char *TCID = "pidns30";
> int TST_TOTAL = 1;
>
> -char *mqname = "/mq1";
> +char *mqname = "mq1";
> int result = TFAIL;
>
> int errno;
Acked-by: Garrett Cooper <yanegomi@gmail.com>
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH 1/4] mqns: strip leading / from mq names
2010-04-28 21:09 [LTP] [PATCH 1/4] mqns: strip leading / from mq names Serge E. Hallyn
` (2 preceding siblings ...)
2010-04-28 21:10 ` [LTP] [PATCH 4/4] mqns04.c: don't exit strangely in clone case (please read) Serge E. Hallyn
@ 2010-04-28 23:04 ` Garrett Cooper
2010-04-29 0:29 ` Serge E. Hallyn
3 siblings, 1 reply; 8+ messages in thread
From: Garrett Cooper @ 2010-04-28 23:04 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: LTP list
On Wed, Apr 28, 2010 at 2:09 PM, Serge E. Hallyn <serue@us.ibm.com> wrote:
> So the tests can pass
>
> Signed-off-by: Serge Hallyn <serue@us.ibm.com>
> ---
> testcases/kernel/containers/mqns/mqns.h | 2 ++
> testcases/kernel/containers/mqns/mqns_01.c | 8 ++++----
> testcases/kernel/containers/mqns/mqns_02.c | 8 ++++----
> testcases/kernel/containers/mqns/mqns_03.c | 2 +-
> testcases/kernel/containers/mqns/mqns_04.c | 2 +-
> 5 files changed, 12 insertions(+), 10 deletions(-)
Are the SLASH_* equivalents used anywhere still?
Thanks,
-Garrett
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH 1/4] mqns: strip leading / from mq names
2010-04-28 23:04 ` [LTP] [PATCH 1/4] mqns: strip leading / from mq names Garrett Cooper
@ 2010-04-29 0:29 ` Serge E. Hallyn
0 siblings, 0 replies; 8+ messages in thread
From: Serge E. Hallyn @ 2010-04-29 0:29 UTC (permalink / raw)
To: Garrett Cooper; +Cc: LTP list
Quoting Garrett Cooper (yanegomi@gmail.com):
> On Wed, Apr 28, 2010 at 2:09 PM, Serge E. Hallyn <serue@us.ibm.com> wrote:
> > So the tests can pass
> >
> > Signed-off-by: Serge Hallyn <serue@us.ibm.com>
> > ---
> > testcases/kernel/containers/mqns/mqns.h | 2 ++
> > testcases/kernel/containers/mqns/mqns_01.c | 8 ++++----
> > testcases/kernel/containers/mqns/mqns_02.c | 8 ++++----
> > testcases/kernel/containers/mqns/mqns_03.c | 2 +-
> > testcases/kernel/containers/mqns/mqns_04.c | 2 +-
> > 5 files changed, 12 insertions(+), 10 deletions(-)
>
> Are the SLASH_* equivalents used anywhere still?
> Thanks,
> -Garrett
I don't think so.
thanks,
-serge
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-04-29 2:24 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-28 21:09 [LTP] [PATCH 1/4] mqns: strip leading / from mq names Serge E. Hallyn
2010-04-28 21:09 ` [LTP] [PATCH 2/4] pidns30: strip leading / from name passed to mq_open Serge E. Hallyn
2010-04-28 23:02 ` Garrett Cooper
2010-04-28 21:09 ` [LTP] [PATCH 3/4] mqns2: fix some error checking and reporting Serge E. Hallyn
2010-04-28 23:02 ` Garrett Cooper
2010-04-28 21:10 ` [LTP] [PATCH 4/4] mqns04.c: don't exit strangely in clone case (please read) Serge E. Hallyn
2010-04-28 23:04 ` [LTP] [PATCH 1/4] mqns: strip leading / from mq names Garrett Cooper
2010-04-29 0:29 ` Serge E. Hallyn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox