* [LTP] [PATCH 1/2] lib/tst_test.c: propagate TBROK retcode in library process
@ 2016-06-08 15:03 Jan Stancek
2016-06-08 15:03 ` [LTP] [PATCH 2/2] lib/tst_test.c: do all cleanup in do_exit Jan Stancek
0 siblings, 1 reply; 4+ messages in thread
From: Jan Stancek @ 2016-06-08 15:03 UTC (permalink / raw)
To: ltp
From: Cyril Hrubis <chrubis@suse.cz>
Previous patch caused, that 0 would be returned as ret code
if library process hit a TBROK. It also missed that there are
other places where library can exit by calling exit().
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Acked-by: Jan Stancek <jstancek@redhat.com>
---
lib/tst_test.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/lib/tst_test.c b/lib/tst_test.c
index f7485bd33082..6e6d41738ebb 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -64,7 +64,7 @@ char *const tst_ipc_envp[] = {ipc_path, NULL};
static char shm_path[1024];
-static void do_exit(void) __attribute__ ((noreturn));
+static void do_exit(int ret) __attribute__ ((noreturn));
static void setup_ipc(void)
{
@@ -237,7 +237,7 @@ void tst_vbrk_(const char *file, const int lineno, int ttype,
do_test_cleanup();
if (getpid() == lib_pid)
- do_exit();
+ do_exit(TTYPE_RESULT(ttype));
exit(TTYPE_RESULT(ttype));
}
@@ -443,10 +443,8 @@ static void parse_opts(int argc, char *argv[])
}
-static void do_exit(void)
+static void do_exit(int ret)
{
- int ret = 0;
-
printf("\nSummary:\n");
printf("passed %d\n", results->passed);
printf("failed %d\n", results->failed);
@@ -719,7 +717,7 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
do_cleanup();
if (WIFEXITED(status) && WEXITSTATUS(status))
- exit(WEXITSTATUS(status));
+ do_exit(WEXITSTATUS(status));
if (WIFSIGNALED(status) && WTERMSIG(status) == SIGKILL) {
tst_res(TINFO, "If you are running on slow machine, "
@@ -730,5 +728,5 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
if (WIFSIGNALED(status))
tst_brk(TBROK, "Test killed by %s!", tst_strsig(WTERMSIG(status)));
- do_exit();
+ do_exit(0);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [LTP] [PATCH 2/2] lib/tst_test.c: do all cleanup in do_exit
2016-06-08 15:03 [LTP] [PATCH 1/2] lib/tst_test.c: propagate TBROK retcode in library process Jan Stancek
@ 2016-06-08 15:03 ` Jan Stancek
2016-06-08 16:25 ` Cyril Hrubis
0 siblings, 1 reply; 4+ messages in thread
From: Jan Stancek @ 2016-06-08 15:03 UTC (permalink / raw)
To: ltp
Since previous patch, library process can exit only by calling
do_exit(). This patch moves all cleanup to do_cleanup(),
which is called only from a single place at do_exit().
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
lib/tst_test.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 6e6d41738ebb..9f9a41b20919 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -64,6 +64,7 @@ char *const tst_ipc_envp[] = {ipc_path, NULL};
static char shm_path[1024];
+static void do_cleanup(void);
static void do_exit(int ret) __attribute__ ((noreturn));
static void setup_ipc(void)
@@ -460,7 +461,7 @@ static void do_exit(int ret)
if (results->warnings)
ret |= TWARN;
- cleanup_ipc();
+ do_cleanup();
exit(ret);
}
@@ -577,6 +578,8 @@ static void do_cleanup(void)
tst_futexes = NULL;
tst_rmdir();
}
+
+ cleanup_ipc();
}
static void run_tests(void)
@@ -714,8 +717,6 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
alarm(0);
- do_cleanup();
-
if (WIFEXITED(status) && WEXITSTATUS(status))
do_exit(WEXITSTATUS(status));
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-06-09 6:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-08 15:03 [LTP] [PATCH 1/2] lib/tst_test.c: propagate TBROK retcode in library process Jan Stancek
2016-06-08 15:03 ` [LTP] [PATCH 2/2] lib/tst_test.c: do all cleanup in do_exit Jan Stancek
2016-06-08 16:25 ` Cyril Hrubis
2016-06-09 6:54 ` Jan Stancek
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.