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" ); @d = ( "enc", @{$variant{$t}}, "-d" );
} }
ok(run(app([$cmd, @e], ok(run(app([$cmd, @e, "-in", $test, "-out", $cipherfile]))
stdin => $test, stdout => $cipherfile)) && run(app([$cmd, @d, "-in", $cipherfile, "-out", $clearfile]))
&& run(app([$cmd, @d],
stdin => $cipherfile, stdout => $clearfile))
&& compare_text($test,$clearfile) == 0, $t); && compare_text($test,$clearfile) == 0, $t);
unlink $cipherfile, $clearfile; unlink $cipherfile, $clearfile;
} }

View file

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