Test suite: minimal required to get mingw 'make test' work under Linux.
authorAndy Polyakov <appro@openssl.org>
Mon, 12 Oct 2015 20:16:07 +0000 (22:16 +0200)
committerAndy Polyakov <appro@openssl.org>
Tue, 13 Oct 2015 17:46:50 +0000 (19:46 +0200)
(part by Alessandro Ghedini)

Reviewed-by: Richard Levitte <levitte@openssl.org>
test/recipes/25-test_verify.t
test/recipes/80-test_ssl.t
test/recipes/tconversion.pl
test/testlib/OpenSSL/Test.pm
test/testlib/OpenSSL/Test/Utils.pm
util/shlib_wrap.sh

index 10897a1d71d6ce7a61114e87237e550c6088e4ff..7c0f091e102b2ce414e43a86a8e01870ddb80c06 100644 (file)
@@ -8,6 +8,9 @@ use OpenSSL::Test qw/:DEFAULT top_dir top_file/;
 
 setup("test_verify");
 
+plan skip_all => "no rehash.time was found."
+    unless (-f top_file("rehash.time"));
+
 plan tests => 1;
 
 note("Expect some failures and expired certificate");
index 6e5e22e49b9e95c84868f8f070ccd0235a78fa6f..5f520ded1136dd549915b7abd11ac6bc5945decc 100644 (file)
@@ -414,7 +414,7 @@ sub testssl {
                      map { split(/:/, $_) }
                      run(app(["openssl", "ciphers", "${_}:$ciphers"]),
                           capture => 1);
-                 chomp @c;
+                 map { s/\R//; } @c;  # chomp @c;
                  $protocolciphersuitcount += scalar @c;
                  $_ => [ @c ] } @protocols;
 
index 011dcbffb9ff6c9b9ffb43b8e915c4f26dd29308..07e34060f395ed63ded85645f9fcf6e89e30c96a 100644 (file)
@@ -68,14 +68,14 @@ sub tconversion {
       }
 
       if ($testtype ne "p7d") {
-         is(compare_text("$testtype-fff.p", "$testtype-f.p"), 0,
+         is(cmp_text("$testtype-fff.p", "$testtype-f.p"), 0,
             'comparing orig to p');
       }
 
       foreach my $to (@conversionforms) {
          next if $to eq "d";
          foreach my $from (@conversionforms) {
-             is(compare_text("$testtype-f.$to", "$testtype-ff.$from$to"), 0,
+             is(cmp_text("$testtype-f.$to", "$testtype-ff.$from$to"), 0,
                 "comparing $to to $from$to");
          }
       }
@@ -85,4 +85,12 @@ sub tconversion {
     unlink glob "$testtype-fff.*";
 }
 
+sub cmp_text {
+    return compare_text(@_, sub {
+        $_[0] =~ s/\R//g;
+        $_[1] =~ s/\R//g;
+        return $_[0] ne $_[1];
+    });
+}
+
 1;
index c64d68de46c35848ff4d635e50ed5c1b4ce60004..453e3d79deb5a89d8aa9bc3f075ec87587d65675 100644 (file)
@@ -357,7 +357,7 @@ operating system.
 =cut
 
 sub top_dir {
-    return __top_file(@_, ""); # This caters for operating systems that have
+    return __top_dir(@_);      # This caters for operating systems that have
                                # a very distinct syntax for directories.
 }
 
@@ -577,6 +577,12 @@ sub __top_file {
     return catfile($directories{TOP},@_,$f);
 }
 
+sub __top_dir {
+    BAIL_OUT("Must run setup() first") if (! $test_name);
+
+    return catdir($directories{TOP},@_);
+}
+
 sub __test_file {
     BAIL_OUT("Must run setup() first") if (! $test_name);
 
@@ -668,7 +674,9 @@ sub __fixup_cmd {
     my $prefix = __top_file("util", "shlib_wrap.sh")." ";
     my $ext = $ENV{"EXE_EXT"} || "";
 
-    if ( $^O eq "VMS" ) {      # VMS
+    if (defined($ENV{EXE_SHELL})) {
+       $prefix = "$ENV{EXE_SHELL} ";
+    } elsif ($^O eq "VMS" ) {  # VMS
        $prefix = "mcr ";
        $ext = ".exe";
     } elsif ($^O eq "MSWin32") { # Windows
index fc9b5336138a58d6d1baf6cac964cd3bbf9bc7c1..5312c205a09287720ddf4d8a39ee00a161f32aa1 100644 (file)
@@ -46,7 +46,7 @@ my $disabled_set = 0;
 sub check_disabled {
 #print STDERR "Running check_disabled\n";
     foreach (run(app(["openssl", "list", "-disabled"]), capture => 1)) {
-        chomp;
+        s/\R//;         # chomp;
         next if /:/;    # skip header
         $disabled{lc $_} = 1;
     }
index 8775cb5411e1f2397eb0e138203b2c9636411f50..646b0fe169306d903a2dc4aa39672122553136f7 100755 (executable)
@@ -88,7 +88,7 @@ if [ -f "$LIBCRYPTOSO" -a -z "$preload_var" ]; then
        export LD_PRELOAD _RLD_LIST DYLD_INSERT_LIBRARIES
 fi
 
-cmd="$1${EXE_EXT}"
+cmd="$1"; [ -x "$cmd" ] || cmd="$cmd${EXE_EXT}"
 shift
 if [ $# -eq 0 ]; then
        exec "$cmd"     # old sh, such as Tru64 4.x, fails to expand empty "$@"