Adapt 15-test_out_option.t for more than just Unix
authorRichard Levitte <levitte@openssl.org>
Thu, 22 Feb 2018 22:39:01 +0000 (23:39 +0100)
committerRichard Levitte <levitte@openssl.org>
Wed, 28 Feb 2018 17:48:05 +0000 (18:48 +0100)
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4008)

test/recipes/15-test_out_option.t

index a4ca7cfa45e83b2862c57ecb2891fa6369da0c78..018ff3d00d6b6efb279cdfd8e6e991fc53013f17 100644 (file)
@@ -31,8 +31,8 @@ plan tests => 11;
 
 test_illegal_path('/usr/');
 test_illegal_path('/');
 
 test_illegal_path('/usr/');
 test_illegal_path('/');
-test_illegal_path('.');
-test_illegal_path('..');
+test_illegal_path('./');
+test_illegal_path('../');
 
 # Test for trying to create a file in a non-exist directory
 my @chars = ("A".."Z", "a".."z", "0".."9");
 
 # Test for trying to create a file in a non-exist directory
 my @chars = ("A".."Z", "a".."z", "0".."9");
@@ -44,7 +44,7 @@ test_legal_path('test.pem');
 unlink 'test.pem';
 
 sub test_illegal_path {
 unlink 'test.pem';
 
 sub test_illegal_path {
-    my ($path) = @_;
+    my $path = File::Spec->canonpath($_[0]);
 
     my $start = time();
     ok(!run(app([ 'openssl', 'genrsa', '-out', $path, '16384'])), "invalid output path: $path");
 
     my $start = time();
     ok(!run(app([ 'openssl', 'genrsa', '-out', $path, '16384'])), "invalid output path: $path");
@@ -54,7 +54,7 @@ sub test_illegal_path {
 }
 
 sub test_legal_path {
 }
 
 sub test_legal_path {
-    my ($path) = @_;
+    my $path = File::Spec->canonpath($_[0]);
 
     ok(run(app([ 'openssl', 'genrsa', '-out', $path, '2048'])), "valid output path: $path");
 }
 
     ok(run(app([ 'openssl', 'genrsa', '-out', $path, '2048'])), "valid output path: $path");
 }