mirror of
https://github.com/systemd/systemd
synced 2024-10-06 16:21:34 +00:00
tests: try to autodetect directory better
Ignore mkosi.builddir. In the future we can also add other patterns if necessary. run-intergration-tests.sh is updated to use the new script, and modified to work from arbitrary directory. Follow-up for #7494.
This commit is contained in:
parent
4fb55f18ea
commit
ded65775a2
|
@ -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
|
|
|
@ -1,4 +1,4 @@
|
||||||
include ../Makefile.guess
|
BUILD_DIR=$(exec ../../tools/find-build-dir.sh)
|
||||||
|
|
||||||
all setup clean run:
|
all setup clean run:
|
||||||
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
|
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include ../Makefile.guess
|
BUILD_DIR=$(exec ../../tools/find-build-dir.sh)
|
||||||
|
|
||||||
all setup run:
|
all setup run:
|
||||||
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
|
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include ../Makefile.guess
|
BUILD_DIR=$(exec ../../tools/find-build-dir.sh)
|
||||||
|
|
||||||
all setup clean run:
|
all setup clean run:
|
||||||
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
|
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include ../Makefile.guess
|
BUILD_DIR=$(exec ../../tools/find-build-dir.sh)
|
||||||
|
|
||||||
all setup clean run:
|
all setup clean run:
|
||||||
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
|
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include ../Makefile.guess
|
BUILD_DIR=$(exec ../../tools/find-build-dir.sh)
|
||||||
|
|
||||||
all setup clean run:
|
all setup clean run:
|
||||||
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
|
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
|
||||||
|
|
|
@ -1,21 +1,19 @@
|
||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
if ! test -d ../build ; then
|
BUILD_DIR="$($(dirname "$0")/../tools/find-build-dir.sh)"
|
||||||
echo "Expected build directory in ../build, but couldn't find it." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
ninja -C ../build
|
ninja -C "$BUILD_DIR"
|
||||||
|
|
||||||
declare -A results
|
declare -A results
|
||||||
|
|
||||||
RESULT=0
|
RESULT=0
|
||||||
FAILURES=0
|
FAILURES=0
|
||||||
|
|
||||||
|
cd "$(dirname "$0")"
|
||||||
for TEST in TEST-??-* ; do
|
for TEST in TEST-??-* ; do
|
||||||
echo -e "\n--x-- Starting $TEST --x--"
|
echo -e "\n--x-- Starting $TEST --x--"
|
||||||
set +e
|
set +e
|
||||||
make -C "$TEST" BUILD_DIR=$(pwd)/../build clean setup run
|
make -C "$TEST" "BUILD_DIR=$BUILD_DIR" clean setup run
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
set -e
|
set -e
|
||||||
echo "--x-- Result of $TEST: $RESULT --x--"
|
echo "--x-- Result of $TEST: $RESULT --x--"
|
||||||
|
|
31
tools/find-build-dir.sh
Executable file
31
tools/find-build-dir.sh
Executable file
|
@ -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)"
|
Loading…
Reference in a new issue