[LTP] LTP in valgrind :)
Petr Vorel
pvorel@suse.cz
Tue May 6 10:25:38 CEST 2025
Hi Cyril,
> 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:
Agree. I sometimes think JSON output would be useful to be even in core LTP
(not requiring kirk), but that's something different than reproducible output.
The patch above LGTM (if you send patch please remember to update
doc/users/setup_tests.rst).
Kind regards,
Petr
> 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);
More information about the ltp
mailing list