Bruno Haible
2017-05-19 07:14:26 UTC
Out of curiosity, I configured and ran a gnulib testdir with
CFLAGS="-ggdb -O -fsanitize=undefined".
Here are the results.
FAIL: test-get-rusage-data
==========================
../../gltests/test-get-rusage-data.c:60: assertion 'value3 > value1' failed
FAIL test-get-rusage-data (exit status: 134)
The values are:
value1=0x39000
value2=0x39000
value3=0x39000
Apparently glibc uses mmap() for large mallocs, and mmap()ed memory does not
count as part of the "data segment".
2017-05-19 Bruno Haible <***@clisp.org>
get-rusage-data tests: Avoid failure on Linux/glibc.
* tests/test-get-rusage-data.c (main): Don't expect a strict increase
on glibc systems.
diff --git a/tests/test-get-rusage-data.c b/tests/test-get-rusage-data.c
index 7577535..c5989e3 100644
--- a/tests/test-get-rusage-data.c
+++ b/tests/test-get-rusage-data.c
@@ -55,7 +55,7 @@ main ()
ASSERT (value2 >= value1);
ASSERT (value3 >= value2);
-#if !((defined __APPLE__ && defined __MACH__) || defined __DragonFly__ || defined __OpenBSD__ || (defined _WIN32 || defined __WIN32__) || defined __CYGWIN__)
+#if !(__GLIBC__ == 2 || (defined __APPLE__ && defined __MACH__) || defined __DragonFly__ || defined __OpenBSD__ || (defined _WIN32 || defined __WIN32__) || defined __CYGWIN__)
/* Allocating 2.5 MB of memory should increase the data segment size. */
ASSERT (value3 > value1);
#endif
CFLAGS="-ggdb -O -fsanitize=undefined".
Here are the results.
FAIL: test-get-rusage-data
==========================
../../gltests/test-get-rusage-data.c:60: assertion 'value3 > value1' failed
FAIL test-get-rusage-data (exit status: 134)
The values are:
value1=0x39000
value2=0x39000
value3=0x39000
Apparently glibc uses mmap() for large mallocs, and mmap()ed memory does not
count as part of the "data segment".
2017-05-19 Bruno Haible <***@clisp.org>
get-rusage-data tests: Avoid failure on Linux/glibc.
* tests/test-get-rusage-data.c (main): Don't expect a strict increase
on glibc systems.
diff --git a/tests/test-get-rusage-data.c b/tests/test-get-rusage-data.c
index 7577535..c5989e3 100644
--- a/tests/test-get-rusage-data.c
+++ b/tests/test-get-rusage-data.c
@@ -55,7 +55,7 @@ main ()
ASSERT (value2 >= value1);
ASSERT (value3 >= value2);
-#if !((defined __APPLE__ && defined __MACH__) || defined __DragonFly__ || defined __OpenBSD__ || (defined _WIN32 || defined __WIN32__) || defined __CYGWIN__)
+#if !(__GLIBC__ == 2 || (defined __APPLE__ && defined __MACH__) || defined __DragonFly__ || defined __OpenBSD__ || (defined _WIN32 || defined __WIN32__) || defined __CYGWIN__)
/* Allocating 2.5 MB of memory should increase the data segment size. */
ASSERT (value3 > value1);
#endif