Pass env variable LD_LIBRARY_PATH while invoking test driver (#1130)
author이성재/동작제어Lab(SR)/Principal Engineer/삼성전자 <sj925.lee@samsung.com>
Tue, 8 May 2018 11:35:07 +0000 (20:35 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Tue, 8 May 2018 11:35:07 +0000 (20:35 +0900)
- introduce `-ldlibrary=` option
- set `$NNFW_HOME/Produce/out/lib` as default value fo LD_LIBRARY_PATH
- pass env variable `LD_LIBRARY_PATH` while invoking test driver

Signed-off-by: Sung-Jae Lee <sjlee@mail.com>
tests/framework/run_test.sh

index 8c7b0b4..4002d16 100755 (executable)
@@ -16,6 +16,7 @@
 
 
 MY_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+NNFW_HOME="$(dirname $(dirname ${MY_PATH}))"
 CACHE_ROOT_PATH=$MY_PATH/"cache"
 TEST_ROOT_PATH=$MY_PATH/"tests"
 REPORT_DIR="report"
@@ -31,10 +32,12 @@ function Usage()
     echo "--driverbin           - (default=../../Product/out/bin/tflite_run) runner for runnning framework tests"
     echo "--reportdir           - (default=report) directory to place tap files"
     echo "--tapname             - (default=framework_test.tap) file name to be written for tap"
+    echo "--ldlibrarypath       - (default=${NNFW_HOME}/Product/out/lib) path to '*.so' files"
     echo ""
 }
 
 DRIVER_BIN=""
+NNFW_LD_LIBRARY_PATH=""
 TAP_NAME="framework_test.tap"
 TEST_LIST=()
 DOWNLOAD_MODE="off"
@@ -57,6 +60,9 @@ do
         --download=*)
             DOWNLOAD_MODE=${i#*=}
             ;;
+        --ldlibrarypath=*)
+            NNFW_LD_LIBRARY_PATH=${i#*=}
+            ;;
         *)
             TEST_LIST+=( $i )
             ;;
@@ -69,7 +75,7 @@ if [[ ${#TEST_LIST[@]} -eq 0 ]]; then
 fi
 
 if [ ! -n "$DRIVER_BIN" ]; then
-    DRIVER_BIN=$MY_PATH/"../../Product/out/bin/tflite_run"
+    DRIVER_BIN="$NNFW_HOME/Product/out/bin/tflite_run"
 fi
 
 # Check test driver setting
@@ -130,7 +136,7 @@ run_tests()
         echo "Run $TEST_NAME"
         echo "======================"
         # Run driver to test framework
-        $DRIVER_BIN $MODELFILE
+        LD_LIBRARY_PATH="${NNFW_LD_LIBRARY_PATH:=$NNFW_HOME/Product/out/lib}:${LD_LIBRARY_PATH}" $DRIVER_BIN $MODELFILE
         RESULT=$?
         if [[ $RESULT -eq 0 ]]; then
             echo "ok $i - $TEST_NAME" >> $REPORT_DIR/$TAP_NAME