]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
TEST: Stop the cleanup in test/recipes/20-test_mac.t
authorRichard Levitte <levitte@openssl.org>
Tue, 9 Mar 2021 17:49:06 +0000 (18:49 +0100)
committerRichard Levitte <levitte@openssl.org>
Thu, 11 Mar 2021 16:22:00 +0000 (17:22 +0100)
Let the files remain to make test forensics easy

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14484)

test/recipes/20-test_mac.t

index fac72cfaaf3ab5432e7495e8784692a5e2f260d5..b6a8078763e44376a146f5492a619616f3ba9af7 100644 (file)
@@ -97,21 +97,26 @@ push @mac_fail_tests, @siphash_fail_tests unless disabled("siphash");
 
 plan tests => (scalar @mac_tests * 2) + scalar @mac_fail_tests;
 
+my $test_count = 0;
+
 foreach (@mac_tests) {
+    $test_count++;
     ok(compareline($_->{cmd}, $_->{type}, $_->{input}, $_->{expected}, $_->{err}), $_->{desc});
 }
 foreach (@mac_tests) {
+    $test_count++;
     ok(comparefile($_->{cmd}, $_->{type}, $_->{input}, $_->{expected}), $_->{desc});
 }
 
 foreach (@mac_fail_tests) {
+    $test_count++;
     ok(compareline($_->{cmd}, $_->{type}, $_->{input}, $_->{expected}, $_->{err}), $_->{desc});
 }
 
 # Create a temp input file and save the input data into it, and
 # then compare the stdout output matches the expected value.
 sub compareline {
-    my $tmpfile = 'tmp.bin';
+    my $tmpfile = "input-$test_count.bin";
     my ($cmdarray_orig, $type, $input, $expect, $err) = @_;
     my $cmdarray = dclone $cmdarray_orig;
     if (defined($expect)) {
@@ -129,7 +134,7 @@ sub compareline {
     push @$cmdarray, @other;
 
     my @lines = run(app($cmdarray), capture => 1);
-    unlink $tmpfile;
+    # Not unlinking $tmpfile
 
     if (defined($expect)) {
         if ($lines[1] =~ m|^\Q${expect}\E\R$|) {
@@ -162,8 +167,8 @@ sub compareline {
 # use the '-bin -out <file>' commandline options to save results out to a file.
 # Read this file back in and check its output matches the expected value.
 sub comparefile {
-    my $tmpfile = 'tmp.bin';
-    my $outfile = 'out.bin';
+    my $tmpfile = "input-$test_count.bin";
+    my $outfile = "output-$test_count.bin";
     my ($cmdarray, $type, $input, $expect) = @_;
     $expect = uc $expect;
 
@@ -178,16 +183,17 @@ sub comparefile {
     push @$cmdarray, @other;
 
     run(app($cmdarray));
-    unlink $tmpfile;
+    # Not unlinking $tmpfile
+
     open(my $out, '<', $outfile) or die "Could not open file";
     binmode($out);
     my $buffer;
     my $BUFSIZE = 1024;
     read($out, $buffer, $BUFSIZE) or die "unable to read";
+    # Not unlinking $outfile
+
     my $line = uc unpack("H*", $buffer);
     close($out);
-    unlink $outfile;
 
     if ($line eq $expect) {
         return 1;