Skip to content

Commit

Permalink
Disable failure hints before we actually run the test
Browse files Browse the repository at this point in the history
This is patch based on a suggestion from Peter Vorel:

http://patchwork.ozlabs.org/project/ltp/patch/[email protected]/

Peter proposed not to print failure hints (the tags) if we fail to
acquire the device. This patch extends it for the whole test library
intialization and enables the failure hints right before we jump into
the test function.

Signed-off-by: Cyril Hrubis <[email protected]>
Acked-by: Andrea Cervesato <[email protected]>
Reviewed-by: Li Wang <[email protected]>
  • Loading branch information
metan-ucw committed Oct 1, 2024
1 parent fe940d5 commit 701212f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/tst_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,8 @@ static void print_failure_hint(const char *tag, const char *hint,
}
}

static int show_failure_hints;

/* update also docparse/testinfo.pl */
static void print_failure_hints(void)
{
Expand All @@ -919,7 +921,8 @@ static void do_exit(int ret)

if (results->failed) {
ret |= TFAIL;
print_failure_hints();
if (show_failure_hints)
print_failure_hints();
}

if (results->skipped && !results->passed)
Expand All @@ -930,7 +933,8 @@ static void do_exit(int ret)

if (results->broken) {
ret |= TBROK;
print_failure_hints();
if (show_failure_hints)
print_failure_hints();
}

fprintf(stderr, "\nSummary:\n");
Expand Down Expand Up @@ -1723,6 +1727,8 @@ static int fork_testrun(void)

alarm(results->timeout);

show_failure_hints = 1;

test_pid = fork();
if (test_pid < 0)
tst_brk(TBROK | TERRNO, "fork()");
Expand Down

0 comments on commit 701212f

Please sign in to comment.