Avoid some MinGW test failures
authorMatt Caswell <matt@openssl.org>
Fri, 25 Jun 2021 15:05:20 +0000 (16:05 +0100)
committerMatt Caswell <matt@openssl.org>
Fri, 2 Jul 2021 16:44:02 +0000 (17:44 +0100)
There were 4 classes of failure:

- line ending problems;
- unicode problems;
- file path munging problems; and
- a "hang" in test_cmp_http.

The unicode problems appear to be somewhere between wine or msys - they
don't actually appear to be a problem with the built binaries. We just skip
those tests for now.

Fixes #13558

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15939)

test/recipes/01-test_symbol_presence.t
test/recipes/04-test_conf.t
test/recipes/15-test_ecparam.t
test/recipes/25-test_eai_data.t
test/recipes/25-test_req.t
test/recipes/25-test_x509.t
test/recipes/79-test_http.t
test/recipes/80-test_cmp_http.t
test/recipes/81-test_cmp_cli.t
test/recipes/90-test_store.t

index 6031c6ac68f5ef2ae96d9327f6dbf7c6ee40d10a..4271ac32a3ce40fcc54bed0081e3132a500d1e15 100644 (file)
@@ -23,6 +23,7 @@ use platform;
 plan skip_all => "Test is disabled on NonStop" if config('target') =~ m|^nonstop|;
 # MacOS arranges symbol names differently
 plan skip_all => "Test is disabled on MacOS" if config('target') =~ m|^darwin|;
+plan skip_all => "Test is disabled on MinGW" if config('target') =~ m|^mingw|;
 plan skip_all => "Only useful when building shared libraries"
     if disabled("shared");
 
index 071233fe6f827978e3de6c3c25a0978071d33b18..cab0ec59dc61426143355433adc58685e78bb4e1 100644 (file)
@@ -35,7 +35,12 @@ foreach (sort keys %input_result) {
           unless ok(run(test([ 'confdump', $input_path ],
                              stdout => $result_path)),
                     "dumping $_");
-      is(compare_text($result_path, $expected_path), 0,
-         "comparing the dump of $_ with $input_result{$_}");
+      is(compare_text($result_path, $expected_path, sub {
+            my $in1 = $_[0];
+            my $in2 = $_[1];
+            $in1 =~ s/\r\n/\n/g;
+            $in2 =~ s/\r\n/\n/g;
+            $in1 ne $in2}), 0,
+            "comparing the dump of $_ with $input_result{$_}");
     }
 }
index c741d5a32cbe9976431794a54e3dafc01c70308e..766524e8cfa924a0e9da81d82cb0fcefb0ebdb7b 100644 (file)
@@ -50,7 +50,12 @@ sub checkcompare {
         my $testout = "$app.tst";
 
         ok(run(app(['openssl', $app, '-out', $testout, '-in', $_])));
-        ok(!compare_text($_, $testout), "Original file $_ is the same as new one");
+        ok(!compare_text($_, $testout, sub {
+            my $in1 = $_[0];
+            my $in2 = $_[1];
+            $in1 =~ s/\r\n/\n/g;
+            $in2 =~ s/\r\n/\n/g;
+            $in1 ne $in2}), "Original file $_ is the same as new one");
     }
 }
 
index 44b85420a743b383710a01e143d6e2cbd85535cc..8aebf5d621687575c29a45194476f34888038da3 100644 (file)
@@ -47,8 +47,12 @@ $out = outname();
 ok(run(app(["openssl", "x509", "-ext", "subjectAltName", "-in", $utf8_pem, "-noout", "-out", $out])));
 is(cmp_text($out, srctop_file($folder, "san.utf8")), 0, 'Comparing othername for IDN domain');
 
