[GBS] Add timeout flag
authorsewon.oh <sewon.oh@samsung.com>
Fri, 9 Nov 2018 07:00:03 +0000 (16:00 +0900)
committerMyungJoo Ham <myungjoo.ham@gmail.com>
Mon, 12 Nov 2018 06:57:15 +0000 (15:57 +0900)
For test or other reasons, add timeout flag to gbs build.

Signed-off-by: sewon.oh <sewon.oh@samsung.com>
packaging/nnstreamer.spec

index 85d9239..1c3cb1f 100644 (file)
@@ -96,25 +96,31 @@ make %{?_smp_mflags}
 ./tests/unittest_plugins --gst-plugin-path=.
 popd
 pushd tests
-# The ssat requires 6~7min to run armv7l binary files in the current CI server.
-# The timeout value is 10min as a heuristic value from our experience.
-timeout=600
-ssat &
-pid=$!
-# CAUTION: Note that you have to keep the coding style of the existing statement
-# in case that you have to update the below statement in the future.
-# a. Do not run repetitive statement(ex. while) to avoid too log messages in the log file.
-# b. Declare appropriate heuristic timeout value
-# c. Do not declare too long sleep time to keep the reasonable waiting time after submitting PR
-(sleep $timeout
-kill $pid
-if [[ "$?" -eq 0 ]]; then
-    echo "[DEBUG] GBS is stopped because of 'ssat' timeout(10min)"
-    exit 124 # 124 is ubuntu status code of timeout
-fi) &
-pid2=$!
-wait $pid
-kill $pid2
+# Able to release timeout while gbs build using option '--define "timeout 1"'
+# Default is to apply time limit.
+%if 0%{?timeout}
+    ssat
+%else 
+    # The ssat requires 6~7min to run armv7l binary files in the current CI server.
+    # The timeout value is 10min as a heuristic value from our experience.
+    timeout=600
+    ssat &
+    pid=$!
+    # CAUTION: Note that you have to keep the coding style of the existing statement 
+    # in case that you have to update the below statement in the future. 
+    # a. Do not run repetitive statement(ex. while) to avoid too log messages in the log file. 
+    # b. Declare appropriate heuristic timeout value
+    # c. Do not declare too long sleep time to keep the reasonable waiting time after submitting PR
+    (sleep $timeout 
+    kill $pid 
+    if [[ "$?" -eq 0 ]]; then
+        echo "[DEBUG] GBS is stopped because of 'ssat' timeout(10min)"
+        exit 124 # 124 is ubuntu status code of timeout
+    fi) &
+    pid2=$!
+    wait $pid
+    kill $pid2
+%endif
 popd
 
 %install