jjb: babeltrace: Add test suite logs to archived artefacts
[lttng-ci.git] / scripts / babeltrace / build.sh
index da5f4ab96ff4ec1aa46a74e75ec5b97abbf72e66..9a5a29a32e8e0a25f7db22b2fedc9aeb9e413869 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash -exu
 #
-# Copyright (C) 2015 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
-#               2016 - Michael Jeanson <mjeanson@efficios.com>
+# Copyright (C) 2015 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
+#               2016-2019 Michael Jeanson <mjeanson@efficios.com>
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -74,7 +74,6 @@ arch=${arch:-}
 conf=${conf:-}
 build=${build:-}
 cc=${cc:-}
-bt2_mode=${bt2_mode:-}
 
 
 SRCDIR="$WORKSPACE/src/babeltrace"
@@ -198,18 +197,9 @@ cd "$SRCDIR"
 eval "$(grep '^PACKAGE_VERSION=' ./configure)"
 
 # Enable dev mode by default for BT 2.0 builds
-case "$bt2_mode" in
-dev)
-    echo "Developer mode"
-    export BABELTRACE_DEBUG_MODE=1
-    export BABELTRACE_DEV_MODE=1
-    export BABELTRACE_MINIMAL_LOG_LEVEL=VERBOSE
-    ;;
-*)
-    echo "Production mode (Default)"
-    export BABELTRACE_MINIMAL_LOG_LEVEL=INFO
-    ;;
-esac
+export BABELTRACE_DEBUG_MODE=1
+export BABELTRACE_DEV_MODE=1
+export BABELTRACE_MINIMAL_LOG_LEVEL=TRACE
 
 # Set configure options for each build configuration
 CONF_OPTS=""
@@ -225,16 +215,41 @@ python-bindings)
     echo "Build with python bindings"
     # We only support bindings built with Python 3
     export PYTHON="python3"
-    export PYTHON_CONFIG="/usr/bin/python3-config"
+    export PYTHON_CONFIG="python3-config"
     CONF_OPTS="--enable-python-bindings"
 
     if vergte "$PACKAGE_VERSION" "2.0"; then
         CONF_OPTS="${CONF_OPTS} --enable-python-bindings-doc --enable-python-plugins"
     fi
     ;;
+prod)
+    echo "Production build"
+
+    # Unset the developper variables
+    unset BABELTRACE_DEBUG_MODE
+    unset BABELTRACE_DEV_MODE
+    unset BABELTRACE_MINIMAL_LOG_LEVEL
+
+    # Enable the python bindings
+    export PYTHON="python3"
+    export PYTHON_CONFIG="python3-config"
+    CONF_OPTS="--enable-python-bindings --enable-python-bindings-doc --enable-python-plugins"
+    ;;
+min)
+    echo "Minimal build"
+    CONF_OPTS=""
+    ;;
 *)
     echo "Standard build"
     CONF_OPTS=""
+
+    # Enable the python bindings / plugins by default with babeltrace2
+    # the test suite is mostly useless without it.
+    if vergte "$PACKAGE_VERSION" "2.0"; then
+        export PYTHON="python3"
+        export PYTHON_CONFIG="python3-config"
+        CONF_OPTS="${CONF_OPTS} --enable-python-bindings --enable-python-plugins"
+    fi
     ;;
 esac
 
@@ -283,8 +298,11 @@ esac
 $MAKE -j "$($NPROC)" V=1
 $MAKE install
 
-# Run tests
+# Run tests, don't fail now, we want to run the archiving steps
+set +e
 $MAKE --keep-going check
+ret=$?
+set -e
 
 # Copy tap logs for the jenkins tap parser
 rsync -a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*' tests/ "$WORKSPACE/tap"
@@ -305,4 +323,7 @@ if [ "$build" = "dist" ]; then
     rm -rf "$BUILD_PATH"
 fi
 
+# Exit with the return code of the test suite
+exit $ret
+
 # EOF
This page took 0.026799 seconds and 4 git commands to generate.