mirror of
https://github.com/containers/podman.git
synced 2025-05-19 16:18:51 +08:00
bats log: differentiate parallel tests from sequential
For tests run in parallel, show file number as |nnn| (vs [nnn]) Teach logformatter to distinguish the two, adding 'p' to anchors in parallel tests. Necessary because in this scheme we run bats twice, thus see 'ok 1' twice, and we want to differentiate them. Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@ -349,7 +349,7 @@ END_HTML
|
||||
# BATS handling. This will recognize num_tests both at start and end
|
||||
if ($line =~ /^1\.\.(\d+)$/) {
|
||||
$looks_like_bats = 1;
|
||||
$bats_count{expected_total} = $1;
|
||||
$bats_count{expected_total} += $1;
|
||||
undef $looks_like_python;
|
||||
}
|
||||
# Since the number of tests can't always be predicted, recognize
|
||||
@ -445,9 +445,14 @@ END_HTML
|
||||
if ($css) {
|
||||
# Make it linkable, e.g. foo.html#t--00001
|
||||
if ($line =~ /^(not\s+)?ok\s+(\d+)\s+(.*)/) {
|
||||
$line = sprintf("<a name='t--%05d'>%s</a>", $2, $line);
|
||||
my ($notok, $num, $name) = ($1, $2, $3);
|
||||
# Parallel system tests are shown as |nnn| instead of [nnn]
|
||||
my $p = '';
|
||||
$p = 'p' if $name =~ /^\s*\|\d+\|/;
|
||||
|
||||
push @{$bats_count{__fail_list}}, [ $2, $3 ] if $1;
|
||||
$line = sprintf("<a name='t--%05d%s'>%s</a>", $num, $p, $line);
|
||||
|
||||
push @{$bats_count{__fail_list}}, [ $num, $name ] if $notok;
|
||||
}
|
||||
$bats_count{$css}++;
|
||||
$css = "bats-$css";
|
||||
|
@ -160,7 +160,12 @@ function basic_setup() {
|
||||
|
||||
# Test filenames must match ###-name.bats; use "[###] " as prefix
|
||||
run expr "$BATS_TEST_FILENAME" : "^.*/\([0-9]\{3\}\)-[^/]\+\.bats\$"
|
||||
BATS_TEST_NAME_PREFIX="[${output}] "
|
||||
# If parallel, use |nnn|. Serial, [nnn]
|
||||
if [[ -n "$PARALLEL_JOBSLOT" ]]; then
|
||||
BATS_TEST_NAME_PREFIX="|${output}| "
|
||||
else
|
||||
BATS_TEST_NAME_PREFIX="[${output}] "
|
||||
fi
|
||||
|
||||
# By default, assert() and die() cause an immediate test failure.
|
||||
# Under special circumstances (usually long test loops), tests
|
||||
|
Reference in New Issue
Block a user