[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
dprintf-posix tests: Skip the memory leak test on macOS
From: |
Bruno Haible |
Subject: |
dprintf-posix tests: Skip the memory leak test on macOS |
Date: |
Mon, 03 Jun 2024 15:38:15 +0200 |
On the GitHub CI macOS machines (each of macOS 11, 12, 13, 14), I
occasionally see the test-dprintf-posix2.sh test fail.
This patch will skip this test instead on macOS, like we already
do with the test-fprintf-posix3.sh test.
2024-06-03 Bruno Haible <bruno@clisp.org>
dprintf-posix tests: Skip the memory leak test on macOS.
* tests/test-dprintf-posix2.c: Skip the test on macOS.
(main): Return a different exit code at each point. Allow 100 KB extra
memory consumption.
* tests/test-dprintf-posix2.sh: Update.
diff --git a/tests/test-dprintf-posix2.c b/tests/test-dprintf-posix2.c
index 3263072ebd..6e01d7e782 100644
--- a/tests/test-dprintf-posix2.c
+++ b/tests/test-dprintf-posix2.c
@@ -20,6 +20,20 @@
#include <stdio.h>
+#if defined __APPLE__ && defined __MACH__ /* macOS
*/
+
+/* On macOS 11, 12, 13, 14, this test sometimes fails. Probably for the same
+ reason as mentioned in the comment in test-fprintf-posix3.c. */
+
+int
+main ()
+{
+ fprintf (stderr, "Skipping test: cannot trust address space size on this
platform\n");
+ return 78;
+}
+
+#else
+
/* Skip this test when an address sanitizer is in use, since it would fail. */
#ifndef __has_feature
# define __has_feature(a) 0
@@ -121,16 +135,17 @@ main (int argc, char *argv[])
but should not result in a permanent memory allocation. */
if (dprintf (STDOUT_FILENO, "%011000d\n", 17) == -1
&& errno == ENOMEM)
- return 1;
+ return 2;
}
result = 0;
}
- if (get_rusage_as () > initial_rusage_as + MAX_ALLOC_TOTAL)
- return 1;
+ if (get_rusage_as () > initial_rusage_as + MAX_ALLOC_TOTAL + 100000)
+ return 3;
return result;
}
#endif /* ! address sanitizer enabled */
+#endif /* !macOS */
diff --git a/tests/test-dprintf-posix2.sh b/tests/test-dprintf-posix2.sh
index 12e25bc318..2827f4a209 100755
--- a/tests/test-dprintf-posix2.sh
+++ b/tests/test-dprintf-posix2.sh
@@ -4,7 +4,7 @@
(${CHECKER} ./test-dprintf-posix2${EXEEXT} 0
result=$?
- if test $result != 77 && test $result != 79 && test $result != 80 && test
$result != 81; 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=$?
@@ -12,6 +12,10 @@ if test $malloc_result = 77; then
echo "Skipping test: no way to determine address space size"
exit 77
fi
+if test $malloc_result = 78; then
+ echo "Skipping test: cannot trust address space size on this platform"
+ exit 77
+fi
if test $malloc_result = 79; then
echo "Skipping test: cannot trust address space size when running under QEMU"
exit 77
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- dprintf-posix tests: Skip the memory leak test on macOS,
Bruno Haible <=