-ok(run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-verify_email", "学生\@elementary.school.example.com", "-CAfile", $ascii_chain_pem, $ascii_pem])));
-ok(run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-verify_email", "医生\@大学.example.com", "-CAfile", $utf8_chain_pem, $utf8_pem])));
+SKIP: {
+    skip "Unicode tests disabled on MingW", 2 if $^O =~ /^msys$/;
+
+    ok(run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-verify_email", "学生\@elementary.school.example.com", "-CAfile", $ascii_chain_pem, $ascii_pem])));
+    ok(run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-verify_email", "医生\@大学.example.com", "-CAfile", $utf8_chain_pem, $utf8_pem])));
+}
 
 ok(run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-CAfile", $ascii_chain_pem, $ascii_pem])));
 ok(run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-CAfile", $utf8_chain_pem, $utf8_pem])));
index 5f3598c71d52eed2d66cf5f1fe51a5b9091aa4c3..084d70bca54f769e6ce4c9cee6deb73671895678 100644 (file)
@@ -31,6 +31,10 @@ if (disabled("rsa")) {
     note("There should not be more that at most 80 per line");
 }
 
+# Prevent MSys2 filename munging for arguments that look like file paths but
+# aren't
+$ENV{MSYS2_ARG_CONV_EXCL} = "/CN=";
+
 # Check for duplicate -addext parameters, and one "working" case.
 my @addext_args = ( "openssl", "req", "-new", "-out", "testreq.pem",
                     "-key",  srctop_file("test", "certs", "ee-key.pem"),
index 7e8ce2408e919faa89e93615ac14f88277271262..81bd8f6f6e8a345f6e1d994d459721a408c240dd 100644 (file)
@@ -18,6 +18,10 @@ setup("test_x509");
 
 plan tests => 18;
 
+# Prevent MSys2 filename munging for arguments that look like file paths but
+# aren't
+$ENV{MSYS2_ARG_CONV_EXCL} = "/CN=";
+
 require_ok(srctop_file("test", "recipes", "tconversion.pl"));
 
 my @certs = qw(test certs);
@@ -40,7 +44,7 @@ is(cmp_text($out_utf8, $utf),
 
 SKIP: {
     skip "DES disabled", 1 if disabled("des");
-    skip "VMS doesn't support command line UTF-8", 1 if $^O eq 'VMS';
+    skip "Platform doesn't support command line UTF-8", 1 if $^O =~ /^(VMS|msys)$/;
 
     my $p12 = srctop_file("test", "shibboleth.pfx");
     my $p12pass = "σύνθημα γνώρισμα";
index 9f0904da6fdef6d3885c19944d44135c4b33707b..b3ac70fdebb266374fd95b2e4aa987158a184970 100644 (file)
@@ -19,6 +19,7 @@ SKIP: {
     skip "OCSP disabled", 1 if disabled("ocsp");
     my $cmd = [qw{openssl ocsp -index any -port 0}];
     my @output = run(app($cmd), capture => 1);
+    $output[0] =~ s/\r\n/\n/g;
     ok($output[0] =~ /^ACCEPT (0.0.0.0|\[::\]):(\d+?) PID=(\d+)$/
        && $2 >= 1024 && $3 > 0,
        "HTTP server auto-selects and reports local port >= 1024 and pid > 0");
index 68130a364aaba46afececedaccc31237247d17bc..7bd95337e83f15ea77228646a46aa5742ad71718 100644 (file)
@@ -32,7 +32,7 @@ plan skip_all => "These tests are not supported in a no-sock build"
     if disabled("sock");
 
 plan skip_all => "Tests involving local HTTP server not available on Windows or VMS"
-    if $^O =~ /^(VMS|MSWin32)$/;
+    if $^O =~ /^(VMS|MSWin32|msys)$/;
 plan skip_all => "Tests involving local HTTP server not available in cross-compile builds"
     if defined $ENV{EXE_SHELL};
 
index 20ce7380529b9e86b3350b2a43fffd1b2d030318..77a83c2bed8cde875782ea449937d5f4ebaacf63 100644 (file)
@@ -28,6 +28,10 @@ plan skip_all => "These tests are not supported in a fuzz build"
 plan skip_all => "These tests are not supported in a no-cmp build"
     if disabled("cmp");
 
+# Prevent MSys2 filename munging for arguments that look like file paths but
+# aren't
+$ENV{MSYS2_ARG_CONV_EXCL} = "/CN=";
+
 my @app = qw(openssl cmp);
 
 my @cmp_basic_tests = (
index e9a33c91d98dc87e202cc2488dc7d1425200a6cc..835ad6191e851b0a1625713cdd0127fb0858de19 100644 (file)
@@ -16,8 +16,6 @@ use OpenSSL::Test::Utils;
 my $test_name = "test_store";
 setup($test_name);
 
-my $mingw = config('target') =~ m|^mingw|;
-
 my $use_md5 = !disabled("md5");
 my $use_des = !(disabled("des") || disabled("legacy")); # also affects 3des and pkcs12 app
 my $use_dsa = !disabled("dsa");
@@ -112,8 +110,10 @@ my $n = scalar @methods
         + 3
         + 11 );
 
+# Test doesn't work under msys because the file name munging doesn't work
+# correctly with the "ot:" prefix
 my $do_test_ossltest_store =
-    !(disabled("engine") || disabled("dynamic-engine"));
+    !(disabled("engine") || disabled("dynamic-engine") || $^O =~ /^msys$/);
 
 if ($do_test_ossltest_store) {
     # test loading with apps 'org.openssl.engine:' loader, using the
@@ -180,7 +180,7 @@ indir "store_$$" => sub {
                 ok(run(app([@storeutl, "-noout", to_abs_file($file)])));
               SKIP:
                 {
-                    skip "file: tests disabled on MingW", 4 if $mingw;
+                    skip "file: tests disabled on MingW", 4  if $^O =~ /^msys$/;
 
                     ok(run(app([@storeutl, "-noout",
                                 to_abs_file_uri($file)])));
@@ -200,7 +200,7 @@ indir "store_$$" => sub {
 
               SKIP:
                 {
-                    skip "file: tests disabled on MingW", 2 if $mingw;
+                    skip "file: tests disabled on MingW", 2  if $^O =~ /^msys$/;
 
                     ok(run(app([@storeutl, "-noout", "-passin",
                                 "pass:password", to_abs_file_uri($_)])));
@@ -211,7 +211,7 @@ indir "store_$$" => sub {
             foreach (values %generated_file_files) {
               SKIP:
                 {
-                    skip "file: tests disabled on MingW", 1 if $mingw;
+                    skip "file: tests disabled on MingW", 1  if $^O =~ /^msys$/;
 
                     ok(run(app([@storeutl,  "-noout", $_])));
                 }
@@ -219,7 +219,7 @@ indir "store_$$" => sub {
             foreach (@noexist_file_files) {
               SKIP:
                 {
-                    skip "file: tests disabled on MingW", 1 if $mingw;
+                    skip "file: tests disabled on MingW", 1  if $^O =~ /^msys$/;
 
                     ok(!run(app([@storeutl,  "-noout", $_])));
                 }
@@ -231,7 +231,7 @@ indir "store_$$" => sub {
                 ok(run(app([@storeutl,  "-noout", to_abs_file($dir, 1)])));
               SKIP:
                 {
-                    skip "file: tests disabled on MingW", 1 if $mingw;
+                    skip "file: tests disabled on MingW", 1  if $^O =~ /^msys$/;
 
                     ok(run(app([@storeutl,  "-noout",
                                 to_abs_file_uri($dir, 1)])));