Add an internal struct layout test.
A downstream user of bionic has a test that requires the sizes and
offsets of various fields in pthread_internal_t to be consistent
between x86 and arm32, and between x86_64 and arm64, by checking that
the sizes and offsets match hardcoded constants. Since this test often
makes it difficult to update bionic's internal data structures, add
a test to bionic that does the same thing so that we can remove the
downstream test and make it easier to change internal data structures
in bionic.
Change-Id: Id5bd3f9fae00aa3b50d1b1267e782e26fe6c8369
diff --git a/tests/Android.bp b/tests/Android.bp
index 8760256..bf921c8 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -41,6 +41,9 @@
// We want to test deprecated API too.
"-Wno-deprecated-declarations",
+ // Needed to test pthread_internal_t layout.
+ "-Wno-invalid-offsetof",
+
// For glibc.
"-D__STDC_LIMIT_MACROS",
],
@@ -392,6 +395,7 @@
"string_posix_strerror_r_test.cpp",
"strings_nofortify_test.cpp",
"strings_test.cpp",
+ "struct_layout_test.cpp",
"sstream_test.cpp",
"sys_auxv_test.cpp",
"sys_epoll_test.cpp",