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>
This commit is contained in:
Lars Volker 2018-01-31 13:29:11 -08:00 committed by Ted Mielczarek
parent 6bb6c9b26a
commit 49907e1c34
7 changed files with 70 additions and 4 deletions

View File

@ -2,6 +2,8 @@
# https://docs.travis-ci.com/
language: cpp
sudo: required
addons:
apt:
sources:

View File

@ -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 = \

View File

@ -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

3
autotools/root-test-driver Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
# -E to keep the environment variables needed to run the tests.
exec sudo -E "$@"

37
configure vendored
View File

@ -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

View File

@ -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

View File

@ -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
}