TestHelpers: report Python errors

If web.py (or other program) prints the name of a log file, log the
contents of that file.

Also, turn up verbosity in t/400-web.t.
This commit is contained in:
Chris White 2020-05-25 14:34:01 -04:00
parent a4150aad3f
commit 53bce3913f
2 changed files with 18 additions and 3 deletions

View file

@ -40,14 +40,14 @@ diag $tenv->report;
http_request_ok 'index query', $tenv, '/testproj/latest/source',
[ qr{^Content-Type:\s*text/html}, qr{href="latest/source/issue102.c"},
qr{href="latest/source/arch"} ];
qr{href="latest/source/arch"} ], 1;
http_request_ok 'identifier query', $tenv, '/testproj/v5.4/ident/gsb_buffer',
[ qr{^Content-Type:\s*text/html}, qr{\bgsb_buffer\b},
qr{"v5.4/source/drivers/i2c/i2c-core-acpi.c\#L23".+?
drivers/i2c/i2c-core-acpi.c.+?
line[ ]23.+?
\bstruct\b}x ];
\bstruct\b}x ], 1;
# Doc comments: testcases pulled from t/300
http_request_ok 'doc-comment query (nonexistent)', $tenv,

View file

@ -304,6 +304,22 @@ sub _check_queries {
diag "@outlines";
}
# Check for and report Python errors
foreach(@outlines, @errlines) {
if (/^.*?(\S+)\s+contains the description of this error/) {
my $logfn = $1;
no autodie;
open my $logfh, '<', $logfn
or warn("Could not open Python log file $logfn: $!"), last;
my $logtext = do { local $/; <$logfh> };
close $logfh;
diag "Python error log $logfn:\n$logtext";
last;
}
}
# Basic checks
if($mustSucceed) {
eval line_mark_string 2, <<'EOT';
@ -335,7 +351,6 @@ EOT
$test .= ($negated ? ' excludes ' : ' includes ') . "\Q$re\E" . '");';
# Run it
#diag "Running $test";
eval line_mark_string 2, $test;
die $@ if $@;
} #foreach $entry