On Tue, Feb 15, 2011 at 1:31 AM, Peng Haitao <[email protected]> wrote:
> Hi Garrett,
>
> Signed-off-by: Peng Haitao <[email protected]>
> ---
> 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
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
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list