[SSAT] Enable filter_python3 test to run on target
authorAymen Sghaier <aymen.sghaier@nxp.com>
Tue, 1 Mar 2022 14:12:37 +0000 (15:12 +0100)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 7 Mar 2022 23:38:52 +0000 (08:38 +0900)
 - remove exit if build folder not exists
 - bypass pushd failure if build folder not exists

Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
tests/nnstreamer_filter_python3/runTest.sh

index 087ec80..15431c6 100755 (executable)
@@ -37,23 +37,31 @@ if [[ -d $PATH_TO_PLUGIN ]]; then
     fi
 else
     echo "No build directory"
-    report
-    exit
+    # Check if module is installed.
+    if python3 -c "import nnstreamer_python" &> /dev/null; then
+        echo 'nnstreamer_python module exists'
+    else
+        echo 'nnstreamer_python module does not exist'
+        report
+        exit
+    fi
 fi
 
 FRAMEWORK="python3"
-# This symlink is necessary only for testcases; when installed, symlinks will be made
-pushd ../../build/ext/nnstreamer/tensor_filter
-TEST_PYTHONPATH=${FRAMEWORK}_pymodule
-mkdir -p ${TEST_PYTHONPATH}
-pushd ${TEST_PYTHONPATH}
-# Covert to an absolute path from the relative path
-export PYTHONPATH=$(pwd)
-if [[ ! -f ./nnstreamer_python.so ]]; then
-  ln -s ../../extra/nnstreamer_${FRAMEWORK}.so nnstreamer_python.so
+if [[ -d ../../build ]]; then
+    # This symlink is necessary only for testcases; when installed, symlinks will be made
+    pushd ../../build/ext/nnstreamer/tensor_filter
+    TEST_PYTHONPATH=${FRAMEWORK}_pymodule
+    mkdir -p ${TEST_PYTHONPATH}
+    pushd ${TEST_PYTHONPATH}
+    # Covert to an absolute path from the relative path
+    export PYTHONPATH=$(pwd)
+    if [[ ! -f ./nnstreamer_python.so ]]; then
+        ln -s ../../extra/nnstreamer_${FRAMEWORK}.so nnstreamer_python.so
+    fi
+    popd
+    popd
 fi
-popd
-popd
 
 # Passthrough test
 PATH_TO_SCRIPT="../test_models/models/passthrough.py"