Do not use redirection on binary files

On some platforms, the shell will determine what attributes a file
will have, so while the program might think it's safely outputting
binary data, it's not always true.

For the sake of the tests, it's therefore safer to use -out than to
use redirection.

Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
Richard Levitte 2016-01-14 13:15:45 +01:00
parent 67949615d2
commit 9b56815d5f
2 changed files with 8 additions and 8 deletions

View file

@ -51,10 +51,8 @@ if (!$init) {
@d = ( "enc", @{$variant{$t}}, "-d" );
}
ok(run(app([$cmd, @e],
stdin => $test, stdout => $cipherfile))
&& run(app([$cmd, @d],
stdin => $cipherfile, stdout => $clearfile))
ok(run(app([$cmd, @e, "-in", $test, "-out", $cipherfile]))
&& run(app([$cmd, @d, "-in", $cipherfile, "-out", $clearfile]))
&& compare_text($test,$clearfile) == 0, $t);
unlink $cipherfile, $clearfile;
}

View file

@ -53,8 +53,9 @@ sub tconversion {
ok(run(app([@cmd,
"-in", "$testtype-fff.p",
"-inform", "p",
"-outform", $to],
stdout => "$testtype-f.$to")), "p -> $to");
"-out", "$testtype-f.$to",
"-outform", $to])),
"p -> $to");
}
foreach my $to (@conversionforms) {
@ -62,8 +63,9 @@ sub tconversion {
ok(run(app([@cmd,
"-in", "$testtype-f.$from",
"-inform", $from,
"-outform", $to],
stdout => "$testtype-ff.$from$to")), "$from -> $to");
"-out", "$testtype-ff.$from$to",
"-outform", $to])),
"$from -> $to");
}
}