+2020-12-03 Bruno Haible <bruno@clisp.org>
+
+ fprintf-posix-tests: Avoid a 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-fprintf-posix3.c: Skip the test on macOS.
+ (main): Return a different exit code at each point. Allow 100 KB extra
+ memory consumption.
+ * tests/test-fprintf-posix3.sh: Update. Remove the "get_rusage_as()
+ doesn't work" diagnostic.
+
2020-12-02 Paul Eggert <eggert@cs.ucla.edu>
canonicalize: refactor can_mode flag
#include <stdio.h>
+#if defined __APPLE__ && defined __MACH__ /* macOS */
+
+/* On macOS 10.13, this test fails, because the address space size increases
+ by 10 MB to 42 MB during the test's execution. But it's not a malloc
+ leak, as can be seen by running the 'leaks' program. And it does not fail
+ if the test's output is redirected to /dev/null. Probably piping a lot
+ of output to stdout, when not redirected to /dev/null, allocates intermediate
+ buffers in the virtual address space. */
+
+int
+main ()
+{
+ fprintf (stderr, "Skipping test: cannot trust address space size on this platform\n");
+ return 78;
+}
+
+#else
+
#include <stdlib.h>
#include <string.h>
#include <errno.h>
if (memory == NULL)
return 1;
memset (memory, 17, MAX_ALLOC_TOTAL);
- result = 78;
+ result = 80;
}
else
{
but should not result in a permanent memory allocation. */
if (fprintf (stdout, "%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 /* !macOS */
(${CHECKER} ./test-fprintf-posix3${EXEEXT} 0
result=$?
- if test $result != 77 && test $result != 78; then result=1; fi
+ if test $result != 77 && test $result != 78 && test $result != 80; then result=1; fi
exit $result
) 2>/dev/null
malloc_result=$?
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
${CHECKER} ./test-fprintf-posix3${EXEEXT} 1 > /dev/null
result=$?
exit 1
fi
-if test $malloc_result = 78; then
- echo "Skipping test: get_rusage_as() doesn't work"
- exit 77
-fi
-
exit 0