Adapt 80-test_ssl_old.t to use statusvar
authorRichard Levitte <levitte@openssl.org>
Tue, 21 Mar 2017 09:58:46 +0000 (10:58 +0100)
committerRichard Levitte <levitte@openssl.org>
Tue, 21 Mar 2017 15:12:29 +0000 (16:12 +0100)
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3004)

test/recipes/80-test_ssl_old.t

index a790d9be2aaa033fe1527467d12ff78fba456ae9..8b6f538eeb6cf822aa6df70dc9e3e7619217cfc3 100644 (file)
@@ -424,11 +424,17 @@ sub testssl {
        push @protocols, "-ssl3" unless $no_ssl3;
        my $protocolciphersuitecount = 0;
        my %ciphersuites = ();
+       my %ciphersstatus = ();
        foreach my $protocol (@protocols) {
-           $ciphersuites{$protocol} =
-               [ map { s|\R||; split(/:/, $_) }
-                 run(app(["openssl", "ciphers", "-s", $protocol,
-                           "ALL:$ciphers"]), capture => 1) ];
+           my $ciphersstatus = undef;
+           my @ciphers = run(app(["openssl", "ciphers", "-s", $protocol,
+                                  "ALL:$ciphers"]),
+                             capture => 1, statusvar => \$ciphersstatus);
+           $ciphersstatus{$protocol} = $ciphersstatus;
+           if ($ciphersstatus) {
+               $ciphersuites{$protocol} = [ map { s|\R||; split(/:/, $_) }
+                                            @ciphers ];
+           }
            $protocolciphersuitecount += scalar @{$ciphersuites{$protocol}};
        }
 
@@ -437,7 +443,12 @@ sub testssl {
 
         # The count of protocols is because in addition to the ciphersuits
         # we got above, we're running a weak DH test for each protocol
-        plan tests => $protocolciphersuitecount + scalar(keys %ciphersuites);
+        plan tests => scalar(@protocols) + $protocolciphersuitecount
+            + scalar(keys %ciphersuites);
+
+        foreach my $protocol (@protocols) {
+            ok($ciphersstatus{$protocol}, "Getting ciphers for $protocol");
+        }
 
         foreach my $protocol (sort keys %ciphersuites) {
             note "Testing ciphersuites for $protocol";