Fix bugs and add libc to verify_bionic_outputs We weren't passing all the symbols for verification, resulting in falsely passing tests. Deleted symbols verified against Soong arm64 build of libdl_android Test: bazel test build/bazel/test/bionic:verify_bionic_outputs Change-Id: Ida2e05b5ecd9919ecb40b601bbb33a2e37760dd6
diff --git a/tests/bionic/BUILD b/tests/bionic/BUILD index f87e1a7..14e1064 100644 --- a/tests/bionic/BUILD +++ b/tests/bionic/BUILD
@@ -5,8 +5,9 @@ name = "verify_bionic_outputs", srcs = ["verify_bionic_outputs.sh"], data = [ - "//bionic/linker:ld-android", + "//bionic/libc:libc", "//bionic/libdl:libdl_android", + "//bionic/linker:ld-android", "//prebuilts/clang/host/linux-x86:test_tools", ], env = {"CLANG_DEFAULT_VERSION": DEFAULT_VERSION},
diff --git a/tests/bionic/verify_bionic_outputs.sh b/tests/bionic/verify_bionic_outputs.sh index 006cdcd..3c323ea 100755 --- a/tests/bionic/verify_bionic_outputs.sh +++ b/tests/bionic/verify_bionic_outputs.sh
@@ -25,10 +25,10 @@ function assert_contains_regex() { local needle="$1" local haystack="$2" - local message="${3:-Expected regexp "$needle" not found in "$haystack"}" + local message="${3:-Expected regexp "$needle" not found in\n"$haystack"}" echo "${haystack}" | grep "${needle}" && return 0 - echo "$message" + echo -e "$message" exit 1 } @@ -49,10 +49,9 @@ # Test that the shared library contains a symbol function test_shared_library_symbols() { local filepath="$(readlink -f $1)"; shift - local symbols="$1"; shift + local symbols=("$@"); shift local nm_output="$($NM -D "${filepath}")" - for symbol in "${symbols[@]}" - do + for symbol in "${symbols[@]}"; do assert_contains_regex "${symbol}" "${nm_output}" done } @@ -91,7 +90,7 @@ _db_dlactivity ) - test_shared_library_symbols "${shared_library}" "${symbols}" + test_shared_library_symbols "${shared_library}" "${symbols[@]}" } function test_libdl_android() { @@ -110,18 +109,56 @@ android_link_namespaces android_set_application_target_sdk_version android_update_LD_LIBRARY_PATH - __loader_android_create_namespace - __loader_android_dlwarning - __loader_android_get_exported_namespace - __loader_android_get_LD_LIBRARY_PATH - __loader_android_init_anonymous_namespace - __loader_android_link_namespaces - __loader_android_set_application_target_sdk_version - __loader_android_update_LD_LIBRARY_PATH ) - test_shared_library_symbols "${shared_library}" "${symbols}" + test_shared_library_symbols "${shared_library}" "${symbols[@]}" +} + +function test_libc() { + local shared_library="$(rlocation __main__/bionic/libc/liblibc_bp2build_cc_library_shared.so)" + local static_library="$(rlocation __main__/bionic/libc/liblibc_bp2build_cc_library_static.a)" + + test_is_shared_library "${shared_library}" + test_is_static_library "${static_library}" + + symbols=( + __libc_get_static_tls_bounds + __libc_register_thread_exit_callback + __libc_iterate_dynamic_tls + __libc_register_dynamic_tls_listeners + android_reset_stack_guards + ffsl + ffsll + pidfd_getfd + pidfd_open + pidfd_send_signal + process_madvise + # TODO(b/190703122): identify why symbols are missing from libc + # __deregister_frame # apex llndk arm64 x86 x86_64 + # __register_frame # apex llndk arm64 x86 x86_64 + # _Unwind_Backtrace # apex llndk + # _Unwind_DeleteException # apex llndk + # _Unwind_Find_FDE # apex llndk + # _Unwind_FindEnclosingFunction # apex llndk + # _Unwind_ForcedUnwind # apex llndk arm64 x86 x86_64 + # _Unwind_GetCFA # apex llndk + # _Unwind_GetDataRelBase # apex llndk + # _Unwind_GetGR # apex llndk + # _Unwind_GetIP # apex llndk + # _Unwind_GetIPInfo # apex llndk + # _Unwind_GetLanguageSpecificData # apex llndk + # _Unwind_GetRegionStart # apex llndk + # _Unwind_GetTextRelBase # apex llndk + # _Unwind_RaiseException # apex llndk + # _Unwind_Resume # apex llndk + # _Unwind_Resume_or_Rethrow # apex llndk + # _Unwind_SetGR # apex llndk + # _Unwind_SetIP # apex llndk + ) + + test_shared_library_symbols "${shared_library}" "${symbols[@]}" } test_ld-android test_libdl_android +test_libc