diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-12-06 15:09:54 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-12-06 15:16:35 +0100 |
commit | ded65775a28ceeb53829ec2bae1bb7a9947f5856 (patch) | |
tree | c46e4c808c07108e20a2d48d192b006968c33738 /tools | |
parent | 4fb55f18ea31484b437a9cfd43c14f1b9bdc61c6 (diff) | |
download | systemd-ded65775a28ceeb53829ec2bae1bb7a9947f5856.tar.gz |
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.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/find-build-dir.sh | 31 |
1 files changed, 31 insertions, 0 deletions
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)" |