-#!/bin/bash -exu
+#!/bin/bash
# shellcheck disable=SC2103
#
# Copyright (C) 2016 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+set -exu
+
# Version compare functions
vercomp () {
set +u
[ "$res" -ne "0" ]
}
+failed_configure() {
+ # Assume we are in the configured build directory
+ echo "#################### BEGIN config.log ####################"
+ cat config.log
+ echo "#################### END config.log ####################"
+
+ # End the build with failure
+ exit 1
+}
+
+set_execute_traversal_bit()
+{
+ path=$1
+
+ level="$path"
+ if [ ! -d "$path" ]; then
+ fail "Path is not a directory"
+ fi
+ while level="$(dirname "$level")"
+ do
+ if [ "$level" = / ]; then
+ break
+ fi
+ chmod a+x "$level"
+ done
+ chmod a+x "$path"
+}
+
# Required variables
WORKSPACE=${WORKSPACE:-}
RUN_TESTS="no"
;;
-macosx)
+macos*)
export MAKE=make
export TAR=tar
export NPROC="getconf _NPROCESSORS_ONLN"
depmod
fi
+# Print build env details
+print_os || true
+print_tooling || true
+
# Enter the source directory
cd "$SRCDIR"
# Most build configs require the python bindings
CONF_OPTS=("--prefix=$PREFIX" "--enable-python-bindings")
+DIST_CONF_OPTS=()
+
# Set configure options and environment variables for each build
# configuration.
case "$conf" in
no-ust)
echo "Build without UST support"
CONF_OPTS+=("$NO_UST")
+ DIST_CONF_OPTS+=("$NO_UST")
;;
agents)
builddir=$(mktemp -d)
cd "$builddir"
- "$SRCDIR/configure" "${CONF_OPTS[@]}"
+ "$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure
;;
dist)
# Run configure and generate the tar file
# in the source directory
- ./configure
+ ./configure "${DIST_CONF_OPTS[@]}" || failed_configure
$MAKE dist
# Create and enter a temporary build directory
$TAR xvf "$SRCDIR"/*.tar.* --strip 1
# Build in extracted source tree
- ./configure "${CONF_OPTS[@]}"
+ ./configure "${CONF_OPTS[@]}" || failed_configure
;;
oot-dist)
cd "$builddir"
# Run configure out of tree and generate the tar file
- "$SRCDIR/configure"
+ "$SRCDIR/configure" "${DIST_CONF_OPTS[@]}" || failed_configure
$MAKE dist
dist_srcdir="$(mktemp -d)"
# Run configure from the extracted distribution tar,
# out of the source tree
- "$dist_srcdir/configure" "${CONF_OPTS[@]}"
+ "$dist_srcdir/configure" "${CONF_OPTS[@]}" || failed_configure
;;
*)
echo "Standard in-tree build"
- ./configure "${CONF_OPTS[@]}"
+ ./configure "${CONF_OPTS[@]}" || failed_configure
;;
esac
# Run 'unit_tests', 2.8 and up has a new test suite
if vergte "$PACKAGE_VERSION" "2.8"; then
+ # It is implied that tests depending on LTTNG_ENABLE_DESTRUCTIVE_TESTS
+ # only run for the root user. Note that here `destructive` means that
+ # operations are performed at the host level (add user etc.) that
+ # effectively modify the host. Running those tests are acceptable on our
+ # CI and root jobs since we always run root tests against a `snapshot`
+ # of the host.
+ if [ "$(id -u)" == "0" ]; then
+ # Allow the traversal of all directories leading to the
+ # DEPS_LIBS directory to enable test app run by temp users to
+ # access lttng-ust.
+ set_execute_traversal_bit "$DEPS_LIB"
+ # Allow `all` to interact with all deps libs.
+ chmod a+rwx -R "$DEPS_LIB"
+ export LTTNG_ENABLE_DESTRUCTIVE_TESTS="will-break-my-system"
+ fi
make --keep-going check || failed_tests=1
rsync -a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*' tests/ "$TAPDIR"
else