test/recipes/90-test_store.t: Test absolute files
authorRichard Levitte <levitte@openssl.org>
Tue, 11 Jul 2017 07:51:04 +0000 (09:51 +0200)
committerRichard Levitte <levitte@openssl.org>
Sat, 15 Jul 2017 16:53:07 +0000 (18:53 +0200)
We haven't tested plain absolute paths without making them URIs...

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3907)

test/recipes/90-test_store.t

index c19afbb..aae4696 100644 (file)
@@ -56,10 +56,10 @@ my @generated_files =
      "ec-key-aes256-cbc-sha256.p12",
     );
 
-my $n = (2 * scalar @noexist_files)
-    + (5 * scalar @src_files)
-    + (3 * scalar @generated_files)
-    + 2;
+my $n = (3 * scalar @noexist_files)
+    + (6 * scalar @src_files)
+    + (4 * scalar @generated_files)
+    + 3;
 
 plan tests => $n;
 
@@ -71,11 +71,13 @@ indir "store_$$" => sub {
         foreach (@noexist_files) {
             my $file = srctop_file($_);
             ok(!run(app(["openssl", "storeutl", $file])));
+            ok(!run(app(["openssl", "storeutl", to_abs_file($file)])));
             ok(!run(app(["openssl", "storeutl", to_abs_file_uri($file)])));
         }
         foreach (@src_files) {
             my $file = srctop_file($_);
             ok(run(app(["openssl", "storeutl", $file])));
+            ok(run(app(["openssl", "storeutl", to_abs_file($file)])));
             ok(run(app(["openssl", "storeutl", to_abs_file_uri($file)])));
             ok(run(app(["openssl", "storeutl", to_abs_file_uri($file, 0,
                                                                "")])));
@@ -87,6 +89,8 @@ indir "store_$$" => sub {
         foreach (@generated_files) {
             ok(run(app(["openssl", "storeutl", "-passin", "pass:password",
                         $_])));
+            ok(run(app(["openssl", "storeutl", "-passin", "pass:password",
+                        to_abs_file($_)])));
             ok(run(app(["openssl", "storeutl", "-passin", "pass:password",
                         to_abs_file_uri($_)])));
             ok(!run(app(["openssl", "storeutl", "-passin", "pass:password",
@@ -95,6 +99,7 @@ indir "store_$$" => sub {
         {
             my $dir = srctop_dir("test", "certs");
             ok(run(app(["openssl", "storeutl", $dir])));
+            ok(run(app(["openssl", "storeutl", to_abs_file($dir, 1)])));
             ok(run(app(["openssl", "storeutl", to_abs_file_uri($dir, 1)])));
         }
     }
@@ -341,6 +346,12 @@ sub to_file_uri {
     return "file:$file";
 }
 
+sub to_abs_file {
+    my ($file) = @_;
+
+    return File::Spec->rel2abs($file);
+}
+
 sub to_abs_file_uri {
     my ($file, $isdir, $authority) = @_;