mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-04-23 19:10:44 +02:00
Improve test HTML generation:
- Make "make retest" not generate all .log files. - Format improvements in the generated HTML file.
This commit is contained in:
parent
f79a9f5a52
commit
0ac2bbbf52
3 changed files with 55 additions and 37 deletions
|
|
@ -481,26 +481,37 @@ CLEANFILES = \
|
|||
check-valgrind:
|
||||
$(MAKE) check TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) $(top_srcdir)/libtool --mode=execute valgrind --tool=memcheck --suppressions=./.valgrind-suppressions --leak-check=yes --show-reachable=yes' 2>&1 | tee valgrind-log
|
||||
|
||||
# The following definitions both should work.
|
||||
#FAILED_TESTS = `grep -l '\<FAIL\>' $(TESTS:=.log) | sed -e 's/[.]log$$//' | xargs echo`
|
||||
FAILED_TESTS = `grep -l '\<FAIL\>' $(TESTS:=.log) | tr '\n' ' ' | sed -e 's/[.]log */ /g; s/^ //; s/ $$//'`
|
||||
|
||||
recheck = check TESTS="$(FAILED_TESTS)"
|
||||
|
||||
# Re-checks all failed tests, i.e. tests with a log file that has a failure
|
||||
recheck:
|
||||
@echo Re-checking failed tests
|
||||
@$(MAKE) check TESTS="`grep -l '\<FAIL\>' *.log | sed 's/[.]log$$//' | tr '\n' ' '`"
|
||||
@$(MAKE) $(recheck)
|
||||
|
||||
# Checks tests and creates index.html.
|
||||
# Target doesn't fail if tests fail.
|
||||
test:
|
||||
@-$(MAKE) check
|
||||
@$(MAKE) html
|
||||
@$(MAKE) check; \
|
||||
$(MAKE) html
|
||||
|
||||
# Re-checks tests and creates index.html.
|
||||
# Target doesn't fail if tests fail.
|
||||
retest:
|
||||
@-$(MAKE) recheck
|
||||
@$(MAKE) html
|
||||
@TESTS="$(FAILED_TESTS)"; \
|
||||
$(MAKE) TESTS="$$TESTS" check; \
|
||||
$(MAKE) TESTS="$$TESTS" html
|
||||
|
||||
# Make index.html
|
||||
html: index.html
|
||||
|
||||
# Make index.html containing only the failed tests.
|
||||
rehtml:
|
||||
@$(MAKE) TESTS="$(FAILED_TESTS)" html
|
||||
|
||||
|
||||
$(TESTS): $(SUPPORT_PROGS)
|
||||
|
||||
|
|
@ -512,8 +523,8 @@ NOLOG_TESTS_LOG = $(NOLOG_TESTS:=.log)
|
|||
$(NOLOG_TESTS_LOG):
|
||||
echo dummy > $@
|
||||
|
||||
index.html: $(TESTS:=.log)
|
||||
index.html: $(srcdir)/make-html.pl $(TESTS:=.log)
|
||||
@echo Creating index.html
|
||||
@perl $(srcdir)/make-html.pl > index.html
|
||||
@perl $^ > index.html
|
||||
|
||||
.PHONY: check-valgrind test recheck retest html
|
||||
.PHONY: check-valgrind test recheck retest html rehtml
|
||||
|
|
|
|||
|
|
@ -1799,7 +1799,7 @@ cairo_test_expecting (cairo_test_t *test,
|
|||
|
||||
while (*tname) {
|
||||
int found = 0;
|
||||
char *end = strpbrk (tname, " \t\r\n;:,");
|
||||
const char *end = strpbrk (tname, " \t\r\n;:,");
|
||||
if (!end)
|
||||
end = tname + strlen (tname);
|
||||
|
||||
|
|
@ -1814,8 +1814,7 @@ cairo_test_expecting (cairo_test_t *test,
|
|||
}
|
||||
|
||||
if (!found) {
|
||||
*end = '\0';
|
||||
fprintf (stderr, "Cannot test target '%s'\n", tname);
|
||||
fprintf (stderr, "Cannot test target '%.*s'\n", end - tname, tname);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
|
@ -1935,21 +1934,22 @@ cairo_test_status_t
|
|||
cairo_test (cairo_test_t *test)
|
||||
{
|
||||
cairo_test_status_t expectation = CAIRO_TEST_SUCCESS;
|
||||
char *xfails;
|
||||
const char *xfails;
|
||||
|
||||
if ((xfails = getenv ("CAIRO_XFAIL_TESTS")) != NULL) {
|
||||
while (*xfails) {
|
||||
char *end = strpbrk (xfails, " \t\r\n;:,");
|
||||
const char *end = strpbrk (xfails, " \t\r\n;:,");
|
||||
if (!end)
|
||||
end = xfails + strlen (xfails);
|
||||
else
|
||||
*end++ = '\0';
|
||||
|
||||
if (0 == strcmp (test->name, xfails)) {
|
||||
if (0 == strncmp (test->name, xfails, end - xfails) &&
|
||||
'\0' == test->name[end - xfails]) {
|
||||
expectation = CAIRO_TEST_FAILURE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (*end)
|
||||
end++;
|
||||
xfails = end;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,8 +25,9 @@
|
|||
#
|
||||
|
||||
##
|
||||
## Takes all the *.log files in the current directory and spits out
|
||||
## html to stdout that can be used to view all the test results at once.
|
||||
## Takes all the *.log files in the current directory (or those provided
|
||||
## on the command line) and spits out html to stdout that can be used to
|
||||
## view all the test results at once.
|
||||
##
|
||||
|
||||
# show reference images
|
||||
|
|
@ -53,7 +54,7 @@ foreach (<*.log>) {
|
|||
$tests->{$1}->{$2}->{$3} = {} unless $tests->{$1}->{$2}->{$3};
|
||||
$tests->{$1}->{$2}->{$3}->{$4} = $5;
|
||||
|
||||
$teststats->{$2} = {"PASS" => 0, "FAIL" => 0, "XFAIL" => 0, "UNTESTED" => 0}
|
||||
$teststats->{$2} = {"PASS" => 0, "FAIL" => 0, "XFAIL" => 0, "UNTESTED" => 0, "CRASHED" =>0}
|
||||
unless $teststats->{$2};
|
||||
($teststats->{$2}->{$5})++;
|
||||
}
|
||||
|
|
@ -92,16 +93,18 @@ sub printl {
|
|||
printl '<html><head>';
|
||||
printl '<title>Cairo Test Results</title>';
|
||||
printl '<style type="text/css">';
|
||||
printl 'a img { border: none; }';
|
||||
printl '.PASS { background-color: #009900; min-width: 1em; }';
|
||||
printl '.FAIL { background-color: #990000; }';
|
||||
printl '.XFAIL { background-color: #999900; }';
|
||||
printl '.UNTESTED { background-color: #333333; }';
|
||||
printl '.PASSstr { color: #009900; }';
|
||||
printl '.FAILstr { color: #990000; }';
|
||||
printl '.XFAILstr { color: #999900; }';
|
||||
printl '.UNTESTEDstr { color: #333333; }';
|
||||
printl 'img { max-width: 15em; min-width: 3em; }';
|
||||
printl 'a img { border: solid 1px #FFF; }';
|
||||
printl '.PASS { background-color: #0D0; min-width: 1em; }';
|
||||
printl '.FAIL { background-color: #D00; }';
|
||||
printl '.XFAIL { background-color: #DD0; }';
|
||||
printl '.UNTESTED { background-color: #666; }';
|
||||
printl '.CRASHED { background-color: #F00; color: #FF0; }';
|
||||
printl '.PASSstr { color: #0D0; }';
|
||||
printl '.FAILstr { color: #E00; }';
|
||||
printl '.XFAILstr { color: #DD0; }';
|
||||
printl '.CRASHEDstr { color: #F00; }';
|
||||
printl '.UNTESTEDstr { color: #666; }';
|
||||
printl 'img { max-width: 15em; min-width: 3em; margin: 3px; }';
|
||||
printl 'td { vertical-align: top; }';
|
||||
printl '</style>';
|
||||
printl '<body>';
|
||||
|
|
@ -121,7 +124,7 @@ print '<td></td>' if $config_show_ref;
|
|||
foreach my $target (@targets) {
|
||||
print '<td>';
|
||||
print '<span class="PASSstr">', $teststats->{$target}->{"PASS"}, '</span>/';
|
||||
print '<span class="FAILstr">', $teststats->{$target}->{"FAIL"}, '</span>/';
|
||||
print '<span class="FAILstr">', $teststats->{$target}->{"FAIL"} + $teststats->{$target}->{"CRASHED"}, '</span>/';
|
||||
print '<span class="XFAILstr">', $teststats->{$target}->{"XFAIL"}, '</span>/';
|
||||
print '<span class="UNTESTEDstr">', $teststats->{$target}->{"UNTESTED"}; '</span>';
|
||||
print '</td>';
|
||||
|
|
@ -160,8 +163,6 @@ foreach my $test (sort(keys %$tests)) {
|
|||
foreach my $format (@formats) {
|
||||
my $testline = "";
|
||||
|
||||
my $num_failed = 0;
|
||||
|
||||
foreach my $target (@targets) {
|
||||
my $tgtdata = $tests->{$test}->{$target};
|
||||
if ($tgtdata) {
|
||||
|
|
@ -175,21 +176,27 @@ foreach my $test (sort(keys %$tests)) {
|
|||
$testline .= "<a href=\"" . $testfiles{"out"} . "\"><img src=\"" . $testfiles{"out"} . "\"></a>";
|
||||
}
|
||||
} elsif ($testres eq "FAIL") {
|
||||
$num_failed++;
|
||||
|
||||
if ($config_show_fail || $config_show_all) {
|
||||
$testline .= "<a href=\"" . $testfiles{"out"} . "\"><img src=\"" . $testfiles{"out"} . "\"></a>";
|
||||
$testline .= "<hr size=\"1\">";
|
||||
#$testline .= "<hr size=\"1\">";
|
||||
$testline .= " ";
|
||||
$testline .= "<a href=\"" . $testfiles{"diff"} . "\"><img src=\"" . $testfiles{"diff"} . "\"></a>";
|
||||
}
|
||||
} elsif ($testres eq "CRASHED") {
|
||||
$testline .= "!!!CRASHED!!!";
|
||||
} elsif ($testres eq "XFAIL") {
|
||||
#nothing
|
||||
if ($config_show_all) {
|
||||
$testline .= "<a href=\"" . $testfiles{"out"} . "\"><img src=\"" . $testfiles{"out"} . "\"></a>";
|
||||
$testline .= "<hr size=\"1\">";
|
||||
#$testline .= "<hr size=\"1\">";
|
||||
$testline .= " ";
|
||||
$testline .= "<a href=\"" . $testfiles{"diff"} . "\"><img src=\"" . $testfiles{"diff"} . "\"></a>";
|
||||
}
|
||||
}
|
||||
} elsif ($testres eq "UNTESTED") {
|
||||
#nothing
|
||||
} else {
|
||||
$testline .= "UNSUPPORTED STATUS (update make-html.pl)";
|
||||
}
|
||||
|
||||
$testline .= "</td>";
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue