jjb: babeltrace: use clang-format-16
[lttng-ci.git] / scripts / binutils-gdb / build.sh
index fd07122f5040d639319f94638e1b6b103d78809f..3d7c561a477f60e75105289a7c2f9ca803a8fe5a 100755 (executable)
 
 set -exu
 
+mktemp_compat() {
+    case "$platform" in
+        macos*)
+            # On MacOSX, mktemp doesn't respect TMPDIR in the same way as many
+            # other systems. Use the final positional argument to force the
+            # tempfile or tempdir to be created inside $TMPDIR, which must
+            # already exist.
+            if [ -n "${TMPDIR}" ] ; then
+                mktemp "${@}" "${TMPDIR}/tmp.XXXXXXXXXX"
+            else
+                mktemp "${@}"
+            fi
+        ;;
+        *)
+            mktemp "${@}"
+        ;;
+    esac
+}
+
+print_header() {
+    set +x
+
+    local message=" $1 "
+    local message_len
+    local padding_len
+
+    message_len="${#message}"
+    padding_len=$(( (80 - (message_len)) / 2 ))
+
+    printf '\n'; printf -- '#%.0s' {1..80}; printf '\n'
+    printf -- '-%.0s' {1..80}; printf '\n'
+    printf -- '#%.0s' $(seq 1 $padding_len); printf '%s' "$message"; printf -- '#%.0s' $(seq 1 $padding_len); printf '\n'
+    printf -- '-%.0s' {1..80}; printf '\n'
+    printf -- '#%.0s' {1..80}; printf '\n\n'
+
+    set -x
+}
+
 failed_configure() {
     # Assume we are in the configured build directory
     echo "#################### BEGIN config.log ####################"
@@ -200,6 +238,8 @@ macos-*)
 esac
 
 # Print build env details
+print_header "Build environment details"
+print_hardware || true
 print_os || true
 print_tooling || true
 
@@ -262,7 +302,7 @@ case "$build" in
     echo "Out of tree build"
 
     # Create and enter a temporary build directory
-    builddir=$(mktemp -d)
+    builddir=$(mktemp_compat -d)
     cd "$builddir"
 
     "$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure
@@ -300,7 +340,7 @@ esac
 $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 -j "$($NPROC)" RUNTESTFLAGS="$RUNTESTFLAGS" FORCE_PARALLEL="1" || true
+$MAKE -C gdb --keep-going check RUNTESTFLAGS="$RUNTESTFLAGS" || true
 
 # Copy the dejagnu test results for archiving before cleaning the build dir
 mkdir "${WORKSPACE}/results"
This page took 0.023129 seconds and 4 git commands to generate.