From: Richard Levitte Date: Tue, 11 Jul 2017 07:51:04 +0000 (+0200) Subject: test/recipes/90-test_store.t: Test absolute files X-Git-Tag: OpenSSL_1_1_1-pre1~1040 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=346bf1a2382dd505e5fa4fd2ecff50e939a35f01;p=oweals%2Fopenssl.git 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) --- 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) = @_;