bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: strsignal on macOS


From: Bruno Haible
Subject: Re: strsignal on macOS
Date: Wed, 02 Dec 2020 22:52:17 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-193-generic; KDE/5.18.0; x86_64; ; )

Martin Storsjö wrote:
> FAIL: test-strsignal

The cause is that strsignal (SIGHUP) here is "Hangup 1", not just "Hangup".

This patch fixes the test.


2020-12-02  Bruno Haible  <bruno@clisp.org>

        strsignal-tests: Fix test failure on macOS 10.13.
        Reported by Martin Storsjö <martin@martin.st> in
        <https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00003.html>.
        * tests/test-strsignal.c (ASSERT_DESCRIPTION): Allow the actual result
        to be longer than the expected result.

diff --git a/tests/test-strsignal.c b/tests/test-strsignal.c
index 0316d40..1f8aeba 100644
--- a/tests/test-strsignal.c
+++ b/tests/test-strsignal.c
@@ -28,10 +28,12 @@ SIGNATURE_CHECK (strsignal, char *, (int));
 #include "macros.h"
 
 #if HAVE_DECL_SYS_SIGLIST
-# define ASSERT_DESCRIPTION(got, expect)
+# define ASSERT_DESCRIPTION(actual, expected)
 #else
-/* In this case, we can guarantee some signal descriptions.  */
-# define ASSERT_DESCRIPTION(got, expect) ASSERT (!strcmp (got, expect))
+/* In this case, we can guarantee some signal descriptions.
+   But allow the actual result to be longer than the expected result.  */
+# define ASSERT_DESCRIPTION(actual, expected) \
+   ASSERT (strncmp (actual, expected, strlen (expected)) == 0)
 #endif
 
 int




reply via email to

[Prev in Thread] Current Thread [Next in Thread]