test/recipes/90-test_store.t: Add a few cases with files starting with 'file:'

These cases are performed on Linux only.  They check that files with
names starting with 'file:' can be processed as well.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3907)
This commit is contained in:
Richard Levitte 2017-07-12 12:42:16 +02:00
parent ae9c39d83a
commit 4c0669dc6f

View File

@ -7,6 +7,7 @@
# https://www.openssl.org/source/license.html
use File::Spec;
use File::Copy;
use MIME::Base64;
use OpenSSL::Test qw(:DEFAULT srctop_file srctop_dir bldtop_file data_file);
@ -55,10 +56,24 @@ my @generated_files =
"ec-key-pkcs8-pbes2-sha1.pem", "ec-key-pkcs8-pbes2-sha1.der",
"ec-key-aes256-cbc-sha256.p12",
);
my %generated_file_files =
$^O eq 'linux'
? ( "test/testx509.pem" => "file:testx509.pem",
"test/testrsa.pem" => "file:testrsa.pem",
"test/testrsapub.pem" => "file:testrsapub.pem",
"test/testcrl.pem" => "file:testcrl.pem",
"apps/server.pem" => "file:server.pem" )
: ();
my @noexist_file_files =
( "file:blahdiblah.pem",
"file:test/blahdibleh.der" );
my $n = (3 * scalar @noexist_files)
+ (6 * scalar @src_files)
+ (4 * scalar @generated_files)
+ (scalar keys %generated_file_files)
+ (scalar @noexist_file_files)
+ 3;
plan tests => $n;
@ -96,6 +111,12 @@ indir "store_$$" => sub {
ok(!run(app(["openssl", "storeutl", "-passin", "pass:password",
to_file_uri($_)])));
}
foreach (values %generated_file_files) {
ok(run(app(["openssl", "storeutl", $_])));
}
foreach (@noexist_file_files) {
ok(!run(app(["openssl", "storeutl", $_])));
}
{
my $dir = srctop_dir("test", "certs");
ok(run(app(["openssl", "storeutl", $dir])));
@ -287,6 +308,16 @@ sub init {
close $outfh;
return 1;
}, grep(/\.der$/, @generated_files))
&& runall(sub {
my $srcfile = shift;
my $dstfile = $generated_file_files{$srcfile};
unless (copy srctop_file($srcfile), $dstfile) {
warn "$!\n";
return 0;
}
return 1;
}, keys %generated_file_files)
);
}