mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 02:49:00 +00:00
Incorporate improved Windows fragility workaround from qtest
This commit is contained in:
parent
d491ed8753
commit
8acf636b4e
7
TODO
7
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
|
||||
========
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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",
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user