diff options
author | Lars Volker <lv@cloudera.com> | 2018-01-31 13:29:11 -0800 |
---|---|---|
committer | Ted Mielczarek <ted@mielczarek.org> | 2018-02-20 11:08:52 +0000 |
commit | 49907e1c3457570f56d959ae26dec6c3a5edd417 (patch) | |
tree | f969036a1913824c314ea27a55ac244bdd416cc1 | |
parent | Fix crash when an NSException is thrown. (diff) | |
download | breakpad-49907e1c3457570f56d959ae26dec6c3a5edd417.tar.xz |
Fix Travis build by running tests as root
A recent configuration change made it necessary to run our tests on
Travis as root.
This change also increases the timeout of ParallelChildCrashesDontHang
to make it pass in Travis virtualized containers.
Bug: google-breakpad:753
Change-Id: I6ca8ff4513c6ea3e0646f22457f28b5c4fca6654
Reviewed-on: https://chromium-review.googlesource.com/890564
Reviewed-by: Mike Frysinger <vapier@chromium.org>
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | Makefile.am | 6 | ||||
-rw-r--r-- | Makefile.in | 3 | ||||
-rwxr-xr-x | autotools/root-test-driver | 3 | ||||
-rwxr-xr-x | configure | 37 | ||||
-rw-r--r-- | configure.ac | 19 | ||||
-rwxr-xr-x | scripts/travis-build.sh | 4 |
7 files changed, 70 insertions, 4 deletions
diff --git a/.travis.yml b/.travis.yml index 4a7b775a..628362d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,8 @@ # https://docs.travis-ci.com/ language: cpp +sudo: required + addons: apt: sources: diff --git a/Makefile.am b/Makefile.am index 21e5867a..eac914cf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -446,8 +446,12 @@ if ANDROID_HOST LOG_DRIVER = $(top_srcdir)/android/test-driver else # The default Autotools test driver script. +if TESTS_AS_ROOT +LOG_DRIVER = $(top_srcdir)/autotools/root-test-driver $(top_srcdir)/autotools/test-driver +else LOG_DRIVER = $(top_srcdir)/autotools/test-driver -endif +endif !TESTS_AS_ROOT +endif !ANDROID_HOST if LINUX_HOST src_client_linux_linux_dumper_unittest_helper_SOURCES = \ diff --git a/Makefile.in b/Makefile.in index e53104b1..2bb6b406 100644 --- a/Makefile.in +++ b/Makefile.in @@ -2291,8 +2291,9 @@ CLEANFILES = $(am__append_12) @DISABLE_PROCESSOR_FALSE@ src/processor/minidump_stackwalk_machine_readable_test TESTS = $(check_PROGRAMS) $(check_SCRIPTS) +@ANDROID_HOST_FALSE@@TESTS_AS_ROOT_FALSE@LOG_DRIVER = $(top_srcdir)/autotools/test-driver # The default Autotools test driver script. -@ANDROID_HOST_FALSE@LOG_DRIVER = $(top_srcdir)/autotools/test-driver +@ANDROID_HOST_FALSE@@TESTS_AS_ROOT_TRUE@LOG_DRIVER = $(top_srcdir)/autotools/root-test-driver $(top_srcdir)/autotools/test-driver # Since Autotools 1.2, tests are run through a special "test driver" script. # Unfortunately, it's not possible anymore to specify an alternative shell to diff --git a/autotools/root-test-driver b/autotools/root-test-driver new file mode 100755 index 00000000..66bf7ebb --- /dev/null +++ b/autotools/root-test-driver @@ -0,0 +1,3 @@ +#!/bin/sh +# -E to keep the environment variables needed to run the tests. +exec sudo -E "$@" @@ -626,6 +626,8 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +TESTS_AS_ROOT_FALSE +TESTS_AS_ROOT_TRUE RUST_DEMANGLE_LIBS RUST_DEMANGLE_CFLAGS SELFTEST_FALSE @@ -777,6 +779,7 @@ enable_tools enable_system_test_libs enable_selftest with_rust_demangle +with_tests_as_root ' ac_precious_vars='build_alias host_alias @@ -1444,6 +1447,9 @@ Optional Packages: Link against the rust-demangle library to demangle Rust language symbols during symbol dumping (default is no) Pass the path to the crate root. + --with-tests-as-root Run the tests as root. Use this on platforms like + travis-ci.org that require root privileges to use + ptrace (default is no) Some influential environment variables: CC C compiler command @@ -7870,6 +7876,33 @@ fi + +# Check whether --with-tests-as-root was given. +if test "${with_tests_as_root+set}" = set; then : + withval=$with_tests_as_root; case "${withval}" in + yes) + tests_as_root=true + ;; + no) + tests_as_root=false + ;; + *) + as_fn_error $? "--with-tests-as-root can only be \"yes\" or \"no\"" "$LINENO" 5 + ;; + esac +else + tests_as_root=false +fi + + if test x$tests_as_root = xtrue; then + TESTS_AS_ROOT_TRUE= + TESTS_AS_ROOT_FALSE='#' +else + TESTS_AS_ROOT_TRUE='#' + TESTS_AS_ROOT_FALSE= +fi + + ac_config_files="$ac_config_files breakpad.pc breakpad-client.pc Makefile" @@ -8049,6 +8082,10 @@ if test -z "${SELFTEST_TRUE}" && test -z "${SELFTEST_FALSE}"; then as_fn_error $? "conditional \"SELFTEST\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${TESTS_AS_ROOT_TRUE}" && test -z "${TESTS_AS_ROOT_FALSE}"; then + as_fn_error $? "conditional \"TESTS_AS_ROOT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 diff --git a/configure.ac b/configure.ac index ec194ddd..9cca5aa0 100644 --- a/configure.ac +++ b/configure.ac @@ -246,6 +246,25 @@ AC_ARG_WITH(rust-demangle, AC_ARG_VAR([RUST_DEMANGLE_CFLAGS], [Compiler flags for rust-demangle]) AC_ARG_VAR([RUST_DEMANGLE_LIBS], [Linker flags for rust-demangle]) +AC_ARG_WITH(tests-as-root, + AS_HELP_STRING([--with-tests-as-root], + [Run the tests as root. Use this on platforms] + [like travis-ci.org that require root privileges] + [to use ptrace (default is no)]), + [case "${withval}" in + yes) + tests_as_root=true + ;; + no) + tests_as_root=false + ;; + *) + AC_MSG_ERROR(--with-tests-as-root can only be "yes" or "no") + ;; + esac], + [tests_as_root=false]) +AM_CONDITIONAL(TESTS_AS_ROOT, test x$tests_as_root = xtrue) + AC_CONFIG_FILES(m4_flatten([ breakpad.pc breakpad-client.pc diff --git a/scripts/travis-build.sh b/scripts/travis-build.sh index a5f7ad56..1d1beb3d 100755 --- a/scripts/travis-build.sh +++ b/scripts/travis-build.sh @@ -43,7 +43,7 @@ coverity_scan() { # Do an in-tree build and make sure tests pass. build() { - ./configure + ./configure --with-tests-as-root make -j${JOBS} check VERBOSE=1 make distclean } @@ -52,7 +52,7 @@ build() { build_out_of_tree() { mkdir -p build/native pushd build/native >/dev/null - ../../configure + ../../configure --with-tests-as-root make -j${JOBS} distcheck VERBOSE=1 popd >/dev/null } |