test-build.sh 1.43 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
#!/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=(
        src/NetworkManager
        src/nm-iface-helper
        src/dhcp/nm-dhcp-helper
        dispatcher/nm-dispatcher
        clients/nm-online
        clients/cli/nmcli
        clients/tui/nmtui
        src/platform/tests/monitor
        src/ndisc/tests/test-ndisc-linux
43 44
        libnm-util/tests/test-libnm-linking
        libnm-glib/libnm-glib-test
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
        $(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