lava: Include test logs in uploaded artifact when make check fails
[lttng-ci.git] / scripts / binutils-gdb / build.sh
index 61fe515ed6329a6ea345c2d68720097c6d623e1c..94bded9d9d0962cae4f434cde9ea7190111b9bdd 100755 (executable)
@@ -150,6 +150,18 @@ SRCDIR="$WORKSPACE/src/binutils-gdb"
 TMPDIR="$WORKSPACE/tmp"
 PREFIX="/build"
 
+function use_ccache()
+{
+    case "$platform" in
+    macos-*)
+        return 1
+        ;;
+    *)
+        return 0
+        ;;
+    esac
+}
+
 # Create tmp directory
 rm -rf "$TMPDIR"
 mkdir -p "$TMPDIR"
@@ -158,14 +170,31 @@ export TMPDIR
 export CFLAGS="-O2 -g -fsanitize=address"
 export CXXFLAGS="-O2 -g -fsanitize=address -D_GLIBCXX_DEBUG=1"
 export LDFLAGS="-fsanitize=address"
-export CC="ccache cc"
-export CXX="ccache c++"
+export CC="cc"
+export CXX="c++"
+
+if use_ccache; then
+       CC="ccache $CC"
+       CXX="ccache $CXX"
+fi
+
+# To make GDB find libcc1.so
+export LD_LIBRARY_PATH="/usr/lib/gcc/x86_64-linux-gnu/11:${LD_LIBRARY_PATH:-}"
 
 # Set platform variables
+export TAR=tar
+export MAKE=make
+
 case "$platform" in
+macos-*)
+    export NPROC="getconf _NPROCESSORS_ONLN"
+    export PATH="/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
+    export CPPFLAGS="-I/opt/local/include"
+    export LDFLAGS="-L/opt/local/lib"
+    export PYTHON="python3.9"
+    export PYTHON_CONFIG="python3.9-config"
+    ;;
 *)
-    export MAKE=make
-    export TAR=tar
     export NPROC=nproc
     ;;
 esac
@@ -178,6 +207,10 @@ if use_ccache; then
        ccache -c
 fi
 
+# This job has been seen generating cores in /tmp, filling and and causing
+# problems.  Remove any leftover core from a previous job.
+rm /tmp/core.* || true
+
 # Enter the source directory
 cd "$SRCDIR"
 
@@ -210,6 +243,12 @@ case "$conf" in
     ;;
 esac
 
+case "$platform" in
+macos-*)
+    CONF_OPTS+=("--disable-werror")
+    ;;
+esac
+
 # Build type
 # oot     : out-of-tree build
 # dist    : build via make dist
@@ -233,10 +272,17 @@ esac
 # We are now inside a configured build directory
 
 # BUILD!
-$MAKE -j "$($NPROC)" V=1 MAKEINFO=/bin/true
+$MAKE -j "$($NPROC)" V=1 MAKEINFO=true
 
 # Install in the workspace
-$MAKE install DESTDIR="$WORKSPACE"
+$MAKE install DESTDIR="$WORKSPACE" MAKEINFO=true
+
+case "$platform" in
+macos-*)
+    # Stop there, don't run tests on macOS.
+    exit 0
+    ;;
+esac
 
 case "$target_board" in
 unix | native-gdbserver | native-extended-gdbserver)
@@ -251,7 +297,10 @@ esac
 
 # Run tests, don't fail now, we know that "make check" is going to fail,
 # since some tests don't pass.
-$MAKE -C gdb --keep-going check -j "$($NPROC)" RUNTESTFLAGS="$RUNTESTFLAGS" FORCE_PARALLEL="1" || true
+$MAKE -C gdb/testsuite site.exp
+# shellcheck disable=SC2016
+echo 'set gdb_test_timeout [expr 5 * $timeout]' >> gdb/testsuite/site.exp
+$MAKE -C gdb --keep-going check RUNTESTFLAGS="$RUNTESTFLAGS" || true
 
 # Copy the dejagnu test results for archiving before cleaning the build dir
 mkdir "${WORKSPACE}/results"
@@ -901,7 +950,7 @@ grep --extended-regexp --regexp="^(FAIL|XPASS|UNRESOLVED|DUPLICATE|ERROR):" "${W
 # For informational purposes: check if some known failure lines did not appear
 # in the gdb.sum.
 echo "Known failures that don't appear in gdb.sum:"
-while read line; do
+while read -r line; do
     if ! grep --silent --fixed-strings "$line" "${WORKSPACE}/results/gdb.sum"; then
         echo "$line"
     fi
This page took 0.073195 seconds and 4 git commands to generate.