From 346bf1a2382dd505e5fa4fd2ecff50e939a35f01 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Tue, 11 Jul 2017 09:51:04 +0200 Subject: [PATCH] test/recipes/90-test_store.t: Test absolute files We haven't tested plain absolute paths without making them URIs... Reviewed-by: Andy Polyakov (Merged from https://github.com/openssl/openssl/pull/3907) --- test/recipes/90-test_store.t | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/test/recipes/90-test_store.t b/test/recipes/90-test_store.t index c19afbb7b0..aae46963c0 100644 --- a/test/recipes/90-test_store.t +++ b/test/recipes/90-test_store.t @@ -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) = @_; -- 2.25.1