summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO7
-rw-r--r--examples/qtest/create.test25
-rw-r--r--qpdf/qtest/qpdf.test32
-rw-r--r--qtest/module/TestDriver.pm6
4 files changed, 10 insertions, 60 deletions
diff --git a/TODO b/TODO
index d7e0ab4e..0bd28ad7 100644
--- a/TODO
+++ b/TODO
@@ -3,13 +3,6 @@ Soon
* Set up OSS-Fuzz (Google). See starred email in qpdf label.
- * Get to the bottom of Windows test fragility. The symptom is that
- sometimes the output of a command is truncated even though the
- command ran successfully. I strongly suspect it has to do with
- TestDriver->winrun and/or use of temporary files in qtest for
- Windows. If found, remove workarounds. Search for sleep to find
- them.
-
Next ABI
========
diff --git a/examples/qtest/create.test b/examples/qtest/create.test
index ca5fbd23..f18c5fd6 100644
--- a/examples/qtest/create.test
+++ b/examples/qtest/create.test
@@ -11,30 +11,9 @@ cleanup();
my $td = new TestDriver('create');
-# This test is fragile on Windows for unknown reasons. Sometimes the
-# output of the command is truncated even though it works and exits
-# normally.
-
-for (my $i = 0; $i < 5; ++$i)
-{
- unlink "tmp.out";
- if ((system("pdf-create a.pdf > tmp.out") == 0) &&
- open(F, "<check.tmpout"))
- {
- local $/ = undef;
- my $text = <F>;
- close(F);
- if ($text =~ m/passed/)
- {
- last;
- }
- }
- sleep 1;
-}
-
$td->runtest("create a simple PDF",
- {$td->FILE => "tmp.out"},
- {$td->FILE => "create.out"},
+ {$td->COMMAND => "pdf-create a.pdf"},
+ {$td->FILE => "create.out", $td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
cleanup();
diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test
index b21ffcd6..af103201 100644
--- a/qpdf/qtest/qpdf.test
+++ b/qpdf/qtest/qpdf.test
@@ -3724,36 +3724,10 @@ foreach my $file (@files)
{$td->STRING => "",
$td->EXIT_STATUS => 0});
- # This test is fragile on Windows for unknown reasons.
- # Sometimes the output of qpdf --check is truncated yet
- # qpdf --check still exits normally. As a workaround, try
- # writing the output of qpdf --check to a file and test
- # for truncation. If we get a non-truncated output, use
- # that output as the test input. If this loop fails to
- # produce a non-truncated output, the truncated or
- # otherwise incorrect output will still be used as the
- # test input, so the test will fail as it should. We lose
- # a check of qpdf --check's output, but it's not important
- # for this test to verify that.
- unlink "check.tmpout";
- for (my $i = 0; $i < 5; ++$i)
- {
- if ((system("qpdf --check a.pdf > check.tmpout") == 0) &&
- open(F, "<check.tmpout"))
- {
- local $/ = undef;
- my $text = <F>;
- close(F);
- if ($text =~ m/No syntax or stream/)
- {
- last;
- }
- }
- sleep 1;
- }
$td->runtest("check status",
- {$td->FILE => "check.tmpout"},
- {$td->FILE => "$base.$n$osuf.check"},
+ {$td->COMMAND => "qpdf --check a.pdf"},
+ {$td->FILE => "$base.$n$osuf.check",
+ $td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
$td->runtest("check with C API",
diff --git a/qtest/module/TestDriver.pm b/qtest/module/TestDriver.pm
index 7029457e..061d0e26 100644
--- a/qtest/module/TestDriver.pm
+++ b/qtest/module/TestDriver.pm
@@ -107,7 +107,7 @@ my $color_emph = "";
# MSWin32 support
my $in_windows = 0;
my $winbin = undef;
-if ($^O eq 'MSWin32')
+if (($^O eq 'MSWin32') || ($^O eq 'msys'))
{
$in_windows = 1;
}
@@ -784,6 +784,10 @@ sub runtest
binmode F;
while (<$in>)
{
+ if ($flags & $rep->NORMALIZE_NEWLINES)
+ {
+ s/\r$//;
+ }
print F;
}
$in->close();