* tests/test-dprintf-posix2.c (main): Skip the test if ASAN is enabled.
* tests/test-fprintf-posix3.c (main): Likewise.
* tests/test-dprintf-posix2.sh: Update.
* tests/test-fprintf-posix3.sh: Likewise.
+2024-05-09 Bruno Haible <bruno@clisp.org>
+
+ dprintf-posix, fprintf-posix tests: Avoid test failures with ASAN.
+ * tests/test-dprintf-posix2.c (main): Skip the test if ASAN is enabled.
+ * tests/test-fprintf-posix3.c (main): Likewise.
+ * tests/test-dprintf-posix2.sh: Update.
+ * tests/test-fprintf-posix3.sh: Likewise.
+
2024-05-08 Bruno Haible <bruno@clisp.org>
sigsegv, c-stack tests: Avoid test failures with ASAN.
/* Test of POSIX compatible dprintf() function.
- Copyright (C) 2009-2023 Free Software Foundation, Inc.
+ Copyright (C) 2009-2024 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <stdio.h>
+/* Skip this test when an address sanitizer is in use, since it would fail. */
+#ifndef __has_feature
+# define __has_feature(a) 0
+#endif
+#if defined __SANITIZE_ADDRESS__ || __has_feature (address_sanitizer)
+
+int
+main ()
+{
+ fprintf (stderr, "Skipping test: address sanitizer's malloc behaves differently\n");
+ return 80;
+}
+
+#else
+
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
if (memory == NULL)
return 1;
memset (memory, 17, MAX_ALLOC_TOTAL);
- result = 80;
+ result = 81;
}
else
{
return result;
}
+
+#endif /* ! address sanitizer enabled */
(${CHECKER} ./test-dprintf-posix2${EXEEXT} 0
result=$?
- if test $result != 77 && test $result != 79 && test $result != 80; then result=1; fi
+ if test $result != 77 && test $result != 79 && test $result != 80 && test $result != 81; then result=1; fi
exit $result
) 2>/dev/null
malloc_result=$?
echo "Skipping test: cannot trust address space size when running under QEMU"
exit 77
fi
+if test $malloc_result = 80; then
+ echo "Skipping test: address sanitizer's malloc behaves differently"
+ exit 77
+fi
${CHECKER} ./test-dprintf-posix2${EXEEXT} 1 > /dev/null
result=$?
exit 1
fi
-if test $malloc_result = 80; then
+if test $malloc_result = 81; then
echo "Skipping test: get_rusage_as() doesn't work"
exit 77
fi
/* Test of POSIX compatible fprintf() function.
- Copyright (C) 2009-2023 Free Software Foundation, Inc.
+ Copyright (C) 2009-2024 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#else
+/* Skip this test when an address sanitizer is in use, since it would fail. */
+#ifndef __has_feature
+# define __has_feature(a) 0
+#endif
+#if defined __SANITIZE_ADDRESS__ || __has_feature (address_sanitizer)
+
+int
+main ()
+{
+ fprintf (stderr, "Skipping test: address sanitizer's malloc behaves differently\n");
+ return 80;
+}
+
+#else
+
#include <stdlib.h>
#include <string.h>
#include <errno.h>
if (memory == NULL)
return 1;
memset (memory, 17, MAX_ALLOC_TOTAL);
- result = 80;
+ result = 81;
}
else
{
return result;
}
+#endif /* ! address sanitizer enabled */
#endif /* !macOS */
(${CHECKER} ./test-fprintf-posix3${EXEEXT} 0
result=$?
- if test $result != 77 && test $result != 78 && test $result != 79 && test $result != 80; then result=1; fi
+ if test $result != 77 && test $result != 78 && test $result != 79 && test $result != 80 && test $result != 81; then result=1; fi
exit $result
) 2>/dev/null
malloc_result=$?
echo "Skipping test: cannot trust address space size when running under QEMU"
exit 77
fi
+if test $malloc_result = 80; then
+ echo "Skipping test: address sanitizer's malloc behaves differently"
+ exit 77
+fi
${CHECKER} ./test-fprintf-posix3${EXEEXT} 1 > /dev/null
result=$?