From b52be69e590ac13f30d104cb713cc31348547523 Mon Sep 17 00:00:00 2001 From: "digit@chromium.org" Date: Tue, 9 Oct 2012 17:15:06 +0000 Subject: [PATCH] Fix the Android unit tests. - One of the unit test binaries refused to link due to missing linker flags. - The WriteDSODebug() function now works on Android, so do not special-case it anymore. - Ensure android/run-checks.sh will complain properly if the client unit test suite fails on Android. It used to consider that such failures were acceptable. Note that it still considers failures when running the tools and processor test suite on the device normal (fixing this is a lot harder, and these parts of Breakpad typically never run on a device, but on the host). Review URL: https://breakpad.appspot.com/482002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1066 4c0a9323-5329-0410-9bdc-e9ce6186880e --- Makefile.am | 6 ++- Makefile.in | 8 ++-- android/run-checks.sh | 37 +++++++++++-------- .../linux/minidump_writer/minidump_writer.cc | 4 -- 4 files changed, 31 insertions(+), 24 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7eefdd5e..83c29da6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -388,7 +388,7 @@ if ANDROID_HOST src_client_linux_linux_client_unittest_shlib_SOURCES += \ src/common/android/breakpad_getcontext_unittest.cc src_client_linux_linux_client_unittest_shlib_LDFLAGS += \ - -llog + -llog -lm endif src_client_linux_linux_client_unittest_shlib_DEPENDENCIES = \ @@ -399,6 +399,10 @@ src_client_linux_linux_client_unittest_shlib_DEPENDENCIES = \ src_client_linux_linux_client_unittest_SOURCES = src_client_linux_linux_client_unittest_LDFLAGS = \ -Wl,-rpath,'$$ORIGIN' +if ANDROID_HOST +src_client_linux_linux_client_unittest_LDFLAGS += \ + -llog +endif src_client_linux_linux_client_unittest_LDADD = \ src/client/linux/linux_client_unittest_shlib diff --git a/Makefile.in b/Makefile.in index b490725f..bff22197 100644 --- a/Makefile.in +++ b/Makefile.in @@ -167,6 +167,9 @@ check_PROGRAMS = $(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \ @ANDROID_HOST_TRUE@@LINUX_HOST_TRUE@am__append_17 = \ @ANDROID_HOST_TRUE@@LINUX_HOST_TRUE@ -llog +@ANDROID_HOST_TRUE@@LINUX_HOST_TRUE@am__append_18 = \ +@ANDROID_HOST_TRUE@@LINUX_HOST_TRUE@ -llog + noinst_PROGRAMS = subdir = . DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \ @@ -1581,9 +1584,8 @@ TESTS = $(check_PROGRAMS) $(check_SCRIPTS) @LINUX_HOST_TRUE@ src/libbreakpad.a @LINUX_HOST_TRUE@src_client_linux_linux_client_unittest_SOURCES = -@LINUX_HOST_TRUE@src_client_linux_linux_client_unittest_LDFLAGS = \ -@LINUX_HOST_TRUE@ -Wl,-rpath,'$$ORIGIN' - +@LINUX_HOST_TRUE@src_client_linux_linux_client_unittest_LDFLAGS = \ +@LINUX_HOST_TRUE@ -Wl,-rpath,'$$ORIGIN' $(am__append_18) @LINUX_HOST_TRUE@src_client_linux_linux_client_unittest_LDADD = \ @LINUX_HOST_TRUE@ src/client/linux/linux_client_unittest_shlib diff --git a/android/run-checks.sh b/android/run-checks.sh index bdfae8b7..400f7561 100755 --- a/android/run-checks.sh +++ b/android/run-checks.sh @@ -369,28 +369,33 @@ else ACTION="Running" TESTS_ENVIRONMENT= fi -if [ "$ALL_TESTS" ]; then - dump "$ACTION full Android unit tests." -else - dump "$ACTION Android client library unit tests." -fi ( PATH="$NDK_STANDALONE/bin:$PATH" run cd "$TMPDIR"/build-target && - if [ -z "$ALL_TESTS" ]; then - # Reconfigure to avoid building the unit tests for the tools - # and processor, unless --all-tests is used. + # Reconfigure to only run the client unit test suite. + # This one should _never_ fail. + dump "$ACTION Android client library unit tests." + run2 "$PROGDIR"/../configure --prefix="$TMPTARGET" \ + --host="$GNU_CONFIG" \ + --disable-tools \ + --disable-processor && + run make -j$NUM_JOBS check $TESTS_ENVIRONMENT || exit $? + + if [ "$ALL_TESTS" ]; then + dump "$ACTION Tools and processor unit tests." + # Reconfigure to run the processor and tools tests. + # Most of these fail for now, so do not worry about it. run2 "$PROGDIR"/../configure --prefix="$TMPTARGET" \ - --host="$GNU_CONFIG" \ - --disable-tools \ - --disable-processor - fi && - run make -j$NUM_JOBS check $TESTS_ENVIRONMENT + --host="$GNU_CONFIG" && + run make -j$NUM_JOBS check $TESTS_ENVIRONMENT + if [ $? != 0 ]; then + dump "Tools and processor unit tests failed as expected. \ +Use --verbose for results." + fi + fi ) -if [ -z "$NO_DEVICE" ] && verbosity_is_lower_than 2; then - dump " Unit tests failed as expected. Use --verbose to see results." -fi +fail_panic "Client library unit test suite failed!" # Copy sources to temporary directory PROJECT_DIR=$TMPDIR/project diff --git a/src/client/linux/minidump_writer/minidump_writer.cc b/src/client/linux/minidump_writer/minidump_writer.cc index 43ad05b6..5a0f8c14 100644 --- a/src/client/linux/minidump_writer/minidump_writer.cc +++ b/src/client/linux/minidump_writer/minidump_writer.cc @@ -983,9 +983,6 @@ class MinidumpWriter { } bool WriteDSODebugStream(MDRawDirectory* dirent) { -#if defined(__ANDROID__) - return false; -#else ElfW(Phdr)* phdr = reinterpret_cast(dumper_->auxv()[AT_PHDR]); char* base; int phnum = dumper_->auxv()[AT_PHNUM]; @@ -1106,7 +1103,6 @@ class MinidumpWriter { delete[] dso_debug_data; return true; -#endif } private: