]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
ftests: Add support for make distcheck
authorTom Hromatka <tom.hromatka@oracle.com>
Wed, 23 Mar 2022 15:13:27 +0000 (09:13 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 23 Mar 2022 15:13:27 +0000 (09:13 -0600)
make distcheck builds libcgroup in a different directory
from where it runs the tests.  Add smarts to ftests.sh and
ftests-nocontainer.sh to support this case by copying the
requisite python files.  After the tests complete, the
python files are then removed.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
ftests/ftests-nocontainer.sh
ftests/ftests.sh

index ec35eecaa1e28213cbadc1405bf0e92247bf51f7..975ccc34d67d47497bb434f545329c9717aca67a 100755 (executable)
@@ -1,4 +1,26 @@
 #!/bin/bash
 # SPDX-License-Identifier: LGPL-2.1-only
 
-./ftests.py -l 10 -L ftests-nocontainer.log --no-container
+START_DIR=$PWD
+SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
+
+if [ "$START_DIR" != "$SCRIPT_DIR" ]; then
+       cp "$SCRIPT_DIR"/*.py "$START_DIR"
+fi
+
+if [ -d ../../src/python/build/lib.* ]; then
+       pushd ../../src/python/build/lib.*
+       export PYTHONPATH="$PYTHONPATH:$(pwd)"
+       popd
+fi
+
+./ftests.py -l 10 -L "$START_DIR/ftests-nocontainer.py.log" --no-container
+RET=$?
+
+if [ "$START_DIR" != "$SCRIPT_DIR" ]; then
+       rm -f "$START_DIR"/*.py
+       rm -fr "$START_DIR"/__pycache__
+       rm -f ftests-nocontainer.py.log
+fi
+
+exit $RET
index 2ff86a3609fb1709df1655f786b7a9908eebc3cf..f9a425465596302e630a1fb0ed3644966759449a 100755 (executable)
@@ -1,4 +1,26 @@
 #!/bin/bash
 # SPDX-License-Identifier: LGPL-2.1-only
 
-./ftests.py -l 10 -L ftests.log
+START_DIR=$PWD
+SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
+
+if [ "$START_DIR" != "$SCRIPT_DIR" ]; then
+       cp "$SCRIPT_DIR"/*.py "$START_DIR"
+fi
+
+if [ -d ../../src/python/build/lib.* ]; then
+       pushd ../../src/python/build/lib.*
+       export PYTHONPATH="$PYTHONPATH:$(pwd)"
+       popd
+fi
+
+./ftests.py -l 10 -L "$START_DIR/ftests.py.log"
+RET=$?
+
+if [ "$START_DIR" != "$SCRIPT_DIR" ]; then
+       rm -f "$START_DIR"/*.py
+       rm -fr "$START_DIR"/__pycache__
+       rm -f ftests.py.log
+fi
+
+exit $RET