aboutsummaryrefslogtreecommitdiffstats
path: root/qtest/bin
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2018-10-13 20:37:44 +0200
committerJay Berkenbilt <ejb@ql.org>2018-10-14 00:31:58 +0200
commit16b7182d91c8e5071656b7a8b9f73d13e41099ea (patch)
treea41fdd3578efe95020fbcb8584d8281d85061992 /qtest/bin
parentdbeef33ee482279013eb672e3ac99412057ab46b (diff)
downloadqpdf-16b7182d91c8e5071656b7a8b9f73d13e41099ea.tar.zst
Upgrade qtest to 1.5
Diffstat (limited to 'qtest/bin')
-rwxr-xr-xqtest/bin/qtest-driver47
1 files changed, 45 insertions, 2 deletions
diff --git a/qtest/bin/qtest-driver b/qtest/bin/qtest-driver
index 5f3b0152..11ab7518 100755
--- a/qtest/bin/qtest-driver
+++ b/qtest/bin/qtest-driver
@@ -2,7 +2,7 @@
#
# This file is part of qtest.
#
-# Copyright 1993-2007, Jay Berkenbilt
+# Copyright 1993-2018, Jay Berkenbilt
#
# QTest is distributed under the terms of version 2.0 of the Artistic
# license which may be found in the source distribution.
@@ -33,7 +33,7 @@ require TestDriver;
if ((@ARGV == 1) && ($ARGV[0] eq '--version'))
{
- print "$whoami version 1.4\n";
+ print "$whoami version 1.5\n";
exit 0;
}
if ((@ARGV == 1) && ($ARGV[0] eq '--print-path'))
@@ -46,6 +46,7 @@ my @bindirs = ();
my $datadir = undef;
my $covdir = '.';
my $stdout_tty = (-t STDOUT) ? "1" : "0";
+my $junit_suffix = "";
while (@ARGV)
{
@@ -69,6 +70,11 @@ while (@ARGV)
{
$stdout_tty = $1;
}
+ elsif ($arg eq '-junit-suffix')
+ {
+ usage() unless @ARGV;
+ $junit_suffix = "-" . shift(@ARGV);
+ }
else
{
usage();
@@ -159,8 +165,10 @@ elsif (@testcov)
my $testlogfile = 'qtest.log';
my $testxmlfile = 'qtest-results.xml';
+my $testjunitfile = "TEST-qtest$junit_suffix.xml";
unlink $testlogfile;
unlink $testxmlfile;
+unlink $testjunitfile;
my $totmissing = 0;
my $totextra = 0;
@@ -208,10 +216,13 @@ if (defined $tc_log)
print_xml(" coverage-scope=\"$tc_scope\"");
}
print_xml(">\n");
+print_junit("<?xml version=\"1.0\"?>\n" .
+ "<testsuites>\n");
foreach my $test (@tests)
{
print_and_log("\nRunning $test\n");
print_xml(" <testsuite file=\"$test\">\n");
+ print_junit(" <testsuite name=\"$test\">\n");
my @results = run_test($test);
if (scalar(@results) != 5)
{
@@ -263,6 +274,7 @@ foreach my $test (@tests)
print_xml(" />\n");
}
print_xml(" </testsuite>\n");
+ print_junit(" </testsuite>\n");
}
my $coverage_okay = 1;
@@ -317,6 +329,7 @@ if (defined $tc_log)
}
print_xml(" />\n" .
"</qtest-results>\n");
+print_junit("</testsuites>\n");
exit ($okay ? 0 : 2);
@@ -408,6 +421,7 @@ sub run_test
'-tempdir', $tempdir,
'-testlog', "$cwd/$testlogfile",
'-testxml', "$cwd/$testxmlfile",
+ '-testjunit', "$cwd/$testjunitfile",
"-stdout-tty=$stdout_tty") or
fatal("exec $prog failed: $!");
}
@@ -668,15 +682,22 @@ sub tc_do_final_checks
if (@problems)
{
my $testxml = open_xml();
+ my $testjunit = open_junit();
$testxml->print(" <coverage-errors count=\"" .
scalar(@problems) . "\">\n");
+ $testjunit->print(" <testsuite name=\"coverage\">\n");
foreach my $p (@problems)
{
$testlog->print("$p\n");
$testxml->print(" <coverage-error case=\"$p\"/>\n");
+ $testjunit->print(" <testcase name=\"$p\">\n" .
+ " <failure message=\"$p\"/>\n" .
+ " </testcase>\n");
}
$testxml->print(" </coverage-errors>\n");
$testxml->close();
+ $testjunit->print(" </testsuite>\n");
+ $testjunit->close();
$testlog->print("coverage errors: " . scalar(@problems) . "\n");
}
my $passed = (@problems == 0);
@@ -718,6 +739,11 @@ sub open_xml
open_binary($testxmlfile);
}
+sub open_junit
+{
+ open_binary($testjunitfile);
+}
+
sub print_and_log
{
my $fh = open_log();
@@ -733,6 +759,13 @@ sub print_xml
$fh->close();
}
+sub print_junit
+{
+ my $fh = open_junit();
+ print $fh @_;
+ $fh->close();
+}
+
sub print_and_pad
{
TestDriver::print_and_pad(@_);
@@ -784,6 +817,7 @@ Options include:
-bindirs bindir[:bindir...]
[ -covdir [coverage-dir] ]
[ -stdout-tty=[01] ]
+ [ -junit-suffix suffix ]
Subsidiary test programs are run with the -bindirs argument (a
colon-separated list of directories, which may be relative but will be
@@ -809,6 +843,15 @@ determination of whether standard output is a terminal. This can be
useful for cases in which another program is invoking ${whoami} and
passing its output through a pipe to a terminal.
+Qtest writes its results to qtest.log, qtest-results.xml, and
+TEST-qtest.xml. The TEST-qtest.xml file is compatible with JUnit's
+test ouput, which makes it useful for many continuous integration
+systems. The test output information in that file is not quite as rich
+as in qtest-results.xml, but it is good enough for most purposes. If
+you want your JUnit-compatible results file to have a different name,
+pass -junit-suffix yoursuffix. This will change the name to
+TEST-qtest-yoursuffix.xml.
+
";
exit 2;