Merge "Add bionic-unit-tests-gcc{32,64}, compiled with gcc."

am: 9cbabd8fe5

* commit '9cbabd8fe5ef3834682996ff23b4a5325e0586cb':
  Add bionic-unit-tests-gcc{32,64}, compiled with gcc.
This commit is contained in:
Chih-hung Hsieh 2015-12-01 00:27:13 +00:00 committed by android-build-merger
commit d74566026d
2 changed files with 53 additions and 11 deletions

View File

@ -272,18 +272,20 @@ include $(LOCAL_PATH)/Android.build.mk
# Tests for the device using bionic's .so. Run with: # Tests for the device using bionic's .so. Run with:
# adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests32 # adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests32
# adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests64 # adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests64
# adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests-gcc32
# adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests-gcc64
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
bionic-unit-tests_whole_static_libraries := \ common_bionic-unit-tests_whole_static_libraries := \
libBionicTests \ libBionicTests \
libBionicGtestMain \ libBionicGtestMain \
bionic-unit-tests_static_libraries := \ common_bionic-unit-tests_static_libraries := \
libtinyxml2 \ libtinyxml2 \
liblog \ liblog \
libbase \ libbase \
# TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+) # TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
bionic-unit-tests_src_files := \ common_bionic-unit-tests_src_files := \
atexit_test.cpp \ atexit_test.cpp \
dl_test.cpp \ dl_test.cpp \
dlext_test.cpp \ dlext_test.cpp \
@ -293,32 +295,56 @@ bionic-unit-tests_src_files := \
pthread_dlfcn_test.cpp \ pthread_dlfcn_test.cpp \
thread_local_test.cpp \ thread_local_test.cpp \
bionic-unit-tests_cflags := $(test_cflags) common_bionic-unit-tests_cflags := $(test_cflags)
bionic-unit-tests_conlyflags := \ common_bionic-unit-tests_conlyflags := \
-fexceptions \ -fexceptions \
-fnon-call-exceptions \ -fnon-call-exceptions \
bionic-unit-tests_cppflags := $(test_cppflags) common_bionic-unit-tests_cppflags := $(test_cppflags)
bionic-unit-tests_ldflags := \ common_bionic-unit-tests_ldflags := \
-Wl,--export-dynamic -Wl,--export-dynamic
bionic-unit-tests_c_includes := \ common_bionic-unit-tests_c_includes := \
bionic/libc \ bionic/libc \
bionic-unit-tests_shared_libraries_target := \ common_bionic-unit-tests_shared_libraries_target := \
libdl \ libdl \
libpagemap \ libpagemap \
libdl_preempt_test_1 \ libdl_preempt_test_1 \
libdl_preempt_test_2 libdl_preempt_test_2
bionic-unit-tests_shared_libraries_target += libdl_test_df_1_global common_bionic-unit-tests_shared_libraries_target += libdl_test_df_1_global
module := bionic-unit-tests
module_tag := optional module_tag := optional
build_type := target build_type := target
build_target := NATIVE_TEST build_target := NATIVE_TEST
module := bionic-unit-tests
bionic-unit-tests_clang_target := true
bionic-unit-tests_whole_static_libraries := $(common_bionic-unit-tests_whole_static_libraries)
bionic-unit-tests_static_libraries := $(common_bionic-unit-tests_static_libraries)
bionic-unit-tests_src_files := $(common_bionic-unit-tests_src_files)
bionic-unit-tests_cflags := $(common_bionic-unit-tests_cflags)
bionic-unit-tests_conlyflags := $(common_bionic-unit-tests_conlyflags)
bionic-unit-tests_cppflags := $(common_bionic-unit-tests_cppflags)
bionic-unit-tests_ldflags := $(common_bionic-unit-tests_ldflags)
bionic-unit-tests_c_includes := $(common_bionic-unit-tests_c_includes)
bionic-unit-tests_shared_libraries_target := $(common_bionic-unit-tests_shared_libraries_target)
include $(LOCAL_PATH)/Android.build.mk
module := bionic-unit-tests-gcc
bionic-unit-tests-gcc_clang_target := false
bionic-unit-tests-gcc_whole_static_libraries := $(common_bionic-unit-tests_whole_static_libraries)
bionic-unit-tests-gcc_static_libraries := $(common_bionic-unit-tests_static_libraries)
bionic-unit-tests-gcc_src_files := $(common_bionic-unit-tests_src_files)
bionic-unit-tests-gcc_cflags := $(common_bionic-unit-tests_cflags)
bionic-unit-tests-gcc_conlyflags := $(common_bionic-unit-tests_conlyflags)
bionic-unit-tests-gcc_cppflags := $(common_bionic-unit-tests_cppflags)
bionic-unit-tests-gcc_ldflags := $(common_bionic-unit-tests_ldflags)
bionic-unit-tests-gcc_c_includes := $(common_bionic-unit-tests_c_includes)
bionic-unit-tests-gcc_shared_libraries_target := $(common_bionic-unit-tests_shared_libraries_target)
include $(LOCAL_PATH)/Android.build.mk include $(LOCAL_PATH)/Android.build.mk
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------

View File

@ -35,7 +35,12 @@ class ClassWithDtor {
std::string message; std::string message;
}; };
#if defined(__clang__) && defined(__aarch64__)
// b/25642296, aarch64 clang compiled "thread_local" does not link.
static ClassWithDtor class_with_dtor;
#else
static thread_local ClassWithDtor class_with_dtor; static thread_local ClassWithDtor class_with_dtor;
#endif
static void* thread_nop(void* arg) { static void* thread_nop(void* arg) {
class_with_dtor.set_message(*static_cast<std::string*>(arg)); class_with_dtor.set_message(*static_cast<std::string*>(arg));
@ -47,7 +52,12 @@ TEST(thread_local, smoke) {
pthread_t t; pthread_t t;
ASSERT_EQ(0, pthread_create(&t, nullptr, thread_nop, &msg)); ASSERT_EQ(0, pthread_create(&t, nullptr, thread_nop, &msg));
ASSERT_EQ(0, pthread_join(t, nullptr)); ASSERT_EQ(0, pthread_join(t, nullptr));
#if defined(__clang__) && defined(__aarch64__)
GTEST_LOG_(INFO) << "Skipping test, b/25642296, "
<< "thread_local does not work with aarch64 clang/llvm.\n";
#else
ASSERT_EQ("dtor called.", class_with_dtor_output); ASSERT_EQ("dtor called.", class_with_dtor_output);
#endif
} }
class ClassWithDtorForMainThread { class ClassWithDtorForMainThread {
@ -64,7 +74,13 @@ class ClassWithDtorForMainThread {
}; };
static void thread_atexit_main() { static void thread_atexit_main() {
#if defined(__clang__) && defined(__aarch64__)
static ClassWithDtorForMainThread class_with_dtor_for_main_thread;
GTEST_LOG_(INFO) << "Skipping test, b/25642296, "
<< "thread_local does not work with aarch64 clang/llvm.\n";
#else
static thread_local ClassWithDtorForMainThread class_with_dtor_for_main_thread; static thread_local ClassWithDtorForMainThread class_with_dtor_for_main_thread;
#endif
class_with_dtor_for_main_thread.set_message("d-tor for main thread called."); class_with_dtor_for_main_thread.set_message("d-tor for main thread called.");
exit(0); exit(0);
} }