aboutsummaryrefslogtreecommitdiffstats
path: root/qtest
diff options
context:
space:
mode:
authorThorsten Schöning <tschoening@users.noreply.github.com>2015-11-19 16:07:56 +0100
committerJay Berkenbilt <ejb@ql.org>2016-01-24 17:58:33 +0100
commitd4043604618eaaaac9e24f72177eb94640b6f1f4 (patch)
treeeb1a278e0ce608a72cc0bb54a29c098cc9a52c47 /qtest
parent15502013a9c88939919ed2c7ceb55cd3528fc21c (diff)
downloadqpdf-d4043604618eaaaac9e24f72177eb94640b6f1f4.tar.zst
From qtest: add RM_WS_ONLY_LINES option
qutil.cc uses strerror to print some exceptions and adds a newline afterwards, but strerror in Windows already adds one newline at the end of the message and the additional one from std::endl breaks the output vs. the expected one.
Diffstat (limited to 'qtest')
-rw-r--r--qtest/module/TestDriver.pm22
1 files changed, 19 insertions, 3 deletions
diff --git a/qtest/module/TestDriver.pm b/qtest/module/TestDriver.pm
index 117e72c6..ca083e56 100644
--- a/qtest/module/TestDriver.pm
+++ b/qtest/module/TestDriver.pm
@@ -65,9 +65,10 @@ use constant TD_THREADS => 'TD_THREADS';
use constant TD_SEQGROUPS => 'TD_SEQGROUPS';
# Flags
-use constant NORMALIZE_NEWLINES => 1 << 0;
+use constant NORMALIZE_NEWLINES => 1 << 0;
use constant NORMALIZE_WHITESPACE => 1 << 1;
-use constant EXPECT_FAILURE => 1 << 2;
+use constant EXPECT_FAILURE => 1 << 2;
+use constant RM_WS_ONLY_LINES => 1 << 3;
# Field names
use vars qw($f_socket $f_origdir $f_tempdir $f_testlog $f_testxml $f_suitename);
@@ -436,7 +437,7 @@ sub prompt
print "To avoid question, place answer in" .
" environment variable \$$env\n";
# Note: ActiveState perl 5.10.1 gives the wrong answer for -t
- # STDIN.
+ # STDIN when NUL (http://bugs.activestate.com/show_bug.cgi?id=85614).
if ((-t STDIN) && (-t STDOUT))
{
print "$msg ";
@@ -551,6 +552,12 @@ sub get_start_dir
# place-holder test cases that exercise a known bug that cannot
# yet be fixed.
+# RM_WS_ONLY_LINES: If specified, all lines only containing any
+# whitespace character like newlines, spaces or tabs are removed
+# from the input. This is done before writing through any filter
+# and is especially useful if some tests output more newlines on
+# some platforms than on others.
+
sub runtest
{
my $rep = shift;
@@ -818,6 +825,15 @@ sub runtest
{
&QTC::TC("testdriver", "TestDriver no normalize newlines");
}
+ if ($flags & $rep->RM_WS_ONLY_LINES)
+ {
+ &QTC::TC("testdriver", "TestDriver remove empty lines");
+ $line =~ s/^\s+$//;
+ }
+ else
+ {
+ &QTC::TC("testdriver", "TestDriver no remove empty lines");
+ }
$actual->print($line);
$actual->flush();
last if defined $exit_status;