From 94437cebc4e6c638dbf1c089877d053fecbe3361 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Tue, 11 Jul 2017 09:48:08 +0200 Subject: [PATCH] test/recipes/90-test_store.t: Rename some functions to_rel_file_uri really treated all files appropriately, absolute and relative alike, and really just constructs a URI, so gets renamed to to_file_uri to_file_uri, on the other hand, forces the path into an absolute one, so gets renamed to to_abs_file_uri Reviewed-by: Andy Polyakov (Merged from https://github.com/openssl/openssl/pull/3907) --- test/recipes/90-test_store.t | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/test/recipes/90-test_store.t b/test/recipes/90-test_store.t index 65cf9fbaba..c19afbb7b0 100644 --- a/test/recipes/90-test_store.t +++ b/test/recipes/90-test_store.t @@ -71,31 +71,31 @@ indir "store_$$" => sub { foreach (@noexist_files) { my $file = srctop_file($_); ok(!run(app(["openssl", "storeutl", $file]))); - ok(!run(app(["openssl", "storeutl", to_file_uri($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_file_uri($file)]))); - ok(run(app(["openssl", "storeutl", to_file_uri($file, 0, - "")]))); - ok(run(app(["openssl", "storeutl", to_file_uri($file, 0, - "localhost")]))); - ok(!run(app(["openssl", "storeutl", to_file_uri($file, 0, - "dummy")]))); + ok(run(app(["openssl", "storeutl", to_abs_file_uri($file)]))); + ok(run(app(["openssl", "storeutl", to_abs_file_uri($file, 0, + "")]))); + ok(run(app(["openssl", "storeutl", to_abs_file_uri($file, 0, + "localhost")]))); + ok(!run(app(["openssl", "storeutl", to_abs_file_uri($file, 0, + "dummy")]))); } foreach (@generated_files) { ok(run(app(["openssl", "storeutl", "-passin", "pass:password", $_]))); ok(run(app(["openssl", "storeutl", "-passin", "pass:password", - to_file_uri($_)]))); + to_abs_file_uri($_)]))); ok(!run(app(["openssl", "storeutl", "-passin", "pass:password", - to_rel_file_uri($_)]))); + to_file_uri($_)]))); } { my $dir = srctop_dir("test", "certs"); ok(run(app(["openssl", "storeutl", $dir]))); - ok(run(app(["openssl", "storeutl", to_file_uri($dir, 1)]))); + ok(run(app(["openssl", "storeutl", to_abs_file_uri($dir, 1)]))); } } }, create => 1, cleanup => 1; @@ -296,12 +296,12 @@ sub runall { # According to RFC8089, a relative file: path is invalid. We still produce # them for testing purposes. -sub to_rel_file_uri { +sub to_file_uri { my ($file, $isdir, $authority) = @_; my $vol; my $dir; - die "to_rel_file_uri: No file given\n" if !defined($file) || $file eq ''; + die "to_file_uri: No file given\n" if !defined($file) || $file eq ''; ($vol, $dir, $file) = File::Spec->splitpath($file, $isdir // 0); @@ -341,9 +341,9 @@ sub to_rel_file_uri { return "file:$file"; } -sub to_file_uri { +sub to_abs_file_uri { my ($file, $isdir, $authority) = @_; - die "to_file_uri: No file given\n" if !defined($file) || $file eq ''; - return to_rel_file_uri(File::Spec->rel2abs($file), $isdir, $authority); + die "to_abs_file_uri: No file given\n" if !defined($file) || $file eq ''; + return to_file_uri(to_abs_file($file), $isdir, $authority); } -- 2.25.1