summaryrefslogtreecommitdiff
path: root/tests/string_posix_strerror_r_test.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-11-12 19:22:48 -0800
committerElliott Hughes <enh@google.com>2014-11-12 19:31:21 -0800
commitfb50057138ef37232dc67c8559fd26719ee26021 (patch)
tree9747848f252d0d6004c39f18c29cce0290593e87 /tests/string_posix_strerror_r_test.cpp
parent468f84107aaf108ac6b3ff389342092c2551f859 (diff)
Fix glibc 2.15 build.
glibc 2.15 has prlimit64, has an unsetenv that's declared nonnull, and hasn't fixed the problems we were having trying to use the POSIX strerror_r in C++ code. Change-Id: I834356a385e5ae55500bd86781691b6c1c9c8300
Diffstat (limited to 'tests/string_posix_strerror_r_test.cpp')
-rw-r--r--tests/string_posix_strerror_r_test.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/tests/string_posix_strerror_r_test.cpp b/tests/string_posix_strerror_r_test.cpp
index 09cebfecc..ae3b41abd 100644
--- a/tests/string_posix_strerror_r_test.cpp
+++ b/tests/string_posix_strerror_r_test.cpp
@@ -15,13 +15,23 @@
*/
#undef _GNU_SOURCE
+#include <features.h> // Get __BIONIC__ or __GLIBC__ so we can tell what we're using.
-// Old versions of glibc (like our current host prebuilt sysroot one) have
-// headers that don't work if you #undef _GNU_SOURCE, which makes it
-// impossible to build this test.
-#include <features.h>
+#if defined(__GLIBC__)
+
+// At the time of writing, libcxx -- which is dragged in by gtest -- assumes
+// declarations from glibc of things that aren't available without __USE_GNU.
+// This means we can't even build this test (which is a problem because that
+// means it doesn't get included in CTS).
+// For glibc 2.15, the symbols in question are:
+// at_quick_exit, quick_exit, vasprintf, strtoll_l, strtoull_l, and strtold_l.
+
+# if __GLIBC_PREREQ(2, 19)
+# error check whether we can build this now...
+# endif
+
+#else
-#if !defined(__GLIBC__)
#include <string.h>
#include <errno.h>
@@ -50,8 +60,5 @@ TEST(string, posix_strerror_r) {
// The POSIX strerror_r sets errno to ERANGE (the GNU one doesn't).
ASSERT_EQ(ERANGE, errno);
}
-#else
-# if __GLIBC_PREREQ(2, 15)
-# error this test should work now
-# endif
+
#endif