[Tests] Added check function to inspect dependent commands
authorGeunsik Lim <geunsik.lim@samsung.com>
Thu, 28 Jun 2018 01:44:28 +0000 (10:44 +0900)
committer함명주/동작제어Lab(SR)/Principal Engineer/삼성전자 <myungjoo.ham@samsung.com>
Thu, 28 Jun 2018 04:10:54 +0000 (13:10 +0900)
This PR is to append a dependency check routine to inspect the required
packages are install before starting tests/testAPI.sh

**Changes proposed in this PR:**
1. Added dependency check function
2. Applied shell commands with checkDependency()
   - gst-launch-1.0, cmp, dirname, basename, sed, and find

**Self assessment:**
1. gbs build: okay
2. local test: okay

Signed-off-by: Geunsik Lim <geunsik.lim@samsung.com>
tests/testAPI.sh
tests/testAll.sh

index 0fc2165..b9ef568 100644 (file)
@@ -18,6 +18,20 @@ declare -i lfail=0
 log=""
 
 ##
+# @brief check if a command is installed
+# @param 1 the command name
+function checkDependency {
+    echo "Checking for $1..."
+    which "$1" 2>/dev/null || {
+      echo "Ooops. '$1' command is not installed. Please install '$1'."
+      exit 1
+    }
+}
+
+checkDependency gst-launch-1.0
+checkDependency cmp
+
+##
 # @brief execute gst-launch based test case
 # @param 1 the whole parameters
 # @param 2 the case number
@@ -98,3 +112,4 @@ function report {
                exit 1
        fi
 }
+
index e0d3929..b316281 100755 (executable)
@@ -3,6 +3,11 @@ dirpath=`dirname $0`
 
 source $dirpath/testAPI.sh
 
+checkDependency dirname
+checkDependency basename
+checkDependency sed
+checkDependency find
+
 sopath=""
 log=""
 summary=""