From 8e78da06660b269fbdf8faba6bc3a356ee3fda5e Mon Sep 17 00:00:00 2001 From: Shane Lontis Date: Wed, 15 Jul 2020 11:49:57 +1000 Subject: [PATCH] Fix trailing whitespace mismatch error when running 02-test_errstr. Fixes #12449 On a aix7_ppc32 machine the error was of the form match 'Previous owner died ' (2147483743) with one of ( 'Previous owner died', 'reason(95)' ) Stripping the trailing whitespace from the system error will address this issue. Suggested fix by @pauldale. Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/12451) --- test/recipes/02-test_errstr.t | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/recipes/02-test_errstr.t b/test/recipes/02-test_errstr.t index a63812f3970..7c382b41240 100644 --- a/test/recipes/02-test_errstr.t +++ b/test/recipes/02-test_errstr.t @@ -49,7 +49,7 @@ use constant ERR_LIB_NONE => 1; plan tests => scalar @Errno::EXPORT_OK +1 # Checking that error 128 gives 'reason(128)' +1 # Checking that error 0 gives the library name - ; + +1; # Check trailing whitespace is removed. # Test::More:ok() has a sub prototype, which means we need to use the '&ok' # syntax to force it to accept a list as a series of arguments. @@ -66,6 +66,7 @@ foreach my $errname (@Errno::EXPORT_OK) { # Reason code 0 of any library gives the library name as reason &ok(match_opensslerr_reason(ERR_LIB_NONE << ERR_LIB_OFFSET | 0, "unknown library")); +&ok(match_any("Trailing whitespace \n\t", "?", ( "Trailing whitespace" ))); exit 0; @@ -93,6 +94,9 @@ sub match_any { my $desc = shift; my @strings = @_; + # ignore trailing whitespace + $first =~ s/\s+$//; + if (scalar @strings > 1) { $desc = "match '$first' ($desc) with one of ( '" . join("', '", @strings) . "' )"; -- 2.47.2