about summary refs log tree commit diff
path: root/tools/test-build.sh
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2024-05-05 00:07:30 +0200
committerMichael Biebl <biebl@debian.org>2024-05-05 00:07:30 +0200
commit34bb501be08aa2b313d88e67d6e0a7e0a3f9cfa6 (patch)
tree4e6220877828be4c6f261de09ec0cb2d80e32389 /tools/test-build.sh
parentbba2e4b4de668db525cbfdfc35292e5a0b51671a (diff)
New upstream version 1.47.90 upstream/1.47.90
Diffstat (limited to 'tools/test-build.sh')
-rwxr-xr-xtools/test-build.sh56
1 files changed, 56 insertions, 0 deletions
diff --git a/tools/test-build.sh b/tools/test-build.sh
new file mode 100755
index 00000000..04d33b6a
--- /dev/null
+++ b/tools/test-build.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+set -e
+
+die() {
+    echo "$@"
+    exit 1
+}
+
+if [[ "x$(LANG=C git clean -ndx)" != x ]]; then
+    die "The working directory is not clean. Refuse to run. Try \`git clean -dx -n\`"
+fi
+if [[ "x$(git status --porcelain)" != x ]]; then
+    die "The working directory has local changes. Refuse to run. Try \`git reset --hard\`"
+fi
+
+build_out_of_tree() {
+  local TARGET="$1"
+  local C="$2"
+  local M="$3"
+  (
+    git clean -fdx || return 1
+    NOCONFIGURE=x ./autogen.sh || return 1
+    mkdir -p x/y || return 1
+    cd x/y || return 1
+    ../../configure $C $NMTST_CONFIGURE || return 1
+     make $TARGET $M $NMTST_MAKE || return 1
+  )
+}
+
+TARGETS=("$@")
+if [ "${#TARGETS}" -lt 1 ]; then
+    TARGETS=(
+        dispatcher/nm-dispatcher
+        src/core/NetworkManager
+        src/core/dhcp/nm-dhcp-helper
+        src/core/ndisc/tests/test-ndisc-linux
+        src/core/platform/tests/monitor
+        src/nm-online/nm-online
+        src/nmcli/nmcli
+        src/nmtui/nmtui
+        $(git grep -h '\.l\?a\>' Makefile.am | sed 's/[a-zA-Z.0-9_-/]\+/\n\0\n/g' | sort -u | grep '\.l\?a$')
+    )
+fi
+
+set -x
+
+cd "$(dirname "$(readlink -f "$0")")/.."
+
+IDX=($(seq 0 $((${#TARGETS[@]} - 1))))
+IDX=($(printf '%s\n' "${IDX[@]}" | sort -R))
+for idx in "${IDX[@]}"; do
+    TARGET="${TARGETS[$idx]}"
+    echo "### $idx: TARGET=$TARGET"
+    build_out_of_tree "$TARGET" "--enable-gtk-doc" "-j 5"
+done