mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-11-30 20:44:15 +01:00
Fix 'make check' for Android
This patch allows 'make check' to work when performing an Automake-based build of Breakpad for Android. This requires to have an Android device connected, and the 'adb' tool in your path. You can test that with something like: configure --host=arm-linux-androideabi make check This is achieved by adding a new small shell script under android/test-shell.sh, which is invoked by the Makefile (see TESTS_ENVIRONMENT definition in Makefile.am). By default, this runs all unit tests, including those for the processor and tools (which normally never run on an Android device). Note that the test suites fails (e.g. 11 failing tests for the client library). This will be addressed in later patches. + Modify android/run-checks.sh to run the client library test suite on the device by default. + Add a new option (--all-tests) to android/run-checks.sh which forces it to run the unit test suite for the host binaries, and the full suite on the Android device. + Update README.ANDROID appropriately. Review URL: https://breakpad.appspot.com/441002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1023 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
02f664dbf4
commit
fa064e215b
10
Makefile.am
10
Makefile.am
@ -301,7 +301,13 @@ check_SCRIPTS = \
|
||||
endif
|
||||
|
||||
TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
|
||||
|
||||
if ANDROID_HOST
|
||||
# Wrapper script to run unit test programs on a connected Android device.
|
||||
TESTS_ENVIRONMENT = $(top_srcdir)/android/test-shell.sh
|
||||
else
|
||||
TESTS_ENVIRONMENT =
|
||||
endif
|
||||
|
||||
if LINUX_HOST
|
||||
src_client_linux_linux_dumper_unittest_helper_SOURCES = \
|
||||
@ -314,10 +320,12 @@ src_client_linux_linux_client_unittest_SOURCES = \
|
||||
src/client/linux/handler/exception_handler_unittest.cc \
|
||||
src/client/linux/minidump_writer/directory_reader_unittest.cc \
|
||||
src/client/linux/minidump_writer/line_reader_unittest.cc \
|
||||
src/client/linux/minidump_writer/linux_core_dumper.cc \
|
||||
src/client/linux/minidump_writer/linux_core_dumper_unittest.cc \
|
||||
src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc \
|
||||
src/client/linux/minidump_writer/minidump_writer_unittest.cc \
|
||||
src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc \
|
||||
src/common/linux/elf_core_dump.cc \
|
||||
src/common/linux/linux_libc_support_unittest.cc \
|
||||
src/common/linux/tests/crash_generator.cc \
|
||||
src/common/memory_unittest.cc \
|
||||
@ -342,13 +350,11 @@ src_client_linux_linux_client_unittest_LDADD = \
|
||||
src/client/linux/log/log.o \
|
||||
src/client/linux/crash_generation/crash_generation_client.o \
|
||||
src/client/linux/minidump_writer/linux_dumper.o \
|
||||
src/client/linux/minidump_writer/linux_core_dumper.o \
|
||||
src/client/linux/minidump_writer/linux_ptrace_dumper.o \
|
||||
src/client/linux/minidump_writer/minidump_writer.o \
|
||||
src/client/minidump_file_writer.o \
|
||||
src/common/convert_UTF.o \
|
||||
src/common/md5.o \
|
||||
src/common/linux/elf_core_dump.o \
|
||||
src/common/linux/elfutils.o \
|
||||
src/common/linux/file_id.o \
|
||||
src/common/linux/guid_creator.o \
|
||||
|
51
Makefile.in
51
Makefile.in
@ -414,10 +414,12 @@ am__src_client_linux_linux_client_unittest_SOURCES_DIST = \
|
||||
src/client/linux/handler/exception_handler_unittest.cc \
|
||||
src/client/linux/minidump_writer/directory_reader_unittest.cc \
|
||||
src/client/linux/minidump_writer/line_reader_unittest.cc \
|
||||
src/client/linux/minidump_writer/linux_core_dumper.cc \
|
||||
src/client/linux/minidump_writer/linux_core_dumper_unittest.cc \
|
||||
src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc \
|
||||
src/client/linux/minidump_writer/minidump_writer_unittest.cc \
|
||||
src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc \
|
||||
src/common/linux/elf_core_dump.cc \
|
||||
src/common/linux/linux_libc_support_unittest.cc \
|
||||
src/common/linux/tests/crash_generator.cc \
|
||||
src/common/memory_unittest.cc src/common/tests/file_utils.cc \
|
||||
@ -429,10 +431,12 @@ am__src_client_linux_linux_client_unittest_SOURCES_DIST = \
|
||||
@LINUX_HOST_TRUE@am_src_client_linux_linux_client_unittest_OBJECTS = src/client/linux/handler/src_client_linux_linux_client_unittest-exception_handler_unittest.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-directory_reader_unittest.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-line_reader_unittest.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_core_dumper.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_core_dumper_unittest.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_ptrace_dumper_unittest.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-minidump_writer_unittest.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-minidump_writer_unittest_utils.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/common/linux/src_client_linux_linux_client_unittest-elf_core_dump.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/common/linux/src_client_linux_linux_client_unittest-linux_libc_support_unittest.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/common/linux/tests/src_client_linux_linux_client_unittest-crash_generator.$(OBJEXT) \
|
||||
@LINUX_HOST_TRUE@ src/common/src_client_linux_linux_client_unittest-memory_unittest.$(OBJEXT) \
|
||||
@ -1396,7 +1400,10 @@ lib_LIBRARIES = $(am__append_3) $(am__append_5)
|
||||
@DISABLE_PROCESSOR_FALSE@ src/processor/minidump_stackwalk_machine_readable_test
|
||||
|
||||
TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
|
||||
TESTS_ENVIRONMENT =
|
||||
@ANDROID_HOST_FALSE@TESTS_ENVIRONMENT =
|
||||
|
||||
# Wrapper script to run unit test programs on a connected Android device.
|
||||
@ANDROID_HOST_TRUE@TESTS_ENVIRONMENT = $(top_srcdir)/android/test-shell.sh
|
||||
@LINUX_HOST_TRUE@src_client_linux_linux_dumper_unittest_helper_SOURCES = \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
|
||||
|
||||
@ -1407,10 +1414,12 @@ TESTS_ENVIRONMENT =
|
||||
@LINUX_HOST_TRUE@ src/client/linux/handler/exception_handler_unittest.cc \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/directory_reader_unittest.cc \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/line_reader_unittest.cc \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/linux_core_dumper.cc \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/linux_core_dumper_unittest.cc \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/minidump_writer_unittest.cc \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc \
|
||||
@LINUX_HOST_TRUE@ src/common/linux/elf_core_dump.cc \
|
||||
@LINUX_HOST_TRUE@ src/common/linux/linux_libc_support_unittest.cc \
|
||||
@LINUX_HOST_TRUE@ src/common/linux/tests/crash_generator.cc \
|
||||
@LINUX_HOST_TRUE@ src/common/memory_unittest.cc \
|
||||
@ -1436,13 +1445,11 @@ TESTS_ENVIRONMENT =
|
||||
@LINUX_HOST_TRUE@ src/client/linux/log/log.o \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/crash_generation/crash_generation_client.o \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/linux_dumper.o \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/linux_core_dumper.o \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/linux_ptrace_dumper.o \
|
||||
@LINUX_HOST_TRUE@ src/client/linux/minidump_writer/minidump_writer.o \
|
||||
@LINUX_HOST_TRUE@ src/client/minidump_file_writer.o \
|
||||
@LINUX_HOST_TRUE@ src/common/convert_UTF.o \
|
||||
@LINUX_HOST_TRUE@ src/common/md5.o \
|
||||
@LINUX_HOST_TRUE@ src/common/linux/elf_core_dump.o \
|
||||
@LINUX_HOST_TRUE@ src/common/linux/elfutils.o \
|
||||
@LINUX_HOST_TRUE@ src/common/linux/file_id.o \
|
||||
@LINUX_HOST_TRUE@ src/common/linux/guid_creator.o \
|
||||
@ -2517,6 +2524,9 @@ src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-director
|
||||
src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-line_reader_unittest.$(OBJEXT): \
|
||||
src/client/linux/minidump_writer/$(am__dirstamp) \
|
||||
src/client/linux/minidump_writer/$(DEPDIR)/$(am__dirstamp)
|
||||
src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_core_dumper.$(OBJEXT): \
|
||||
src/client/linux/minidump_writer/$(am__dirstamp) \
|
||||
src/client/linux/minidump_writer/$(DEPDIR)/$(am__dirstamp)
|
||||
src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_core_dumper_unittest.$(OBJEXT): \
|
||||
src/client/linux/minidump_writer/$(am__dirstamp) \
|
||||
src/client/linux/minidump_writer/$(DEPDIR)/$(am__dirstamp)
|
||||
@ -2529,6 +2539,9 @@ src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-minidump
|
||||
src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-minidump_writer_unittest_utils.$(OBJEXT): \
|
||||
src/client/linux/minidump_writer/$(am__dirstamp) \
|
||||
src/client/linux/minidump_writer/$(DEPDIR)/$(am__dirstamp)
|
||||
src/common/linux/src_client_linux_linux_client_unittest-elf_core_dump.$(OBJEXT): \
|
||||
src/common/linux/$(am__dirstamp) \
|
||||
src/common/linux/$(DEPDIR)/$(am__dirstamp)
|
||||
src/common/linux/src_client_linux_linux_client_unittest-linux_libc_support_unittest.$(OBJEXT): \
|
||||
src/common/linux/$(am__dirstamp) \
|
||||
src/common/linux/$(DEPDIR)/$(am__dirstamp)
|
||||
@ -3174,6 +3187,7 @@ mostlyclean-compile:
|
||||
-rm -f src/client/linux/minidump_writer/minidump_writer.$(OBJEXT)
|
||||
-rm -f src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-directory_reader_unittest.$(OBJEXT)
|
||||
-rm -f src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-line_reader_unittest.$(OBJEXT)
|
||||
-rm -f src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_core_dumper.$(OBJEXT)
|
||||
-rm -f src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_core_dumper_unittest.$(OBJEXT)
|
||||
-rm -f src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_ptrace_dumper_unittest.$(OBJEXT)
|
||||
-rm -f src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-minidump_writer_unittest.$(OBJEXT)
|
||||
@ -3206,6 +3220,7 @@ mostlyclean-compile:
|
||||
-rm -f src/common/linux/linux_libc_support.$(OBJEXT)
|
||||
-rm -f src/common/linux/memory_mapped_file.$(OBJEXT)
|
||||
-rm -f src/common/linux/safe_readlink.$(OBJEXT)
|
||||
-rm -f src/common/linux/src_client_linux_linux_client_unittest-elf_core_dump.$(OBJEXT)
|
||||
-rm -f src/common/linux/src_client_linux_linux_client_unittest-linux_libc_support_unittest.$(OBJEXT)
|
||||
-rm -f src/common/linux/src_common_dumper_unittest-dump_symbols.$(OBJEXT)
|
||||
-rm -f src/common/linux/src_common_dumper_unittest-dump_symbols_unittest.$(OBJEXT)
|
||||
@ -3402,6 +3417,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/client/linux/minidump_writer/$(DEPDIR)/minidump_writer.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/client/linux/minidump_writer/$(DEPDIR)/src_client_linux_linux_client_unittest-directory_reader_unittest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/client/linux/minidump_writer/$(DEPDIR)/src_client_linux_linux_client_unittest-line_reader_unittest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/client/linux/minidump_writer/$(DEPDIR)/src_client_linux_linux_client_unittest-linux_core_dumper.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/client/linux/minidump_writer/$(DEPDIR)/src_client_linux_linux_client_unittest-linux_core_dumper_unittest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/client/linux/minidump_writer/$(DEPDIR)/src_client_linux_linux_client_unittest-linux_ptrace_dumper_unittest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/client/linux/minidump_writer/$(DEPDIR)/src_client_linux_linux_client_unittest-minidump_writer_unittest.Po@am__quote@
|
||||
@ -3462,6 +3478,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/linux_libc_support.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/memory_mapped_file.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/safe_readlink.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/src_client_linux_linux_client_unittest-elf_core_dump.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/src_client_linux_linux_client_unittest-linux_libc_support_unittest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/src_common_dumper_unittest-dump_symbols.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/src_common_dumper_unittest-dump_symbols_unittest.Po@am__quote@
|
||||
@ -3688,6 +3705,20 @@ src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-line_rea
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-line_reader_unittest.obj `if test -f 'src/client/linux/minidump_writer/line_reader_unittest.cc'; then $(CYGPATH_W) 'src/client/linux/minidump_writer/line_reader_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/src/client/linux/minidump_writer/line_reader_unittest.cc'; fi`
|
||||
|
||||
src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_core_dumper.o: src/client/linux/minidump_writer/linux_core_dumper.cc
|
||||
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_core_dumper.o -MD -MP -MF src/client/linux/minidump_writer/$(DEPDIR)/src_client_linux_linux_client_unittest-linux_core_dumper.Tpo -c -o src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_core_dumper.o `test -f 'src/client/linux/minidump_writer/linux_core_dumper.cc' || echo '$(srcdir)/'`src/client/linux/minidump_writer/linux_core_dumper.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) src/client/linux/minidump_writer/$(DEPDIR)/src_client_linux_linux_client_unittest-linux_core_dumper.Tpo src/client/linux/minidump_writer/$(DEPDIR)/src_client_linux_linux_client_unittest-linux_core_dumper.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/client/linux/minidump_writer/linux_core_dumper.cc' object='src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_core_dumper.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_core_dumper.o `test -f 'src/client/linux/minidump_writer/linux_core_dumper.cc' || echo '$(srcdir)/'`src/client/linux/minidump_writer/linux_core_dumper.cc
|
||||
|
||||
src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_core_dumper.obj: src/client/linux/minidump_writer/linux_core_dumper.cc
|
||||
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_core_dumper.obj -MD -MP -MF src/client/linux/minidump_writer/$(DEPDIR)/src_client_linux_linux_client_unittest-linux_core_dumper.Tpo -c -o src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_core_dumper.obj `if test -f 'src/client/linux/minidump_writer/linux_core_dumper.cc'; then $(CYGPATH_W) 'src/client/linux/minidump_writer/linux_core_dumper.cc'; else $(CYGPATH_W) '$(srcdir)/src/client/linux/minidump_writer/linux_core_dumper.cc'; fi`
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) src/client/linux/minidump_writer/$(DEPDIR)/src_client_linux_linux_client_unittest-linux_core_dumper.Tpo src/client/linux/minidump_writer/$(DEPDIR)/src_client_linux_linux_client_unittest-linux_core_dumper.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/client/linux/minidump_writer/linux_core_dumper.cc' object='src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_core_dumper.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_core_dumper.obj `if test -f 'src/client/linux/minidump_writer/linux_core_dumper.cc'; then $(CYGPATH_W) 'src/client/linux/minidump_writer/linux_core_dumper.cc'; else $(CYGPATH_W) '$(srcdir)/src/client/linux/minidump_writer/linux_core_dumper.cc'; fi`
|
||||
|
||||
src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_core_dumper_unittest.o: src/client/linux/minidump_writer/linux_core_dumper_unittest.cc
|
||||
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_core_dumper_unittest.o -MD -MP -MF src/client/linux/minidump_writer/$(DEPDIR)/src_client_linux_linux_client_unittest-linux_core_dumper_unittest.Tpo -c -o src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-linux_core_dumper_unittest.o `test -f 'src/client/linux/minidump_writer/linux_core_dumper_unittest.cc' || echo '$(srcdir)/'`src/client/linux/minidump_writer/linux_core_dumper_unittest.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) src/client/linux/minidump_writer/$(DEPDIR)/src_client_linux_linux_client_unittest-linux_core_dumper_unittest.Tpo src/client/linux/minidump_writer/$(DEPDIR)/src_client_linux_linux_client_unittest-linux_core_dumper_unittest.Po
|
||||
@ -3744,6 +3775,20 @@ src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-minidump
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/client/linux/minidump_writer/src_client_linux_linux_client_unittest-minidump_writer_unittest_utils.obj `if test -f 'src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc'; then $(CYGPATH_W) 'src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc'; else $(CYGPATH_W) '$(srcdir)/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc'; fi`
|
||||
|
||||
src/common/linux/src_client_linux_linux_client_unittest-elf_core_dump.o: src/common/linux/elf_core_dump.cc
|
||||
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/common/linux/src_client_linux_linux_client_unittest-elf_core_dump.o -MD -MP -MF src/common/linux/$(DEPDIR)/src_client_linux_linux_client_unittest-elf_core_dump.Tpo -c -o src/common/linux/src_client_linux_linux_client_unittest-elf_core_dump.o `test -f 'src/common/linux/elf_core_dump.cc' || echo '$(srcdir)/'`src/common/linux/elf_core_dump.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) src/common/linux/$(DEPDIR)/src_client_linux_linux_client_unittest-elf_core_dump.Tpo src/common/linux/$(DEPDIR)/src_client_linux_linux_client_unittest-elf_core_dump.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/common/linux/elf_core_dump.cc' object='src/common/linux/src_client_linux_linux_client_unittest-elf_core_dump.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/common/linux/src_client_linux_linux_client_unittest-elf_core_dump.o `test -f 'src/common/linux/elf_core_dump.cc' || echo '$(srcdir)/'`src/common/linux/elf_core_dump.cc
|
||||
|
||||
src/common/linux/src_client_linux_linux_client_unittest-elf_core_dump.obj: src/common/linux/elf_core_dump.cc
|
||||
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/common/linux/src_client_linux_linux_client_unittest-elf_core_dump.obj -MD -MP -MF src/common/linux/$(DEPDIR)/src_client_linux_linux_client_unittest-elf_core_dump.Tpo -c -o src/common/linux/src_client_linux_linux_client_unittest-elf_core_dump.obj `if test -f 'src/common/linux/elf_core_dump.cc'; then $(CYGPATH_W) 'src/common/linux/elf_core_dump.cc'; else $(CYGPATH_W) '$(srcdir)/src/common/linux/elf_core_dump.cc'; fi`
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) src/common/linux/$(DEPDIR)/src_client_linux_linux_client_unittest-elf_core_dump.Tpo src/common/linux/$(DEPDIR)/src_client_linux_linux_client_unittest-elf_core_dump.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/common/linux/elf_core_dump.cc' object='src/common/linux/src_client_linux_linux_client_unittest-elf_core_dump.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/common/linux/src_client_linux_linux_client_unittest-elf_core_dump.obj `if test -f 'src/common/linux/elf_core_dump.cc'; then $(CYGPATH_W) 'src/common/linux/elf_core_dump.cc'; else $(CYGPATH_W) '$(srcdir)/src/common/linux/elf_core_dump.cc'; fi`
|
||||
|
||||
src/common/linux/src_client_linux_linux_client_unittest-linux_libc_support_unittest.o: src/common/linux/linux_libc_support_unittest.cc
|
||||
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/common/linux/src_client_linux_linux_client_unittest-linux_libc_support_unittest.o -MD -MP -MF src/common/linux/$(DEPDIR)/src_client_linux_linux_client_unittest-linux_libc_support_unittest.Tpo -c -o src/common/linux/src_client_linux_linux_client_unittest-linux_libc_support_unittest.o `test -f 'src/common/linux/linux_libc_support_unittest.cc' || echo '$(srcdir)/'`src/common/linux/linux_libc_support_unittest.cc
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) src/common/linux/$(DEPDIR)/src_client_linux_linux_client_unittest-linux_libc_support_unittest.Tpo src/common/linux/$(DEPDIR)/src_client_linux_linux_client_unittest-linux_libc_support_unittest.Po
|
||||
|
@ -9,6 +9,9 @@ Note that this release only supports ARM-based Android systems.
|
||||
We're working on adding support for x86 and MIPS, but that might
|
||||
require an udpated NDK release.
|
||||
|
||||
IMPORTANT: Currently, Minidump generation only works when a signal is
|
||||
handled by Breakpad. I.e. calling WriteMinidump() directly
|
||||
at runtime will not work.
|
||||
|
||||
I. Building the client library:
|
||||
===============================
|
||||
@ -52,6 +55,9 @@ value, and disable the processor and tools, as in:
|
||||
|
||||
The library will be under src/client/linux/libbreakpad_client.a
|
||||
|
||||
You can also use 'make check' to run the test suite on a connected
|
||||
Android device. This requires the Android 'adb' tool to be in your
|
||||
path.
|
||||
|
||||
II. Using the client library in Android:
|
||||
========================================
|
||||
@ -64,7 +70,10 @@ found at http://code.google.com/p/google-breakpad/wiki/LinuxStarterGuide
|
||||
|
||||
2/ If you're not using ndk-build, you also need to:
|
||||
|
||||
- add $GOOGLE_BREAKPAD_PATH to your compiler include path
|
||||
- add the following to your compiler include search paths:
|
||||
$GOOGLE_BREAKPAD_PATH/src
|
||||
$GOOGLE_BREAKPAD_PATH/src/common/android/include
|
||||
|
||||
- add -llog to your linker flags
|
||||
|
||||
Note that ndk-build does that for your automatically.
|
||||
@ -118,17 +127,18 @@ IV. Verifying the Android build library:
|
||||
========================================
|
||||
|
||||
If you modify Google Breakpad and want to check that it still works correctly
|
||||
on Android, please run the android/run-test-program.sh script which will do all
|
||||
on Android, please run the android/run-checks.sh script which will do all
|
||||
necessary verifications for you. This includes:
|
||||
|
||||
- Rebuilding the full host package
|
||||
- Rebuilding the client library with configure/make
|
||||
- Rebuilding the client library with ndk-build
|
||||
- Building, installing and running a test crasher program on a device
|
||||
- Rebuilding the full host binaries.
|
||||
- Rebuilding the full Android binaries with configure/make.
|
||||
- Rebuilding the client library unit tests, and running them on a device.
|
||||
- Rebuilding the client library with ndk-build.
|
||||
- Building, installing and running a test crasher program on a device.
|
||||
- Extracting the corresponding minidump, dumping the test program symbols
|
||||
and generating a stack trace.
|
||||
- Checking the stack trace for valid source locations.
|
||||
- Checking the generated stack trace for valid source locations.
|
||||
|
||||
For more details, please run:
|
||||
|
||||
android/run-test-program.sh --help-all
|
||||
android/run-checks.sh --help-all
|
||||
|
372
android/common-functions.sh
Executable file
372
android/common-functions.sh
Executable file
@ -0,0 +1,372 @@
|
||||
# Copyright (c) 2012 Google Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the name of Google Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# Collection of common shell functions for 'run-checks.sh' et 'test-shell.sh'
|
||||
|
||||
# All internal variables and functions use an underscore as a prefix
|
||||
# (e.g. _VERBOSE, _ALL_CLEANUPS, etc..).
|
||||
|
||||
# Sanitize the environment
|
||||
export LANG=C
|
||||
export LC_ALL=C
|
||||
|
||||
if [ "$BASH_VERSION" ]; then
|
||||
set -o posix
|
||||
fi
|
||||
|
||||
# Utility functions
|
||||
|
||||
_ALL_CLEANUPS=
|
||||
|
||||
# Register a function to be called when the script exits, even in case of
|
||||
# Ctrl-C, logout, etc.
|
||||
# $1: function name.
|
||||
atexit () {
|
||||
if [ -z "$_ALL_CLEANUPS" ]; then
|
||||
_ALL_CLEANUPS=$1
|
||||
# Ensure a clean exit when the script is:
|
||||
# - Exiting normally (EXIT)
|
||||
# - Interrupted by Ctrl-C (INT)
|
||||
# - Interrupted by log out (HUP)
|
||||
# - Being asked to quit nicely (TERM)
|
||||
# - Being asked to quit and dump core (QUIT)
|
||||
trap "_exit_cleanups \$?" EXIT INT HUP QUIT TERM
|
||||
else
|
||||
_ALL_CLEANUPS="$_ALL_CLEANUPS $1"
|
||||
fi
|
||||
}
|
||||
|
||||
# Called on exit if at least one function was registered with atexit
|
||||
# $1: final exit status code
|
||||
_exit_cleanups () {
|
||||
local CLEANUP CLEANUPS
|
||||
# Ignore calls to atexit during cleanups
|
||||
CLEANUPS=$_ALL_CLEANUPS
|
||||
_ALL_CLEANUPS=
|
||||
for CLEANUP in $CLEANUPS; do
|
||||
($CLEANUP)
|
||||
done
|
||||
exit "$@"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# Dump a panic message then exit.
|
||||
# $1+: message
|
||||
panic () {
|
||||
echo "ERROR: $@" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# If the previous command failed, dump a panic message then exit.
|
||||
# $1+: message.
|
||||
fail_panic () {
|
||||
if [ $? != 0 ]; then
|
||||
panic "$@"
|
||||
fi;
|
||||
}
|
||||
|
||||
_VERBOSE=0
|
||||
|
||||
# Increase verbosity for dump/log/run/run2 functions
|
||||
increase_verbosity () {
|
||||
_VERBOSE=$(( $_VERBOSE + 1 ))
|
||||
}
|
||||
|
||||
# Decrease verbosity
|
||||
decrease_verbosity () {
|
||||
_VERBOSE=$(( $_VERBOSE - 1 ))
|
||||
}
|
||||
|
||||
# Returns success iff verbosity level is higher than a specific value
|
||||
# $1: verbosity level
|
||||
verbosity_is_higher_than () {
|
||||
[ "$_VERBOSE" -gt "$1" ]
|
||||
}
|
||||
|
||||
# Returns success iff verbosity level is lower than a specific value
|
||||
# $1: verbosity level
|
||||
verbosity_is_lower_than () {
|
||||
[ "$_VERBOSE" -le "$1" ]
|
||||
}
|
||||
|
||||
# Dump message to stdout, unless verbosity is < 0, i.e. --quiet was called
|
||||
# $1+: message
|
||||
dump () {
|
||||
if [ "$_VERBOSE" -ge 0 ]; then
|
||||
printf "%s\n" "$*"
|
||||
fi
|
||||
}
|
||||
|
||||
# If --verbose was used, dump a message to stdout.
|
||||
# $1+: message
|
||||
log () {
|
||||
if [ "$_VERBOSE" -ge 1 ]; then
|
||||
printf "%s\n" "$*"
|
||||
fi
|
||||
}
|
||||
|
||||
_RUN_LOG=
|
||||
|
||||
# Set a run log file that can be used to collect the output of commands that
|
||||
# are not displayed.
|
||||
set_run_log () {
|
||||
_RUN_LOG=$1
|
||||
}
|
||||
|
||||
# Run a command. Output depends on $_VERBOSE:
|
||||
# $_VERBOSE <= 0: Run command, store output into the run log
|
||||
# $_VERBOSE >= 1: Dump command, run it, output goest to stdout
|
||||
# Note: Ideally, the command's output would go to the run log for $_VERBOSE >= 1
|
||||
# but the 'tee' tool doesn't preserve the status code of its input pipe
|
||||
# in case of error.
|
||||
run () {
|
||||
local LOGILE
|
||||
if [ "$_RUN_LOG" ]; then
|
||||
LOGFILE=$_RUN_LOG
|
||||
else
|
||||
LOGFILE=/dev/null
|
||||
fi
|
||||
|
||||
if [ "$_VERBOSE" -ge 1 ]; then
|
||||
echo "COMMAND: $@"
|
||||
"$@"
|
||||
else
|
||||
"$@" >>$LOGFILE 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
# Same as run(), but only dump command output for $_VERBOSE >= 2
|
||||
run2 () {
|
||||
local LOGILE
|
||||
if [ "$_RUN_LOG" ]; then
|
||||
LOGFILE=$_RUN_LOG
|
||||
else
|
||||
LOGFILE=/dev/null
|
||||
fi
|
||||
|
||||
if [ "$_VERBOSE" -ge 1 ]; then
|
||||
echo "COMMAND: $@"
|
||||
fi
|
||||
if [ "$_VERBOSE" -ge 2 ]; then
|
||||
"$@"
|
||||
else
|
||||
"$@" >>$LOGFILE 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
# Extract number of cores to speed up the builds
|
||||
# Out: number of CPU cores
|
||||
get_core_count () {
|
||||
case $(uname -s) in
|
||||
Linux)
|
||||
grep -c -e '^processor' /proc/cpuinfo
|
||||
;;
|
||||
Darwin)
|
||||
sysctl -n hw.ncpu
|
||||
;;
|
||||
CYGWIN*|*_NT-*)
|
||||
echo $NUMBER_OF_PROCESSORS
|
||||
;;
|
||||
*)
|
||||
echo 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
# Check for the Android ADB program.
|
||||
#
|
||||
# On success, return nothing, but updates internal variables so later calls to
|
||||
# adb_shell, adb_push, etc.. will work. You can get the path to the ADB program
|
||||
# with adb_get_program if needed.
|
||||
#
|
||||
# On failure, returns 1, and updates the internal adb error message, which can
|
||||
# be retrieved with adb_get_error.
|
||||
#
|
||||
# $1: optional ADB program path.
|
||||
# Return: success or failure.
|
||||
_ADB=
|
||||
_ADB_STATUS=
|
||||
_ADB_ERROR=
|
||||
|
||||
adb_check () {
|
||||
# First, try to find the executable in the path, or the SDK install dir.
|
||||
_ADB=$1
|
||||
if [ -z "$_ADB" ]; then
|
||||
_ADB=$(which adb 2>/dev/null)
|
||||
if [ -z "$_ADB" -a "$ANDROID_SDK_ROOT" ]; then
|
||||
_ADB=$ANDROID_SDK_ROOT/platform-tools/adb
|
||||
if [ ! -f "$_ADB" ]; then
|
||||
_ADB=
|
||||
fi
|
||||
fi
|
||||
if [ -z "$_ADB" ]; then
|
||||
_ADB_STATUS=1
|
||||
_ADB_ERROR="The Android 'adb' tool is not in your path."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
log "Found ADB program: $_ADB"
|
||||
|
||||
# Check that it works correctly
|
||||
local ADB_VERSION
|
||||
ADB_VERSION=$("$_ADB" version 2>/dev/null)
|
||||
case $ADB_VERSION in
|
||||
"Android Debug Bridge "*) # Pass
|
||||
log "Found ADB version: $ADB_VERSION"
|
||||
;;
|
||||
*) # Fail
|
||||
_ADB_ERROR="Your ADB binary reports a bad version ($ADB_VERSION): $_ADB"
|
||||
_ADB_STATUS=1
|
||||
return 1
|
||||
esac
|
||||
|
||||
_ADB_STATUS=0
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
# Return the path to the Android ADB program, if correctly detected.
|
||||
# On failure, return the empty string.
|
||||
# Out: ADB program path (or empty on failure)
|
||||
# Return: success or failure.
|
||||
adb_get_program () {
|
||||
# Return cached value as soon as possible.
|
||||
if [ -z "$_ADB_STATUS" ]; then
|
||||
adb_check $1
|
||||
fi
|
||||
echo "$_ADB"
|
||||
return $_ADB_STATUS
|
||||
}
|
||||
|
||||
# Return the error corresponding to the last ADB function failure.
|
||||
adb_get_error () {
|
||||
echo "$_ADB_ERROR"
|
||||
}
|
||||
|
||||
# Check that there is one device connected through ADB.
|
||||
# In case of failure, use adb_get_error to know why this failed.
|
||||
# $1: Optional adb program path
|
||||
# Return: success or failure.
|
||||
_ADB_DEVICE=
|
||||
_ADB_DEVICE_STATUS=
|
||||
adb_check_device () {
|
||||
if [ "$_ADB_DEVICE_STATUS" ]; then
|
||||
return $_ADB_DEVICE_STATUS
|
||||
fi
|
||||
|
||||
# Check for ADB.
|
||||
if ! adb_check $1; then
|
||||
_ADB_DEVICE_STATUS=$_ADB_STATUS
|
||||
return 1
|
||||
fi
|
||||
|
||||
local ADB_DEVICES NUM_DEVICES FINGERPRINT
|
||||
|
||||
# Count the number of connected devices.
|
||||
ADB_DEVICES=$("$_ADB" devices 2>/dev/null | awk '$2 == "device" { print $1; }')
|
||||
NUM_DEVICES=$(echo "$ADB_DEVICES" | wc -l)
|
||||
case $NUM_DEVICES in
|
||||
0)
|
||||
_ADB_ERROR="No Android device connected. Please connect one to your machine."
|
||||
_ADB_DEVICE_STATUS=1
|
||||
return 1
|
||||
;;
|
||||
1) # Pass
|
||||
# Ensure the same device will be called in later adb_shell calls.
|
||||
export ANDROID_SERIAL=$ADB_DEVICES
|
||||
;;
|
||||
*) # 2 or more devices.
|
||||
if [ "$ANDROID_SERIAL" ]; then
|
||||
ADB_DEVICES=$ANDROID_SERIAL
|
||||
NUM_DEVICES=1
|
||||
else
|
||||
_ADB_ERROR="More than one Android device connected. \
|
||||
Please define ANDROID_SERIAL in your environment"
|
||||
_ADB_DEVICE_STATUS=1
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
_ADB_DEVICE_STATUS=0
|
||||
_ADB_DEVICE=$ADB_DEVICES
|
||||
|
||||
FINGERPRINT=$(adb_shell getprop ro.build.fingerprint)
|
||||
log "Using ADB device: $ANDROID_SERIAL ($FINGERPRINT)"
|
||||
return 0
|
||||
}
|
||||
|
||||
# The 'adb shell' command is pretty hopeless, try to make sense of it by:
|
||||
# 1/ Removing trailing \r from line endings.
|
||||
# 2/ Ensuring the function returns the command's status code.
|
||||
#
|
||||
# $1+: Command
|
||||
# Out: command output (stdout + stderr combined)
|
||||
# Return: command exit status
|
||||
adb_shell () {
|
||||
local RET ADB_LOG
|
||||
# Check for ADB device.
|
||||
adb_check_device || return 1
|
||||
ADB_LOG=$(mktemp "${TMPDIR:-/tmp}/adb-XXXXXXXX")
|
||||
"$_ADB" shell "$@" ";" echo \$? > "$ADB_LOG" 2>&1
|
||||
sed -i -e 's![[:cntrl:]]!!g' "$ADB_LOG" # Remove \r.
|
||||
RET=$(sed -e '$!d' "$ADB_LOG") # Last line contains status code.
|
||||
sed -e '$d' "$ADB_LOG" # Print everything except last line.
|
||||
rm -f "$ADB_LOG"
|
||||
return $RET
|
||||
}
|
||||
|
||||
# Push a file to a device.
|
||||
# $1: source file path
|
||||
# $2: device target file path
|
||||
# Return: success or failure.
|
||||
adb_push () {
|
||||
adb_check_device || return 1
|
||||
run "$_ADB" push "$1" "$2"
|
||||
}
|
||||
|
||||
# Pull a file from a device
|
||||
# $1: device file path
|
||||
# $2: target host file path
|
||||
# Return: success or failure.
|
||||
adb_pull () {
|
||||
adb_check_device || return 1
|
||||
run "$_ADB" pull "$1" "$2"
|
||||
}
|
||||
|
||||
# Same as adb_push, but will panic if the operations didn't succeed.
|
||||
adb_install () {
|
||||
adb_push "$@"
|
||||
fail_panic "Failed to install $1 to the Android device at $2"
|
||||
}
|
||||
|
@ -40,59 +40,14 @@ PROGDIR=$(dirname "$0")
|
||||
PROGDIR=$(cd "$PROGDIR" && pwd)
|
||||
PROGNAME=$(basename "$0")
|
||||
|
||||
# Utility functions
|
||||
|
||||
TMPDIR=
|
||||
|
||||
# Used to exit the program after removing the temporary directory.
|
||||
clean_exit () {
|
||||
if [ "$TMPDIR" ]; then
|
||||
if [ -z "$NO_CLEANUP" ]; then
|
||||
log "Cleaning up: $TMPDIR"
|
||||
rm -rf "$TMPDIR"
|
||||
else
|
||||
dump "Temporary directory contents preserved: $TMPDIR"
|
||||
fi
|
||||
fi
|
||||
exit "$@"
|
||||
}
|
||||
|
||||
# Dump a panic message then exit.
|
||||
panic () {
|
||||
echo "ERROR: $@"
|
||||
clean_exit 1;
|
||||
}
|
||||
|
||||
# If the previous command failed, dump a panic message then exit.
|
||||
fail_panic () {
|
||||
if [ $? != 0 ]; then
|
||||
panic "$@"
|
||||
fi;
|
||||
}
|
||||
|
||||
# Extract number of cores to speed up the builds
|
||||
get_core_count () {
|
||||
case $(uname -s) in
|
||||
Linux)
|
||||
grep -c -e '^processor' /proc/cpuinfo
|
||||
;;
|
||||
Darwin)
|
||||
sysctl -n hw.ncpu
|
||||
;;
|
||||
CYGWIN*|*_NT-*)
|
||||
echo $NUMBER_OF_PROCESSORS
|
||||
;;
|
||||
*)
|
||||
echo 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
. $PROGDIR/common-functions.sh
|
||||
|
||||
DEFAULT_ABI="armeabi"
|
||||
VALID_ABIS="armeabi armeabi-v7a x86 mips"
|
||||
|
||||
ABI=
|
||||
ADB=
|
||||
ALL_TESTS=
|
||||
ENABLE_M32=
|
||||
HELP=
|
||||
HELP_ALL=
|
||||
@ -101,7 +56,6 @@ NO_CLEANUP=
|
||||
NO_DEVICE=
|
||||
NUM_JOBS=$(get_core_count)
|
||||
TMPDIR=
|
||||
VERBOSE=0
|
||||
|
||||
for opt do
|
||||
# The following extracts the value if the option is like --name=<value>.
|
||||
@ -109,6 +63,7 @@ for opt do
|
||||
case $opt in
|
||||
--abi=*) ABI=$optarg;;
|
||||
--adb=*) ADB=$optarg;;
|
||||
--all-tests) ALL_TESTS=true;;
|
||||
--enable-m32) ENABLE_M32=true;;
|
||||
--help|-h|-?) HELP=TRUE;;
|
||||
--help-all) HELP_ALL=true;;
|
||||
@ -117,8 +72,8 @@ for opt do
|
||||
--tmp-dir=*) TMPDIR=$optarg;;
|
||||
--no-cleanup) NO_CLEANUP=true;;
|
||||
--no-device) NO_DEVICE=true;;
|
||||
--quiet) VERBOSE=$(( $VERBOSE - 1 ));;
|
||||
--verbose) VERBOSE=$(( $VERBOSE + 1 ));;
|
||||
--quiet) decrease_verbosity;;
|
||||
--verbose) increase_verbosity;;
|
||||
-*) panic "Invalid option '$opt', see --help for details.";;
|
||||
*) panic "This script doesn't take any parameters. See --help for details."
|
||||
;;
|
||||
@ -180,6 +135,12 @@ if [ "$HELP" -o "$HELP_ALL" ]; then
|
||||
--abi=<name> to override this. Valid ABI names are:
|
||||
|
||||
$VALID_ABIS
|
||||
|
||||
The script will only run the client library unit test on the device
|
||||
by default. You can use --all-tests to also build and run the unit
|
||||
tests for the Breakpad tools and processor, but be warned that this
|
||||
adds several minutes of testing time. --all-tests will also run the
|
||||
host unit tests suite.
|
||||
"
|
||||
|
||||
fi # HELP_ALL
|
||||
@ -197,67 +158,13 @@ if [ "$HELP" -o "$HELP_ALL" ]; then
|
||||
--adb=<path> Specify adb program path.
|
||||
--no-cleanup Don't remove temporary directory after completion.
|
||||
--no-device Do not try to detect devices, nor run crash test.
|
||||
--all-tests Run all unit tests (i.e. tools and processor ones too).
|
||||
--verbose Increase verbosity.
|
||||
--quiet Decrease verbosity."
|
||||
|
||||
clean_exit 0
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Dump message to stdout, unless verbosity is < 0, i.e. --quiet was called
|
||||
dump () {
|
||||
if [ "$VERBOSE" -ge 0 ]; then
|
||||
echo "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# If --verbose was used, dump a message to stdout.
|
||||
log () {
|
||||
if [ "$VERBOSE" -ge 1 ]; then
|
||||
echo "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# Run a command. Output depends on $VERBOSE:
|
||||
# $VERBOSE <= 0: Run command, store output into the run log
|
||||
# $VERBOSE >= 1: Dump command, run it, output goest to stdout
|
||||
# Note: Ideally, the command's output would go to the run log for $VERBOSE >= 1
|
||||
# but the 'tee' tool doesn't preserve the status code of its input pipe
|
||||
# in case of error.
|
||||
run () {
|
||||
local LOGILE
|
||||
if [ "$RUN_LOG" ]; then
|
||||
LOGFILE=$RUN_LOG
|
||||
else
|
||||
LOGFILE=/dev/null
|
||||
fi
|
||||
|
||||
if [ "$VERBOSE" -ge 1 ]; then
|
||||
echo "COMMAND: $@"
|
||||
"$@"
|
||||
else
|
||||
"$@" >>$LOGFILE 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
# Same as run(), but only dump command output for $VERBOSE >= 2
|
||||
run2 () {
|
||||
local LOGILE
|
||||
if [ "$RUN_LOG" ]; then
|
||||
LOGFILE=$RUN_LOG
|
||||
else
|
||||
LOGFILE=/dev/null
|
||||
fi
|
||||
|
||||
if [ "$VERBOSE" -ge 1 ]; then
|
||||
echo "COMMAND: $@"
|
||||
fi
|
||||
if [ "$VERBOSE" -ge 2 ]; then
|
||||
"$@"
|
||||
else
|
||||
"$@" >>$LOGFILE 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
TESTAPP_DIR=$PROGDIR/sample_app
|
||||
|
||||
# Select NDK install directory.
|
||||
@ -277,6 +184,23 @@ if [ ! -f "$NDK_BUILD" ]; then
|
||||
panic "Your NDK directory is not valid (missing ndk-build): $NDK_DIR"
|
||||
fi
|
||||
|
||||
# Ensure the temporary directory is deleted on exit, except if the --no-cleanup
|
||||
# option is used.
|
||||
|
||||
clean_tmpdir () {
|
||||
if [ "$TMPDIR" ]; then
|
||||
if [ -z "$NO_CLEANUP" ]; then
|
||||
log "Cleaning up: $TMPDIR"
|
||||
rm -rf "$TMPDIR"
|
||||
else
|
||||
dump "Temporary directory contents preserved: $TMPDIR"
|
||||
fi
|
||||
fi
|
||||
exit "$@"
|
||||
}
|
||||
|
||||
atexit clean_tmpdir
|
||||
|
||||
# If --tmp-dir=<path> is not used, create a temporary directory.
|
||||
# Otherwise, start by cleaning up the user-provided path.
|
||||
if [ -z "$TMPDIR" ]; then
|
||||
@ -294,101 +218,26 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
# Ensure a clean exit when the script is:
|
||||
# - Interrupted by Ctrl-C (INT)
|
||||
# - Interrupted by log out (HUP)
|
||||
# - Being asked to quit nicely (TERM)
|
||||
# - Being asked to quit and dump core (QUIT)
|
||||
trap "clean_exit 1" INT HUP TERM QUIT
|
||||
|
||||
# The 'adb shell' command is pretty hopeless, try to make sense of it by:
|
||||
# 1/ Removing trailing \r from line endings.
|
||||
# 2/ Ensuring the function returns the command's status code.
|
||||
#
|
||||
adb_shell () {
|
||||
local RET ADB_LOG
|
||||
ADB_LOG=$(mktemp "$TMPDIR/adb-XXXXXXXX")
|
||||
"$ADB" shell "$@" ";" echo \$? > "$ADB_LOG" 2>&1
|
||||
sed -i -e 's![[:cntrl:]]!!g' "$ADB_LOG" # Remove \r.
|
||||
RET=$(sed -e '$!d' "$ADB_LOG") # Last line contains status code.
|
||||
sed -e '$d' "$ADB_LOG" # Print everything except last line.
|
||||
rm -f "$ADB_LOG"
|
||||
return $RET
|
||||
}
|
||||
|
||||
check_for_adb () {
|
||||
local ADB_VERSION ADB_DEVICES NUM_DEVICES FINGERPRINT
|
||||
|
||||
# Auto-detect ADB in current path when needed.
|
||||
if [ -z "$ADB" ]; then
|
||||
ADB=$(which adb 2>/dev/null)
|
||||
if [ -z "$ADB" ]; then
|
||||
panic "The 'adb' tool is not in your path! Use either --no-device to\
|
||||
only check the builds, or --adb=<path> to specify the tool path."
|
||||
fi
|
||||
log "Found ADB path: $ADB"
|
||||
else
|
||||
log "Using ADB path: $ADB"
|
||||
fi
|
||||
|
||||
# Check that it works.
|
||||
ADB_VERSION=$("$ADB" version 2>/dev/null)
|
||||
case $ADB_VERSION in
|
||||
"Android Debug Bridge "*) # Pass.
|
||||
log "Found ADB version: $ADB_VERSION"
|
||||
;;
|
||||
*) # Fail.
|
||||
panic "Your ADB binary does not seem to work: $ADB"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Count the number of connected devices.
|
||||
ADB_DEVICES=$("$ADB" devices 2>/dev/null | awk '$2 == "device" { print $1; }')
|
||||
if [ "$ADB_DEVICES" ]; then
|
||||
NUM_DEVICES=$(echo "$ADB_DEVICES" | wc -l)
|
||||
else
|
||||
NUM_DEVICES=0
|
||||
fi
|
||||
case $NUM_DEVICES in
|
||||
0)
|
||||
panic "No Android device connected! Connect one, or use --no-device \
|
||||
to only check the builds."
|
||||
;;
|
||||
1)
|
||||
export ANDROID_SERIAL=$ADB_DEVICES
|
||||
;;
|
||||
*)
|
||||
if [ "$ANDROID_SERIAL" ]; then
|
||||
ADB_DEVICES=$ANDROID_SERIAL
|
||||
NUM_DEVICES=1
|
||||
else
|
||||
dump "ERROR: More than one Android device connected. Please define \
|
||||
ANDROID_SERIAL"
|
||||
dump " in your environment, or use --no-device to only check \
|
||||
the builds."
|
||||
clean_exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
FINGERPRINT=$(adb_shell getprop ro.build.fingerprint)
|
||||
dump "Using device: $ANDROID_SERIAL ($FINGERPRINT)"
|
||||
}
|
||||
|
||||
if [ -z "$NO_DEVICE" ]; then
|
||||
check_for_adb
|
||||
if ! adb_check_device $ADB; then
|
||||
echo "$(adb_get_error)"
|
||||
echo "Use --no-device to build the code without running any tests."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
BUILD_LOG="$TMPDIR/build.log"
|
||||
RUN_LOG="$TMPDIR/run.log"
|
||||
CRASH_LOG="$TMPDIR/crash.log"
|
||||
|
||||
set_run_log "$RUN_LOG"
|
||||
|
||||
TMPHOST="$TMPDIR/host-local"
|
||||
|
||||
cd "$TMPDIR"
|
||||
|
||||
# Build host version of the tools
|
||||
dump "Building host tools."
|
||||
dump "Building host binaries."
|
||||
CONFIGURE_FLAGS=
|
||||
if [ "$ENABLE_M32" ]; then
|
||||
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-m32"
|
||||
@ -399,14 +248,23 @@ fi
|
||||
run2 "$PROGDIR/../configure" --prefix="$TMPHOST" $CONFIGURE_FLAGS &&
|
||||
run2 make -j$NUM_JOBS install
|
||||
)
|
||||
fail_panic "Can't build host-tools!"
|
||||
fail_panic "Can't build host binaries!"
|
||||
|
||||
if [ "$ALL_TESTS" ]; then
|
||||
dump "Running host unit tests."
|
||||
(
|
||||
run cd "$TMPDIR/build-host" &&
|
||||
run2 make -j$NUM_JOBS check
|
||||
)
|
||||
fail_panic "Host unit tests failed!!"
|
||||
fi
|
||||
|
||||
TMPBIN=$TMPHOST/bin
|
||||
|
||||
# Generate a stand-alone NDK toolchain
|
||||
|
||||
# Extract CPU ABI and architecture from device, if any.
|
||||
if [ "$ADB" ]; then
|
||||
if adb_check_device; then
|
||||
DEVICE_ABI=$(adb_shell getprop ro.product.cpu.abi)
|
||||
DEVICE_ABI2=$(adb_shell getprop ro.product.cpu.abi2)
|
||||
if [ -z "$DEVICE_ABI" ]; then
|
||||
@ -477,15 +335,17 @@ esac
|
||||
NDK_STANDALONE="$TMPDIR/ndk-$ARCH-toolchain"
|
||||
echo "Generating NDK standalone toolchain installation"
|
||||
mkdir -p "$NDK_STANDALONE"
|
||||
# NOTE: The --platform=android-9 is required to provide <regex.h> for GTest.
|
||||
run "$NDK_DIR/build/tools/make-standalone-toolchain.sh" \
|
||||
--arch="$ARCH" \
|
||||
--platform=android-9 \
|
||||
--install-dir="$NDK_STANDALONE"
|
||||
fail_panic "Can't generate standalone NDK toolchain installation!"
|
||||
|
||||
# Rebuild the client library, processor and tools with the auto-tools based
|
||||
# build system. Even though it's not going to be used, this checks that this
|
||||
# still works correctly.
|
||||
echo "Building Android binaries with configure/make"
|
||||
echo "Building full Android binaries with configure/make"
|
||||
TMPTARGET="$TMPDIR/target-local"
|
||||
(
|
||||
PATH="$NDK_STANDALONE/bin:$PATH"
|
||||
@ -498,6 +358,40 @@ TMPTARGET="$TMPDIR/target-local"
|
||||
)
|
||||
fail_panic "Could not rebuild Android binaries!"
|
||||
|
||||
# Build and/or run unit test suite.
|
||||
# If --no-device is used, only rebuild it, otherwise, run in on the
|
||||
# connected device.
|
||||
if [ "$NO_DEVICE" ]; then
|
||||
ACTION="Building"
|
||||
# This is a trick to force the Makefile to ignore running the scripts.
|
||||
TESTS_ENVIRONMENT="TESTS_ENVIRONMENT=true"
|
||||
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.
|
||||
run2 "$PROGDIR"/../configure --prefix="$TMPTARGET" \
|
||||
--host="$GNU_CONFIG" \
|
||||
--disable-tools \
|
||||
--disable-processor
|
||||
fi &&
|
||||
run make -j$NUM_JOBS check $TESTS_ENVIRONMENT
|
||||
)
|
||||
if [ -z "$NO_DEVICE" ] && verbosity_is_lower_than 2; then
|
||||
dump " Unit tests failed as expected. Use --verbose to see results."
|
||||
fi
|
||||
|
||||
# Copy sources to temporary directory
|
||||
PROJECT_DIR=$TMPDIR/project
|
||||
dump "Copying test program sources to: $PROJECT_DIR"
|
||||
@ -510,7 +404,7 @@ fail_panic "Could not copy test program sources to: $PROJECT_DIR"
|
||||
dump "Building test program with ndk-build"
|
||||
export NDK_MODULE_PATH="$PROGDIR"
|
||||
NDK_BUILD_FLAGS="-j$NUM_JOBS"
|
||||
if [ "$VERBOSE" -ge 2 ]; then
|
||||
if verbosity_is_higher_than 1; then
|
||||
NDK_BUILD_FLAGS="$NDK_BUILD_FLAGS NDK_LOG=1 V=1"
|
||||
fi
|
||||
run "$NDK_DIR/ndk-build" -C "$PROJECT_DIR" $NDK_BUILD_FLAGS APP_ABI=$ABI
|
||||
@ -533,7 +427,7 @@ fi
|
||||
# Run the program there
|
||||
dump "Installing test program on device"
|
||||
DEVICE_TMP=/data/local/tmp
|
||||
run "$ADB" push "$TESTAPP_FILE" "$DEVICE_TMP/"
|
||||
adb_push "$TESTAPP_FILE" "$DEVICE_TMP/"
|
||||
fail_panic "Cannot push test program to device!"
|
||||
|
||||
dump "Running test program on device"
|
||||
@ -541,7 +435,7 @@ adb_shell cd "$DEVICE_TMP" "&&" ./$TESTAPP > "$CRASH_LOG" 2>/dev/null
|
||||
if [ $? = 0 ]; then
|
||||
panic "Test program did *not* crash as expected!"
|
||||
fi
|
||||
if [ "$VERBOSE" -ge 1 ]; then
|
||||
if verbosity_is_higher_than 0; then
|
||||
echo -n "Crash log: "
|
||||
cat "$CRASH_LOG"
|
||||
fi
|
||||
@ -554,11 +448,11 @@ if [ -z "$MINIDUMP_NAME" ]; then
|
||||
fi
|
||||
|
||||
dump "Extracting minidump: $MINIDUMP_NAME"
|
||||
run "$ADB" pull "$DEVICE_TMP/$MINIDUMP_NAME" .
|
||||
adb_pull "$DEVICE_TMP/$MINIDUMP_NAME" .
|
||||
fail_panic "Can't extract minidump!"
|
||||
|
||||
dump "Parsing test program symbols"
|
||||
if [ "$VERBOSE" -ge 1 ]; then
|
||||
if verbosity_is_higher_than 1; then
|
||||
log "COMMAND: $TMPBIN/dump_syms \
|
||||
$PROJECT_DIR/obj/local/$ABI/$TESTAPP >$TESTAPP.sym"
|
||||
fi
|
||||
@ -586,7 +480,7 @@ fail_panic "minidump_stackwalk doesn't work!"
|
||||
|
||||
dump "Checking stack trace content"
|
||||
|
||||
if [ "$VERBOSE" -ge 1 ]; then
|
||||
if verbosity_is_higher_than 1; then
|
||||
cat "$BUILD_LOG"
|
||||
fi
|
||||
|
||||
@ -622,7 +516,7 @@ fi
|
||||
LOCATIONS=$(awk '$2 ~ "^test_google_breakpad!.*" { print $3; }' "$BUILD_LOG")
|
||||
|
||||
if [ -z "$LOCATIONS" ]; then
|
||||
if [ "$VERBOSE" -lt 1 ]; then
|
||||
if verbosity_is_lower_than 1; then
|
||||
cat "$BUILD_LOG"
|
||||
fi
|
||||
panic "No source location found in stack trace!"
|
||||
@ -646,8 +540,8 @@ if [ "$BAD_LOCATIONS" ]; then
|
||||
dump "ERROR: Generated stack trace doesn't contain valid source locations:"
|
||||
cat "$BUILD_LOG"
|
||||
echo "Bad locations are: $BAD_LOCATIONS"
|
||||
clean_exit 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "All clear! Congratulations."
|
||||
clean_exit 0
|
||||
|
||||
|
127
android/test-shell.sh
Executable file
127
android/test-shell.sh
Executable file
@ -0,0 +1,127 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2012 Google Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the name of Google Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# A special shell wrapper that can be used to run the Google Breakpad unit
|
||||
# tests on a connected Android device.
|
||||
#
|
||||
# This is designed to be called from the Makefile during 'make check'
|
||||
#
|
||||
|
||||
PROGDIR=$(dirname "$0")
|
||||
PROGNAME=$(basename "$0")
|
||||
. $PROGDIR/common-functions.sh
|
||||
|
||||
# Extract test program name first.
|
||||
TEST_PROGRAM=$1
|
||||
shift
|
||||
|
||||
if [ -z "$TEST_PROGRAM" ]; then
|
||||
panic "No test program/script name on the command-line!"
|
||||
fi
|
||||
|
||||
if [ ! -f "$TEST_PROGRAM" ]; then
|
||||
panic "Can't find test program/script: $TEST_PROGRAM"
|
||||
fi
|
||||
|
||||
# Create test directory on the device
|
||||
TEST_DIR=/data/local/tmp/test-google-breakpad
|
||||
adb_shell mkdir "$TEST_DIR" || panic "Can't create test directory on device"
|
||||
|
||||
# Ensure that it is always removed when the script exits.
|
||||
clean_test_dir () {
|
||||
# Don't care about success/failure, use '$ADB shell' directly.
|
||||
adb_shell rm -r "$TEST_DIR"
|
||||
}
|
||||
|
||||
atexit clean_test_dir
|
||||
|
||||
TEST_PROGRAM_NAME=$(basename "$TEST_PROGRAM")
|
||||
TEST_PROGRAM_DIR=$(dirname "$TEST_PROGRAM")
|
||||
|
||||
# Handle special case(s) here.
|
||||
DATA_FILES=
|
||||
case $TEST_PROGRAM_NAME in
|
||||
linux_client_unittest)
|
||||
# linux_client_unittest will call another executable at runtime, ensure
|
||||
# it is installed too.
|
||||
adb_install "$TEST_PROGRAM_DIR/linux_dumper_unittest_helper" "$TEST_DIR"
|
||||
;;
|
||||
basic_source_line_resolver_unittest)
|
||||
DATA_FILES="module1.out \
|
||||
module2.out \
|
||||
module3_bad.out \
|
||||
module4_bad.out"
|
||||
;;
|
||||
exploitability_unittest)
|
||||
DATA_FILES="scii_read_av.dmp \
|
||||
ascii_read_av_block_write.dmp \
|
||||
ascii_read_av_clobber_write.dmp \
|
||||
ascii_read_av_conditional.dmp \
|
||||
ascii_read_av_non_null.dmp \
|
||||
ascii_read_av_then_jmp.dmp \
|
||||
ascii_read_av_xchg_write.dmp \
|
||||
ascii_write_av.dmp \
|
||||
ascii_write_av_arg_to_call.dmp \
|
||||
exec_av_on_stack.dmp \
|
||||
null_read_av.dmp \
|
||||
null_write_av.dmp \
|
||||
read_av.dmp \
|
||||
null_read_av.dmp \
|
||||
write_av_non_null.dmp"
|
||||
;;
|
||||
fast_source_line_resolver_unittest)
|
||||
DATA_FILES="module0.out \
|
||||
module1.out \
|
||||
module2.out \
|
||||
module3_bad.out \
|
||||
module4_bad.out"
|
||||
;;
|
||||
minidump_processor_unittest|minidump_unittest)
|
||||
DATA_FILES="src/processor/testdata/minidump2.dmp"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Install the data files, their path is relative to the environment
|
||||
# variable 'srcdir'
|
||||
for FILE in $DATA_FILES; do
|
||||
FILEDIR=src/processor/testdata/$(dirname "$FILE")
|
||||
adb_shell mkdir -p "$TEST_DIR/$FILEDIR"
|
||||
adb_install "${srcdir:-.}/$FILE" "$TEST_DIR"/"$FILE"
|
||||
done
|
||||
|
||||
# Copy test program to device
|
||||
adb_install "$TEST_PROGRAM" "$TEST_DIR"
|
||||
|
||||
# Run it
|
||||
adb_shell "cd $TEST_DIR && ./$TEST_PROGRAM_NAME $@"
|
||||
|
||||
# Note: exiting here will call cleanup_exit which will remove the temporary
|
||||
# files from the device.
|
Loading…
Reference in New Issue
Block a user