From 6e64030afbb3d309f2ea4fddfb8f607cd97de523 Mon Sep 17 00:00:00 2001 From: Geunsik Lim Date: Thu, 28 Jun 2018 10:44:28 +0900 Subject: [PATCH] [Tests] Added check function to inspect dependent commands 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 --- tests/testAPI.sh | 15 +++++++++++++++ tests/testAll.sh | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/tests/testAPI.sh b/tests/testAPI.sh index 0fc2165..b9ef568 100644 --- a/tests/testAPI.sh +++ b/tests/testAPI.sh @@ -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 } + diff --git a/tests/testAll.sh b/tests/testAll.sh index e0d3929..b316281 100755 --- a/tests/testAll.sh +++ b/tests/testAll.sh @@ -3,6 +3,11 @@ dirpath=`dirname $0` source $dirpath/testAPI.sh +checkDependency dirname +checkDependency basename +checkDependency sed +checkDependency find + sopath="" log="" summary="" -- 2.7.4