[LTP] LTP in valgrind :)
Cyril Hrubis
chrubis@suse.cz
Tue May 6 10:03:20 CEST 2025
Hi!
> > It also opens some interesting questions, i.e. how do we make comparing
> > results from two different tests easier. Currently they grep the test
> > results for a summary, but maybe we can do better.
>
> Kirk and compare json?
That does sound like an overkill for something that is basically:
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 694861d95..29d9fc1d5 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -64,6 +64,7 @@ static int mntpoint_mounted;
static int ovl_mounted;
static struct timespec tst_start_time; /* valid only for test pid */
static int tdebug;
+static int reproducible_output;
struct results {
int passed;
@@ -299,6 +300,9 @@ static void print_result(const char *file, const int lineno, int ttype,
str += ret;
size -= ret;
+ if (reproducible_output)
+ goto print;
+
if (tst_color_enabled(STDERR_FILENO))
ret = snprintf(str, size, "%s%s: %s", tst_ttype2color(ttype),
res, ANSI_COLOR_RESET);
@@ -324,6 +328,7 @@ static void print_result(const char *file, const int lineno, int ttype,
"Next message is too long and truncated:");
}
+print:
snprintf(str, size, "\n");
/* we might be called from signal handler, so use write() */
@@ -1273,6 +1278,8 @@ static void do_setup(int argc, char *argv[])
if (tst_test->tconf_msg)
tst_brk(TCONF, "%s", tst_test->tconf_msg);
+ reproducible_output = !!getenv("LTP_REPRODUCIBLE_OUTPUT");
+
assert_test_fn();
TCID = tid = get_tid(argv);
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list