With the clang 17 ASAN+UBSAN, I also see this failure:

FAIL: test-u8-strstr
====================

FAIL test-u8-strstr (exit status: 142)

The cause is that the test has a timeout of 5 seconds; however, it needs 7.1
seconds to execute.

This patch increases the timeouts, also leaving some slack for QEMU-emulated
environments, and using the gdb-overridable idiom from
https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=a8d9f4635238f845bb76269a54fbb2c55255d365
 .


2024-05-09  Bruno Haible  <br...@clisp.org>

        unistr/u8-strstr tests: Avoid test failure with ASAN.
        * tests/unistr/test-u8-strstr.c (main): Increase timeout to 50 sec.
        * tests/unistr/test-u16-strstr.c (main): Likewise.
        * tests/unistr/test-u32-strstr.c (main): Likewise.

diff --git a/tests/unistr/test-u16-strstr.c b/tests/unistr/test-u16-strstr.c
index 4906a96f23..3ba2da2759 100644
--- a/tests/unistr/test-u16-strstr.c
+++ b/tests/unistr/test-u16-strstr.c
@@ -38,8 +38,9 @@ main (void)
 #if HAVE_DECL_ALARM
   /* Declare failure if test takes too long, by using default abort
      caused by SIGALRM.  */
+  int alarm_value = 50;
   signal (SIGALRM, SIG_DFL);
-  alarm (10);
+  alarm (alarm_value);
 #endif
 
   test_u_strstr ();
diff --git a/tests/unistr/test-u32-strstr.c b/tests/unistr/test-u32-strstr.c
index 21caa7842f..320ccfbe42 100644
--- a/tests/unistr/test-u32-strstr.c
+++ b/tests/unistr/test-u32-strstr.c
@@ -38,8 +38,9 @@ main (void)
 #if HAVE_DECL_ALARM
   /* Declare failure if test takes too long, by using default abort
      caused by SIGALRM.  */
+  int alarm_value = 50;
   signal (SIGALRM, SIG_DFL);
-  alarm (10);
+  alarm (alarm_value);
 #endif
 
   test_u_strstr ();
diff --git a/tests/unistr/test-u8-strstr.c b/tests/unistr/test-u8-strstr.c
index 791e1c97f4..670a182d0c 100644
--- a/tests/unistr/test-u8-strstr.c
+++ b/tests/unistr/test-u8-strstr.c
@@ -41,8 +41,9 @@ main (void)
      case, we're assuming that we're running this test on the
      same system that we did the check to ensure it has linear
      performance characteristics.  */
+  int alarm_value = 50;
   signal (SIGALRM, SIG_DFL);
-  alarm (5);
+  alarm (alarm_value);
 #endif
 
   test_u_strstr ();




Reply via email to