2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 10:58:58 +00:00

Work around test fragility on Windows

This commit is contained in:
Jay Berkenbilt 2019-01-07 12:51:34 -05:00
parent 8f6f7cec50
commit e6f1e54771

View File

@ -11,9 +11,30 @@ cleanup();
my $td = new TestDriver('create'); 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->runtest("create a simple PDF",
{$td->COMMAND => "pdf-create a.pdf"}, {$td->FILE => "tmp.out"},
{$td->FILE => "create.out", $td->EXIT_STATUS => 0}, {$td->FILE => "create.out"},
$td->NORMALIZE_NEWLINES); $td->NORMALIZE_NEWLINES);
cleanup(); cleanup();
@ -23,4 +44,5 @@ $td->report(1);
sub cleanup sub cleanup
{ {
unlink "a.pdf"; unlink "a.pdf";
unlink "tmp.out";
} }