* [LTP] [PATCH] unshare01.c: TEST_RETURN is used wrong @ 2011-02-15 9:31 Peng Haitao 2011-02-15 13:26 ` Serge E. Hallyn 2011-02-15 14:29 ` Garrett Cooper 0 siblings, 2 replies; 7+ messages in thread From: Peng Haitao @ 2011-02-15 9:31 UTC (permalink / raw) To: Garrett Cooper; +Cc: ltp-list Hi Garrett, Signed-off-by: Peng Haitao <penght@cn.fujitsu.com> --- testcases/kernel/syscalls/unshare/unshare01.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/testcases/kernel/syscalls/unshare/unshare01.c b/testcases/kernel/syscalls/unshare/unshare01.c index e19d73d..9ae5e8f 100644 --- a/testcases/kernel/syscalls/unshare/unshare01.c +++ b/testcases/kernel/syscalls/unshare/unshare01.c @@ -206,7 +206,7 @@ int main(int ac, char **av) { } pid1 = fork(); - if (TEST_RETURN == -1) { + if (pid1 == -1) { tst_brkm(TFAIL|TERRNO, cleanup, "fork failed"); } else if (pid1 == 0) { @@ -249,7 +249,7 @@ int main(int ac, char **av) { if (pid1 == -1) { tst_brkm(TFAIL|TERRNO, cleanup, "fork() failed."); - } else if (TEST_RETURN == 0) { + } else if (pid1 == 0) { TEST(unshare(CLONE_NEWNS)); if (TEST_RETURN == 0) { printf("unshare call with CLONE_NEWNS " @@ -299,4 +299,4 @@ int main(void) tst_resm(TCONF, "unshare is undefined."); tst_exit(); } -#endif \ No newline at end of file +#endif -- 1.7.3.1 -- Best Regards, Peng Haitao ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH] unshare01.c: TEST_RETURN is used wrong 2011-02-15 9:31 [LTP] [PATCH] unshare01.c: TEST_RETURN is used wrong Peng Haitao @ 2011-02-15 13:26 ` Serge E. Hallyn 2011-02-15 14:30 ` Garrett Cooper 2011-02-15 14:29 ` Garrett Cooper 1 sibling, 1 reply; 7+ messages in thread From: Serge E. Hallyn @ 2011-02-15 13:26 UTC (permalink / raw) To: Peng Haitao; +Cc: ltp-list Quoting Peng Haitao (penght@cn.fujitsu.com): > Hi Garrett, > > Signed-off-by: Peng Haitao <penght@cn.fujitsu.com> > --- > testcases/kernel/syscalls/unshare/unshare01.c | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/testcases/kernel/syscalls/unshare/unshare01.c b/testcases/kernel/syscalls/unshare/unshare01.c > index e19d73d..9ae5e8f 100644 > --- a/testcases/kernel/syscalls/unshare/unshare01.c > +++ b/testcases/kernel/syscalls/unshare/unshare01.c > @@ -206,7 +206,7 @@ int main(int ac, char **av) { > } > > pid1 = fork(); > - if (TEST_RETURN == -1) { > + if (pid1 == -1) { Looking at the rest of that file, isn't the right fix to wrap 'pid1 = fork();' in a TEST() macro? -serge ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH] unshare01.c: TEST_RETURN is used wrong 2011-02-15 13:26 ` Serge E. Hallyn @ 2011-02-15 14:30 ` Garrett Cooper 2011-02-15 15:43 ` Serge E. Hallyn 0 siblings, 1 reply; 7+ messages in thread From: Garrett Cooper @ 2011-02-15 14:30 UTC (permalink / raw) To: Serge E. Hallyn; +Cc: ltp-list On Tue, Feb 15, 2011 at 5:26 AM, Serge E. Hallyn <serge.hallyn@canonical.com> wrote: > Quoting Peng Haitao (penght@cn.fujitsu.com): >> Hi Garrett, >> >> Signed-off-by: Peng Haitao <penght@cn.fujitsu.com> >> --- >> testcases/kernel/syscalls/unshare/unshare01.c | 6 +++--- >> 1 files changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/testcases/kernel/syscalls/unshare/unshare01.c b/testcases/kernel/syscalls/unshare/unshare01.c >> index e19d73d..9ae5e8f 100644 >> --- a/testcases/kernel/syscalls/unshare/unshare01.c >> +++ b/testcases/kernel/syscalls/unshare/unshare01.c >> @@ -206,7 +206,7 @@ int main(int ac, char **av) { >> } >> >> pid1 = fork(); >> - if (TEST_RETURN == -1) { >> + if (pid1 == -1) { > > Looking at the rest of that file, isn't the right fix to > wrap 'pid1 = fork();' in a TEST() macro? Hi Serge! I would agree with you, but in my firm opinion this testcase abuses TEST_ERRNO, etc way too much for no good reason. I just didn't remember to follow through finishing off this file for some odd reason. Thanks, -Garrett ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH] unshare01.c: TEST_RETURN is used wrong 2011-02-15 14:30 ` Garrett Cooper @ 2011-02-15 15:43 ` Serge E. Hallyn 0 siblings, 0 replies; 7+ messages in thread From: Serge E. Hallyn @ 2011-02-15 15:43 UTC (permalink / raw) To: Garrett Cooper; +Cc: ltp-list Quoting Garrett Cooper (yanegomi@gmail.com): > > Looking at the rest of that file, isn't the right fix to > > wrap 'pid1 = fork();' in a TEST() macro? > > Hi Serge! > I would agree with you, but in my firm opinion this testcase > abuses TEST_ERRNO, etc way too much for no good reason. Cool. > I just didn't remember to follow through finishing off this file > for some odd reason. thanks, -serge ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH] unshare01.c: TEST_RETURN is used wrong 2011-02-15 9:31 [LTP] [PATCH] unshare01.c: TEST_RETURN is used wrong Peng Haitao 2011-02-15 13:26 ` Serge E. Hallyn @ 2011-02-15 14:29 ` Garrett Cooper 2011-02-16 3:58 ` Peng Haitao 1 sibling, 1 reply; 7+ messages in thread From: Garrett Cooper @ 2011-02-15 14:29 UTC (permalink / raw) To: Peng Haitao; +Cc: ltp-list [-- Attachment #1: Type: text/plain, Size: 1661 bytes --] On Tue, Feb 15, 2011 at 1:31 AM, Peng Haitao <penght@cn.fujitsu.com> wrote: > Hi Garrett, > > Signed-off-by: Peng Haitao <penght@cn.fujitsu.com> > --- > testcases/kernel/syscalls/unshare/unshare01.c | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/testcases/kernel/syscalls/unshare/unshare01.c b/testcases/kernel/syscalls/unshare/unshare01.c > index e19d73d..9ae5e8f 100644 > --- a/testcases/kernel/syscalls/unshare/unshare01.c > +++ b/testcases/kernel/syscalls/unshare/unshare01.c > @@ -206,7 +206,7 @@ int main(int ac, char **av) { > } > > pid1 = fork(); > - if (TEST_RETURN == -1) { > + if (pid1 == -1) { > tst_brkm(TFAIL|TERRNO, cleanup, > "fork failed"); > } else if (pid1 == 0) { > @@ -249,7 +249,7 @@ int main(int ac, char **av) { > if (pid1 == -1) { > tst_brkm(TFAIL|TERRNO, cleanup, > "fork() failed."); > - } else if (TEST_RETURN == 0) { > + } else if (pid1 == 0) { > TEST(unshare(CLONE_NEWNS)); > if (TEST_RETURN == 0) { > printf("unshare call with CLONE_NEWNS " > @@ -299,4 +299,4 @@ int main(void) > tst_resm(TCONF, "unshare is undefined."); > tst_exit(); > } > -#endif > \ No newline at end of file > +#endif How about this? Thanks, -Garrett [-- Attachment #2: ltp-testcases-kernel-syscalls-unshare-fix.patch --] [-- Type: text/x-patch, Size: 4700 bytes --] diff --git a/testcases/kernel/syscalls/unshare/unshare01.c b/testcases/kernel/syscalls/unshare/unshare01.c index e19d73d..a460248 100644 --- a/testcases/kernel/syscalls/unshare/unshare01.c +++ b/testcases/kernel/syscalls/unshare/unshare01.c @@ -109,14 +109,14 @@ int TST_TOTAL = 1; /* total number of tests in this file. */ /* Description: Performs all one time clean up for this test on successful */ /* completion, premature exit or failure. Closes all temporary */ /* files, removes all temporary directories exits the test with */ -/* appropriate TEST_RETURNurn code by calling tst_exit() function. */ +/* appropriate return code by calling tst_exit() function. */ /* */ /* Input: None. */ /* */ /* Output: None. */ /* */ -/* Return: On failure - Exits calling tst_exit(). Non '0' TEST_RETURNurn code. */ -/* On success - Exits calling tst_exit(). With '0' TEST_RETURNurn code. */ +/* Return: On failure - Exits calling tst_exit(). Non '0' return code. */ +/* On success - Exits calling tst_exit(). With '0' return code. */ /* */ /******************************************************************************/ extern void cleanup() { @@ -140,7 +140,7 @@ extern void cleanup() { /* Output: None. */ /* */ /* Return: On failure - Exits by calling cleanup(). */ -/* On success - TEST_RETURNurns 0. */ +/* On success - returns 0. */ /* */ /******************************************************************************/ void setup() { @@ -154,7 +154,7 @@ int main(int ac, char **av) { pid_t pid1; int lc; /* loop counter */ int rval; - char *msg; /* message TEST_RETURNurned from parse_opts */ + char *msg; /* message returned from parse_opts */ /* parse standard options */ if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) @@ -166,20 +166,20 @@ int main(int ac, char **av) { Tst_count = 0; for (testno = 0; testno < TST_TOTAL; ++testno) { - TEST(pid1 = fork()); //call to fork() - if (TEST_RETURN == -1) { - tst_brkm(TFAIL|TTERRNO, cleanup, "fork failed"); - } else if (TEST_RETURN == 0) { - TEST(unshare(CLONE_FILES)); - if (TEST_RETURN == 0) { + pid1 = fork(); //call to fork() + if (pid1 == -1) { + tst_brkm(TFAIL|TERRNO, cleanup, "fork failed"); + } else if (pid1 == 0) { + switch (unshare(CLONE_FILES)) { + case 0: printf("unshare with CLONE_FILES call " "succeeded\n"); rval = 0; - } else if (TEST_RETURN == -1) { - if (TEST_ERRNO == ENOSYS) { + break; + case -1: + if (errno == ENOSYS) rval = 1; - } else { - errno = TEST_ERRNO; + else { perror("unshare failed"); rval = 2; } @@ -200,36 +200,34 @@ int main(int ac, char **av) { default: tst_brkm(TFAIL, cleanup, "unshare failed"); - break; } } } pid1 = fork(); - if (TEST_RETURN == -1) { + if (pid1 == -1) { tst_brkm(TFAIL|TERRNO, cleanup, "fork failed"); } else if (pid1 == 0) { - TEST(unshare(CLONE_FS)); - if (TEST_RETURN == 0) { + switch (unshare(CLONE_FS)) { + case 0: printf("unshare with CLONE_FS call " "succeeded\n"); rval = 0; - } else if (TEST_RETURN == -1) { - if (TEST_ERRNO == ENOSYS) { + break; + case -1: + if (errno == ENOSYS) rval = 1; - } else { - errno = TEST_ERRNO; + else { perror("unshare failed"); rval = 2; } } exit(rval); } else { - if (wait(&rval) == -1) { + if (wait(&rval) == -1) tst_brkm(TBROK|TERRNO, cleanup, "wait failed"); - } if (rval != 0 && WIFEXITED(rval)) { switch (WEXITSTATUS(rval)) { case 1: @@ -249,17 +247,17 @@ int main(int ac, char **av) { if (pid1 == -1) { tst_brkm(TFAIL|TERRNO, cleanup, "fork() failed."); - } else if (TEST_RETURN == 0) { - TEST(unshare(CLONE_NEWNS)); - if (TEST_RETURN == 0) { + } else if (pid1 == 0) { + switch (unshare(CLONE_NEWNS)) { + case 0: printf("unshare call with CLONE_NEWNS " "succeeded\n"); rval = 0; - } else if (TEST_RETURN == -1) { - if (TEST_ERRNO == ENOSYS) { + break; + case -1: + if (errno == ENOSYS) rval = 1; - } else { - errno = TEST_ERRNO; + else { perror("unshare failed"); rval = 2; } @@ -299,4 +297,4 @@ int main(void) tst_resm(TCONF, "unshare is undefined."); tst_exit(); } -#endif \ No newline at end of file +#endif [-- Attachment #3: Type: text/plain, Size: 387 bytes --] ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb [-- Attachment #4: Type: text/plain, Size: 155 bytes --] _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH] unshare01.c: TEST_RETURN is used wrong 2011-02-15 14:29 ` Garrett Cooper @ 2011-02-16 3:58 ` Peng Haitao 2011-02-16 5:35 ` Garrett Cooper 0 siblings, 1 reply; 7+ messages in thread From: Peng Haitao @ 2011-02-16 3:58 UTC (permalink / raw) To: Garrett Cooper; +Cc: ltp-list Hi Garrett, Garrett Cooper said the following on 2011-2-15 22:29: > > How about this? The patch is OK, thanks. but "break;" in block "default:" can be deleted:) > Thanks, > -Garrett -- Best Regards, Peng Haitao ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH] unshare01.c: TEST_RETURN is used wrong 2011-02-16 3:58 ` Peng Haitao @ 2011-02-16 5:35 ` Garrett Cooper 0 siblings, 0 replies; 7+ messages in thread From: Garrett Cooper @ 2011-02-16 5:35 UTC (permalink / raw) To: Peng Haitao; +Cc: ltp-list On Tue, Feb 15, 2011 at 7:58 PM, Peng Haitao <penght@cn.fujitsu.com> wrote: > Hi Garrett, > > Garrett Cooper said the following on 2011-2-15 22:29: >> >> How about this? > > The patch is OK, thanks. > but "break;" in block "default:" can be deleted:) Sure -- thanks! -Garrett ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-02-16 5:35 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-02-15 9:31 [LTP] [PATCH] unshare01.c: TEST_RETURN is used wrong Peng Haitao 2011-02-15 13:26 ` Serge E. Hallyn 2011-02-15 14:30 ` Garrett Cooper 2011-02-15 15:43 ` Serge E. Hallyn 2011-02-15 14:29 ` Garrett Cooper 2011-02-16 3:58 ` Peng Haitao 2011-02-16 5:35 ` Garrett Cooper
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.