From 5cb608e4fcbe79c708622bf689f9d677c9328090 Mon Sep 17 00:00:00 2001 From: Dongju Chae Date: Thu, 4 Mar 2021 16:05:32 +0900 Subject: [PATCH 1/1] [API] Add timeout mode to gstTest command This patch adds timeout mode to gstTest command. It prevents from possible hanging problems. Signed-off-by: Dongju Chae --- debian/rules | 2 ++ ssat-api.sh | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/debian/rules b/debian/rules index 1f6f2dd..9ab59f3 100755 --- a/debian/rules +++ b/debian/rules @@ -16,5 +16,7 @@ %: dh $@ +override_dh_auto_clean: + rm -f ssat override_dh_auto_install: ln -s ssat.sh ssat diff --git a/ssat-api.sh b/ssat-api.sh index f556198..cae64be 100644 --- a/ssat-api.sh +++ b/ssat-api.sh @@ -306,14 +306,24 @@ function callCompareTest() { ## @param $3 set 1 if this is not critical (don't care if it's pass or fail) ## @param $4 set 1 if this passes if gstLaunch fails. ## @param $5 set 1 to enable PERFORMANCE test. +## @param $6 set a positive value (seconds) to enable timeout mode. function gstTest() { if [[ "$VALGRIND" -eq "1" ]]; then calloutputprefix='valgrind --track-origins=yes' fi - if [[ "${SILENT}" -eq "1" ]]; then - calloutput=$(eval $calloutputprefix gst-launch-1.0 -f -q $1 &> /dev/null) + + if [[ "${6}" -gt "0" ]]; then + if [[ "${SILENT}" -eq "1" ]]; then + calloutput=$(eval timeout ${6} $calloutputprefix gst-launch-1.0 -f -q $1 &> /dev/null) + else + calloutput=$(eval timeout ${6} $calloutputprefix gst-launch-1.0 -f -q $1) + fi else - calloutput=$(eval $calloutputprefix gst-launch-1.0 -f -q $1) + if [[ "${SILENT}" -eq "1" ]]; then + calloutput=$(eval $calloutputprefix gst-launch-1.0 -f -q $1 &> /dev/null) + else + calloutput=$(eval $calloutputprefix gst-launch-1.0 -f -q $1) + fi fi retcode=$? -- 2.7.4