]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
TEST: skip POSIX errcode zero in tesst/recipes/02-test_errstr.t
authorRichard Levitte <levitte@openssl.org>
Sun, 6 Sep 2020 06:51:32 +0000 (08:51 +0200)
committerRichard Levitte <levitte@openssl.org>
Sat, 12 Sep 2020 01:51:21 +0000 (03:51 +0200)
On most systems, there is no E macro for errcode zero in <errno.h>,
which means that it seldom comes up here.  However, reports indicate
that some platforms do have an E macro for errcode zero.
With perl, errcode zero is a bit special.  Perl consistently gives
the empty string for that one, while the C strerror() may give back
something else.  The easiest way to deal with that possible mismatch
is to skip this errcode.

Fixes #12798

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12799)

test/recipes/02-test_errstr.t

index 7c382b41240dc1ef84380ac61f9f4ebcc9df72b5..6bc07f6d6525078b76fe52872a96674f76d453d1 100644 (file)
@@ -57,7 +57,21 @@ plan tests => scalar @Errno::EXPORT_OK
 foreach my $errname (@Errno::EXPORT_OK) {
     # The error names are perl constants, which are implemented as functions
     # returning the numeric value of that name.
-    &ok(match_syserr_reason("Errno::$errname"->()))
+    my $errcode = "Errno::$errname"->();
+
+  SKIP: {
+      # On most systems, there is no E macro for errcode zero in <errno.h>,
+      # which means that it seldom comes up here.  However, reports indicate
+      # that some platforms do have an E macro for errcode zero.
+      # With perl, errcode zero is a bit special.  Perl consistently gives
+      # the empty string for that one, while the C strerror() may give back
+      # something else.  The easiest way to deal with that possible mismatch
+      # is to skip this errcode.
+      skip "perl error strings and ssystem error strings for errcode 0 differ", 1
+          if $errcode == 0;
+
+      &ok(match_syserr_reason($errcode));
+    }
 }
 
 # OpenSSL library 1 is the "unknown" library