summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/Makefile.guess14
-rw-r--r--test/TEST-01-BASIC/Makefile2
-rw-r--r--test/TEST-13-NSPAWN-SMOKE/Makefile2
-rw-r--r--test/TEST-17-UDEV-WANTS/Makefile2
-rw-r--r--test/TEST-18-FAILUREACTION/Makefile2
-rw-r--r--test/TEST-19-DELEGATE/Makefile2
-rwxr-xr-xtest/run-integration-tests.sh10
-rwxr-xr-xtools/find-build-dir.sh31
8 files changed, 40 insertions, 25 deletions
diff --git a/test/Makefile.guess b/test/Makefile.guess
deleted file mode 100644
index 1916d09a6c..0000000000
--- a/test/Makefile.guess
+++ /dev/null
@@ -1,14 +0,0 @@
-# Try to guess the build directory:
-# we look for subdirectories of ../.. that look like ninja build dirs.
-
-ifeq ($(BUILD_DIR),)
- dirs = $(dir $(wildcard ../../*/.ninja_log))
- ifeq ($(dirs),)
- $(error Cannot guess build dir, set BUILD_DIR)
- endif
- ifneq ($(firstword $(dirs)),$(dirs))
- $(warning Candidates: $(dirs))
- $(error Too many build dirs to pick from, set BUILD_DIR)
- endif
- BUILD_DIR=$(dirs)
-endif
diff --git a/test/TEST-01-BASIC/Makefile b/test/TEST-01-BASIC/Makefile
index b895de8bcb..3a212a07a9 100644
--- a/test/TEST-01-BASIC/Makefile
+++ b/test/TEST-01-BASIC/Makefile
@@ -1,4 +1,4 @@
-include ../Makefile.guess
+BUILD_DIR=$(exec ../../tools/find-build-dir.sh)
all setup clean run:
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
diff --git a/test/TEST-13-NSPAWN-SMOKE/Makefile b/test/TEST-13-NSPAWN-SMOKE/Makefile
index 41cca23c7f..ddcbbc302f 100644
--- a/test/TEST-13-NSPAWN-SMOKE/Makefile
+++ b/test/TEST-13-NSPAWN-SMOKE/Makefile
@@ -1,4 +1,4 @@
-include ../Makefile.guess
+BUILD_DIR=$(exec ../../tools/find-build-dir.sh)
all setup run:
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
diff --git a/test/TEST-17-UDEV-WANTS/Makefile b/test/TEST-17-UDEV-WANTS/Makefile
index b895de8bcb..3a212a07a9 100644
--- a/test/TEST-17-UDEV-WANTS/Makefile
+++ b/test/TEST-17-UDEV-WANTS/Makefile
@@ -1,4 +1,4 @@
-include ../Makefile.guess
+BUILD_DIR=$(exec ../../tools/find-build-dir.sh)
all setup clean run:
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
diff --git a/test/TEST-18-FAILUREACTION/Makefile b/test/TEST-18-FAILUREACTION/Makefile
index b895de8bcb..3a212a07a9 100644
--- a/test/TEST-18-FAILUREACTION/Makefile
+++ b/test/TEST-18-FAILUREACTION/Makefile
@@ -1,4 +1,4 @@
-include ../Makefile.guess
+BUILD_DIR=$(exec ../../tools/find-build-dir.sh)
all setup clean run:
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
diff --git a/test/TEST-19-DELEGATE/Makefile b/test/TEST-19-DELEGATE/Makefile
index b895de8bcb..3a212a07a9 100644
--- a/test/TEST-19-DELEGATE/Makefile
+++ b/test/TEST-19-DELEGATE/Makefile
@@ -1,4 +1,4 @@
-include ../Makefile.guess
+BUILD_DIR=$(exec ../../tools/find-build-dir.sh)
all setup clean run:
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
diff --git a/test/run-integration-tests.sh b/test/run-integration-tests.sh
index 3ece46c771..3a54a8b17c 100755
--- a/test/run-integration-tests.sh
+++ b/test/run-integration-tests.sh
@@ -1,21 +1,19 @@
#!/bin/bash -e
-if ! test -d ../build ; then
- echo "Expected build directory in ../build, but couldn't find it." >&2
- exit 1
-fi
+BUILD_DIR="$($(dirname "$0")/../tools/find-build-dir.sh)"
-ninja -C ../build
+ninja -C "$BUILD_DIR"
declare -A results
RESULT=0
FAILURES=0
+cd "$(dirname "$0")"
for TEST in TEST-??-* ; do
echo -e "\n--x-- Starting $TEST --x--"
set +e
- make -C "$TEST" BUILD_DIR=$(pwd)/../build clean setup run
+ make -C "$TEST" "BUILD_DIR=$BUILD_DIR" clean setup run
RESULT=$?
set -e
echo "--x-- Result of $TEST: $RESULT --x--"
diff --git a/tools/find-build-dir.sh b/tools/find-build-dir.sh
new file mode 100755
index 0000000000..33b40f93f7
--- /dev/null
+++ b/tools/find-build-dir.sh
@@ -0,0 +1,31 @@
+#!/bin/sh -e
+
+# Try to guess the build directory:
+# we look for subdirectories of the parent directory that look like ninja build dirs.
+
+if [ -n "$BUILD_DIR" ]; then
+ echo "$(realpath "$BUILD_DIR")"
+ exit 0
+fi
+
+root="$(dirname "$(realpath "$0")")"
+
+found=
+for i in "$root"/../*/build.ninja; do
+ c="$(dirname $i)"
+ [ -d "$c" ] || continue
+ [ "$(basename "$c")" != mkosi.builddir ] || continue
+
+ if [ -n "$found" ]; then
+ echo 'Found multiple candidates, specify build directory with $BUILD_DIR' >&2
+ exit 2
+ fi
+ found="$c"
+done
+
+if [ -z "$found" ]; then
+ echo 'Specify build directory with $BUILD_DIR' >&2
+ exit 1
+fi
+
+echo "$(realpath $found)"