From 9b75292c335ca4d4f93ba91db92d4de1f0269e93 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Wed, 4 Mar 2020 15:45:47 +1100 Subject: [PATCH] tests: Honour $(NO_PYTHON) flag from Makefile in run_tests.sh Currently the test script bases whether to run the Python tests on whether it can see a built Python module. That can easily be fooled if there is a stale module there. Instead, have it actually look at the NO_PYTHON variable exported from the Makefile. If the variable doesn't exist (such as if we're running the script manually) fall back on the old logic. Signed-off-by: David Gibson --- tests/run_tests.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 6fed97a..7abcb03 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -11,6 +11,20 @@ if [ -z "$PYTHON" ]; then PYTHON=python3 fi +if [ -n "$NO_PYTHON" ]; then + if [ "$NO_PYTHON" != "0" ]; then + no_python=true + else + no_python=false + fi +else + if [ -f ../pylibfdt/_libfdt.so ] || [ -f ../pylibfdt/_libfdt.cpython-3*.so ]; then + no_python=false + else + no_python=true + fi +fi + # stat differs between platforms if [ -z "$STATSZ" ]; then stat --version 2>/dev/null | grep -q 'GNU' @@ -1016,7 +1030,7 @@ if [ -z "$TESTSETS" ]; then TESTSETS="libfdt utilfdt dtc dtbs_equal fdtget fdtput fdtdump fdtoverlay" # Test pylibfdt if the libfdt Python module is available. - if [ -f ../pylibfdt/_libfdt.so ] || [ -f ../pylibfdt/_libfdt.cpython-3*.so ]; then + if ! $no_python; then TESTSETS="$TESTSETS pylibfdt" fi fi