[LTP] [PATCH 11/31] fcntl: Remove UCLINUX
Petr Vorel
pvorel@suse.cz
Thu Apr 11 16:30:05 CEST 2024
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
testcases/kernel/syscalls/fcntl/fcntl11.c | 16 +-----
testcases/kernel/syscalls/fcntl/fcntl14.c | 50 ++-----------------
testcases/kernel/syscalls/fcntl/fcntl16.c | 29 +----------
testcases/kernel/syscalls/fcntl/fcntl17.c | 59 ++---------------------
testcases/kernel/syscalls/fcntl/fcntl18.c | 10 ----
testcases/kernel/syscalls/fcntl/fcntl19.c | 13 -----
testcases/kernel/syscalls/fcntl/fcntl20.c | 16 +-----
testcases/kernel/syscalls/fcntl/fcntl21.c | 18 +------
8 files changed, 14 insertions(+), 197 deletions(-)
diff --git a/testcases/kernel/syscalls/fcntl/fcntl11.c b/testcases/kernel/syscalls/fcntl/fcntl11.c
index 2ad3aee5e..4fd9fcca9 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl11.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl11.c
@@ -245,10 +245,6 @@ int main(int ac, char **av)
int lc;
tst_parse_opts(ac, av, NULL, NULL);
-#ifdef UCLINUX
- maybe_run_child(&do_child, "ddddd", &parent_pipe[0],
- &parent_pipe[1], &child_pipe[0], &child_pipe[1], &fd);
-#endif
setup(); /* global setup */
@@ -257,17 +253,9 @@ int main(int ac, char **av)
/* reset tst_count in case we are looping */
tst_count = 0;
- if ((child_pid = tst_fork()) == 0) { /* parent */
-#ifdef UCLINUX
- if (self_exec(av[0], "ddddd", parent_pipe[0],
- parent_pipe[1], child_pipe[0],
- child_pipe[1], fd) < 0)
- tst_brkm(TBROK | TERRNO, cleanup,
- "self_exec failed");
-#else
+ if ((child_pid = tst_fork()) == 0) /* parent */
do_child();
-#endif
- } else if (child_pid == -1)
+ else if (child_pid == -1)
tst_brkm(TBROK | TERRNO, cleanup, "fork failed");
SAFE_CLOSE(cleanup, parent_pipe[0]);
diff --git a/testcases/kernel/syscalls/fcntl/fcntl14.c b/testcases/kernel/syscalls/fcntl/fcntl14.c
index 09f5f0954..d38220951 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl14.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl14.c
@@ -547,10 +547,6 @@ char *TCID = "fcntl14";
int TST_TOTAL = 1;
int NO_NFS = 1;
-#ifdef UCLINUX
-static char *argv0;
-#endif
-
void cleanup(void)
{
tst_rmdir();
@@ -745,14 +741,7 @@ void dochild(void)
fail = 1;
break;
case 0:
-#ifdef UCLINUX
- if (self_exec(argv0, "nd", 1, parent) < 0) {
- tst_resm(TFAIL, "self_exec failed");
- break;
- }
-#else
do_usleep_child();
-#endif
break;
default:
@@ -828,19 +817,9 @@ void run_test(int file_flag, int file_mode, int seek, int start, int end)
/* flush the stdout to avoid garbled output */
fflush(stdout);
- if ((child = tst_fork()) == 0) {
-#ifdef UCLINUX
- if (self_exec(argv0, "nddddddddd", 2, thiscase->c_type,
- thiscase->c_whence, thiscase->c_start,
- thiscase->c_len, thiscase->c_flag,
- thiscase->a_type, fd, test, parent) < 0) {
- tst_resm(TFAIL, "self_exec failed");
- cleanup();
- }
-#else
+ if ((child = tst_fork()) == 0)
dochild();
-#endif
- }
+
if (child < 0)
tst_brkm(TBROK|TERRNO, cleanup, "Fork failed");
@@ -943,17 +922,6 @@ int main(int ac, char **av)
int lc;
tst_parse_opts(ac, av, NULL, NULL);
-#ifdef UCLINUX
- argv0 = av[0];
-
- maybe_run_child(&do_usleep_child, "nd", 1, &parent);
- thiscase = malloc(sizeof(testcase));
-
- maybe_run_child(&dochild, "nddddddddd", 2, &thiscase->c_type,
- &thiscase->c_whence, &thiscase->c_start,
- &thiscase->c_len, &thiscase->c_flag, &thiscase->a_type,
- &fd, &test, &parent);
-#endif
setup();
@@ -1079,19 +1047,9 @@ int main(int ac, char **av)
if (sighold(SIGUSR1) < 0)
tst_brkm(TBROK, cleanup, "sighold failed");
- if ((child = tst_fork()) == 0) {
-#ifdef UCLINUX
- if (self_exec(argv0, "nddddddddd", 2, thiscase->c_type,
- thiscase->c_whence, thiscase->c_start,
- thiscase->c_len, thiscase->c_flag,
- thiscase->a_type, fd, test, parent) < 0) {
- tst_resm(TFAIL, "self_exec failed");
- cleanup();
- }
-#else
+ if ((child = tst_fork()) == 0)
dochild();
-#endif
- }
+
if (child < 0)
tst_brkm(TBROK|TERRNO, cleanup, "Fork failed");
diff --git a/testcases/kernel/syscalls/fcntl/fcntl16.c b/testcases/kernel/syscalls/fcntl/fcntl16.c
index 2d895edd2..4ae9e6e7a 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl16.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl16.c
@@ -279,10 +279,6 @@ extern void catch_int(int sig); /* signal catching subroutine */
char *TCID = "fcntl16";
int TST_TOTAL = 1;
-#ifdef UCLINUX
-static char *argv0;
-#endif
-
/*
* cleanup - performs all the ONE TIME cleanup for this test at completion or
* premature exit
@@ -339,15 +335,6 @@ void dochild(int kid)
exit(0);
} /* end of child process */
-#ifdef UCLINUX
-static int kid_uc;
-
-void dochild_uc(void)
-{
- dochild(kid_uc);
-}
-#endif
-
void catch_alarm(int sig)
{
alarm_flag = 1;
@@ -497,17 +484,8 @@ int run_test(int file_flag, int file_mode, int start, int end)
/* spawn child processes */
for (i = 0; i < 2; i++) {
if (thislock->l_type != IGNORED) {
- if ((child = tst_fork()) == 0) {
-#ifdef UCLINUX
- if (self_exec(argv0, "ddddd", i, parent,
- test, thislock, fd) < 0) {
- perror("self_exec failed");
- return 1;
- }
-#else
+ if ((child = tst_fork()) == 0)
dochild(i);
-#endif
- }
if (child < 0) {
perror("Fork failed");
return 1;
@@ -654,11 +632,6 @@ int main(int ac, char **av)
int lc;
tst_parse_opts(ac, av, NULL, NULL);
-#ifdef UCLINUX
- maybe_run_child(dochild_uc, "ddddd", &kid_uc, &parent, &test,
- &thislock, &fd);
- argv0 = av[0];
-#endif
setup(); /* global setup */
diff --git a/testcases/kernel/syscalls/fcntl/fcntl17.c b/testcases/kernel/syscalls/fcntl/fcntl17.c
index 35769579f..5a52f0af3 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl17.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl17.c
@@ -438,23 +438,6 @@ int main(int ac, char **av)
int fail = 0;
tst_parse_opts(ac, av, NULL, NULL);
-#ifdef UCLINUX
- maybe_run_child(&do_child1, "nddddddddd", 1, &file_fd,
- &parent_pipe[0], &parent_pipe[1],
- &child_pipe1[0], &child_pipe1[1],
- &child_pipe2[0], &child_pipe2[1],
- &child_pipe3[0], &child_pipe3[1]);
- maybe_run_child(&do_child2, "nddddddddd", 2, &file_fd,
- &parent_pipe[0], &parent_pipe[1],
- &child_pipe1[0], &child_pipe1[1],
- &child_pipe2[0], &child_pipe2[1],
- &child_pipe3[0], &child_pipe3[1]);
- maybe_run_child(&do_child3, "nddddddddd", 3, &file_fd,
- &parent_pipe[0], &parent_pipe[1],
- &child_pipe1[0], &child_pipe1[1],
- &child_pipe2[0], &child_pipe2[1],
- &child_pipe3[0], &child_pipe3[1]);
-#endif
if (setup()) { /* global testup */
tst_resm(TINFO, "setup failed");
@@ -467,56 +450,22 @@ int main(int ac, char **av)
tst_count = 0;
tst_resm(TINFO, "Enter preparation phase");
- if ((child_pid1 = tst_fork()) == 0) { /* first child */
-#ifdef UCLINUX
- if (self_exec(av[0], "nddddddddd", 1, file_fd,
- parent_pipe[0], parent_pipe[1],
- child_pipe1[0], child_pipe1[1],
- child_pipe2[0], child_pipe2[1],
- child_pipe3[0], child_pipe3[1]) < 0) {
- perror("self_exec failed, child 1");
- cleanup();
- }
-#else
+ if ((child_pid1 = tst_fork()) == 0) /* first child */
do_child1();
-#endif
- } else if (child_pid1 < 0)
+ else if (child_pid1 < 0)
tst_brkm(TBROK|TERRNO, cleanup, "Fork failed: child 1");
/* parent */
- if ((child_pid2 = fork()) == 0) { /* second child */
-#ifdef UCLINUX
- if (self_exec(av[0], "nddddddddd", 2, file_fd,
- parent_pipe[0], parent_pipe[1],
- child_pipe1[0], child_pipe1[1],
- child_pipe2[0], child_pipe2[1],
- child_pipe3[0], child_pipe3[1]) < 0) {
- perror("self_exec failed, child 2");
- cleanup();
- }
-#else
+ if ((child_pid2 = fork()) == 0) /* second child */
do_child2();
-#endif
- } else if (child_pid2 < 0) {
+ else if (child_pid2 < 0)
tst_brkm(TBROK|TERRNO, cleanup, "Fork failed: child 2");
- }
/* parent */
if ((child_pid3 = fork()) == 0) { /* third child */
-#ifdef UCLINUX
- if (self_exec(av[0], "nddddddddd", 3, file_fd,
- parent_pipe[0], parent_pipe[1],
- child_pipe1[0], child_pipe1[1],
- child_pipe2[0], child_pipe2[1],
- child_pipe3[0], child_pipe3[1]) < 0) {
- perror("self_exec failed, child 3");
- cleanup();
- }
-#else
do_child3();
-#endif
do_child3();
} else if (child_pid3 < 0) {
tst_brkm(TBROK|TERRNO, cleanup, "Fork failed: child 3");
diff --git a/testcases/kernel/syscalls/fcntl/fcntl18.c b/testcases/kernel/syscalls/fcntl/fcntl18.c
index 6bf39b981..7a26f65a2 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl18.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl18.c
@@ -70,8 +70,6 @@ int main(int ac, char **av)
setup(); /* global setup */
/* //block1: */
-#ifndef UCLINUX
- /* Skip since uClinux does not implement memory protection */
tst_resm(TINFO, "Enter block 1");
fail = 0;
if ((fd = open("temp.dat", O_CREAT | O_RDWR, 0777)) < 0) { //mode must be specified when O_CREATE is in the flag
@@ -93,13 +91,8 @@ int main(int ac, char **av)
tst_resm(TINFO, "Block 1 PASSED");
}
tst_resm(TINFO, "Exit block 1");
-#else
- tst_resm(TINFO, "Skip block 1 on uClinux");
-#endif
/* //block2: */
-#ifndef UCLINUX
- /* Skip since uClinux does not implement memory protection */
tst_resm(TINFO, "Enter block 2");
fail = 0;
/* Error condition if address is bad */
@@ -116,9 +109,6 @@ int main(int ac, char **av)
tst_resm(TINFO, "Block 2 PASSED");
}
tst_resm(TINFO, "Exit block 2");
-#else
- tst_resm(TINFO, "Skip block 2 on uClinux");
-#endif
/* //block3: */
tst_resm(TINFO, "Enter block 3");
diff --git a/testcases/kernel/syscalls/fcntl/fcntl19.c b/testcases/kernel/syscalls/fcntl/fcntl19.c
index 368629d25..a58e921c3 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl19.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl19.c
@@ -284,10 +284,6 @@ int main(int ac, char **av)
int lc;
tst_parse_opts(ac, av, NULL, NULL);
-#ifdef UCLINUX
- maybe_run_child(&do_child, "ddddd", &parent_pipe[0], &parent_pipe[1],
- &child_pipe[0], &child_pipe[1], &fd);
-#endif
setup(); /* global setup */
@@ -297,16 +293,7 @@ int main(int ac, char **av)
tst_count = 0;
if ((child_pid = tst_fork()) == 0) { /* child */
-#ifdef UCLINUX
- if (self_exec
- (av[0], "ddddd", parent_pipe[0], parent_pipe[1],
- child_pipe[0], child_pipe[1], fd) < 0) {
- tst_resm(TFAIL, "self_exec failed");
- cleanup();
- }
-#else
do_child();
-#endif
} else if (child_pid < 0) {
tst_resm(TFAIL, "Fork failed");
cleanup();
diff --git a/testcases/kernel/syscalls/fcntl/fcntl20.c b/testcases/kernel/syscalls/fcntl/fcntl20.c
index 0865140de..f271eeb2d 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl20.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl20.c
@@ -283,10 +283,6 @@ int main(int ac, char **av)
int lc;
tst_parse_opts(ac, av, NULL, NULL);
-#ifdef UCLINUX
- maybe_run_child(&do_child, "ddddd", &parent_pipe[0], &parent_pipe[1],
- &child_pipe[0], &child_pipe[1], &fd);
-#endif
setup(); /* global setup */
@@ -295,18 +291,8 @@ int main(int ac, char **av)
/* reset tst_count in case we are looping */
tst_count = 0;
- if ((child_pid = tst_fork()) == 0) { /* child */
-#ifdef UCLINUX
- if (self_exec
- (av[0], "ddddd", parent_pipe[0], parent_pipe[1],
- child_pipe[0], child_pipe[1], fd) < 0) {
- tst_resm(TFAIL, "self_exec failed");
- cleanup();
- }
-#else
+ if ((child_pid = tst_fork()) == 0) /* child */
do_child();
-#endif
- }
if (child_pid < 0) {
tst_resm(TFAIL, "Fork failed");
diff --git a/testcases/kernel/syscalls/fcntl/fcntl21.c b/testcases/kernel/syscalls/fcntl/fcntl21.c
index d191a6bbd..a262ae8dd 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl21.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl21.c
@@ -291,11 +291,6 @@ int main(int ac, char **av)
int lc;
tst_parse_opts(ac, av, NULL, NULL);
-#ifdef UCLINUX
- maybe_run_child(&do_child, "ddddd", &parent_pipe[0], &parent_pipe[1],
- &child_pipe[0], &child_pipe[1], &fd);
-#endif
-
setup(); /* global setup */
/* Check for looping state if -i option is given */
@@ -303,18 +298,9 @@ int main(int ac, char **av)
/* reset tst_count in case we are looping */
tst_count = 0;
- if ((child_pid = tst_fork()) == 0) {
-#ifdef UCLINUX
- if (self_exec
- (av[0], "ddddd", parent_pipe[0], parent_pipe[1],
- child_pipe[0], child_pipe[1], fd) < 0) {
- tst_resm(TFAIL, "self_exec failed");
- cleanup();
- }
-#else
+ if ((child_pid = tst_fork()) == 0)
do_child();
-#endif
- }
+
if (child_pid < 0) {
tst_resm(TFAIL, "Fork failed");
cleanup();
--
2.43.0
More information about the ltp
mailing list