]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
test: only set basedir if it is not set by the invoker
authorLaszlo Gombos <laszlo.gombos@gmail.com>
Wed, 19 Oct 2022 04:07:05 +0000 (04:07 +0000)
committerAntonio Álvarez Feijoo <antonio.feijoo@suse.com>
Mon, 7 Nov 2022 17:04:47 +0000 (18:04 +0100)
Set basedir in test-functions instead of Makefile.
This change will allow to use a different basedir without
modifying Makefiles.

test/Makefile.testdir
test/test-functions

index 5757d0ce8894764aca946a41219e19af44b4616f..64e0d4964cb91549562eb4967f889f60eb5268fb 100644 (file)
@@ -2,11 +2,11 @@
 
 all:
        @$(MAKE) -s --no-print-directory -C ../.. all
-       @V=$(V) basedir="$(realpath ../..)" testdir="$(realpath ../)" ./test.sh --all
+       @V=$(V) testdir="$(realpath ../)" ./test.sh --all
 setup:
        @$(MAKE) --no-print-directory -C ../.. all
-       @basedir="$(realpath ../..)" testdir="$(realpath ../)" ./test.sh --setup
+       @testdir="$(realpath ../)" ./test.sh --setup
 clean:
-       @basedir="$(realpath ../..)" testdir="$(realpath ../)" ./test.sh --clean
+       @testdir="$(realpath ../)" ./test.sh --clean
 run:
-       @basedir="$(realpath ../..)" testdir="$(realpath ../)" ./test.sh --run
+       @testdir="$(realpath ../)" ./test.sh --run
index f2896a9141ac2adfd78ed0b8b923727129e9e00a..d81e9ad01923342165839c3a0174881e8ecfdad9 100644 (file)
@@ -10,6 +10,8 @@ fi
 echo "TESTDIR=\"$TESTDIR\"" > .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
 export TESTDIR
 
+if [[ -z $basedir ]]; then basedir="$(realpath ../..)"; fi
+
 command -v test_check &> /dev/null || test_check() {
     :
 }