[TEST] Apply background test to grpc
authorgichan <gichan2.jang@samsung.com>
Mon, 25 Jul 2022 05:15:51 +0000 (14:15 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Tue, 26 Jul 2022 07:25:06 +0000 (16:25 +0900)
 - Apply background test to grpc.

Signed-off-by: gichan <gichan2.jang@samsung.com>
tests/nnstreamer_grpc/runTest.sh

index 1d0c872..0507023 100755 (executable)
@@ -70,25 +70,7 @@ fi
 export LD_LIBRARY_PATH=${PATH_TO_PLUGIN_EXTRA}:${LD_LIBRARY_PATH}
 
 NUM_BUFFERS=10
-
 TIMEOUT_SEC=10
-## Check if a pipeline is launched and playing
-function waitformarker {
-  for i in $(seq 1 ${TIMEOUT_SEC})
-  do
-    if [ -f 'marker.log' ]; then
-      markersize=$(${StatCmd_GetSize} marker.log)
-      if [ $markersize -ge 48 ]; then
-        testResult 1 $1 "$2" 0 0
-        return 0
-      fi
-    fi
-    sleep 1
-  done
-  testResult 0 $1 "$2" 0 0
-  exit
-}
-WAIT4MARKER=" videotestsrc num-buffers=1 ! video/x-raw,format=RGB,height=4,width=4 ! filesink location=marker.log "
 
 ## Initial pipelines to generate reference outputs
 # passthrough, other/tensor
@@ -116,10 +98,7 @@ for BLOCKING in "${BLOCKING_LIST[@]}"; do
   fi
 
   # tensor_sink (client) --> tensor_src (server), other/tensor
-  rm -f marker.log
-  gst-launch-1.0 --gst-plugin-path=${PATH_TO_PLUGIN} tensor_src_grpc port=${PORT} num-buffers=${NUM_BUFFERS} idl=${IDL} blocking=${BLOCKING} ! 'other/tensor,dimension=(string)3:640:480,type=(string)uint8,framerate=(fraction)5/1' ! multifilesink async=false location=result_%1d.log ${WAIT4MARKER} &
-  pid=$!
-  waitformarker ${INDEX}-1 "tensor_src_grpc ${INDEX}-1 launching in parallel"
+  gstTestBackground "--gst-plugin-path=${PATH_TO_PLUGIN} tensor_src_grpc port=${PORT} num-buffers=${NUM_BUFFERS} idl=${IDL} blocking=${BLOCKING} ! other/tensor,dimension=3:640:480,type=uint8,framerate=5/1 ! multifilesink async=false location=result_%1d.log" ${INDEX}-1 0 0 ${TIMEOUT_SEC}
   gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=${NUM_BUFFERS} ! video/x-raw,width=640,height=480,framerate=5/1 ! tensor_converter ! tensor_sink_grpc port=${PORT} idl=${IDL} blocking=${BLOCKING}" ${INDEX}-2 0 0 $PERFORMANCE
   kill -9 $pid &> /dev/null
   wait $pid
@@ -134,11 +113,8 @@ for BLOCKING in "${BLOCKING_LIST[@]}"; do
 
   PORT=`python3 ../get_available_port.py`
   # tensor_sink (server) --> tensor_src (client), other/tensor
-  rm -f marker.log
-  gst-launch-1.0 --gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=${NUM_BUFFERS} ! video/x-raw,width=640,height=480,framerate=5/1 ! tensor_converter ! tensor_sink_grpc port=${PORT} server=true idl=${IDL} blocking=${BLOCKING} async=false ${WAIT4MARKER} &
-  pid=$!
-  waitformarker ${INDEX}-1 "tensor-sink_grpc ${INDEX}-1 launching in parallel"
-  gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} tensor_src_grpc port=${PORT} num-buffers=${NUM_BUFFERS} server=false idl=${IDL} blocking=${BLOCKING} ! 'other/tensor,dimension=(string)3:640:480,type=(string)uint8,framerate=(fraction)5/1' ! multifilesink location=result_%1d.log" ${INDEX}-2 0 0 $PERFORMANCE
+  gstTestBackground "--gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=${NUM_BUFFERS} ! video/x-raw,width=640,height=480,framerate=5/1 ! tensor_converter ! tensor_sink_grpc port=${PORT} server=true idl=${IDL} blocking=${BLOCKING} async=false" ${INDEX}-1 0 0 ${TIMEOUT_SEC}
+  gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} tensor_src_grpc port=${PORT} num-buffers=${NUM_BUFFERS} server=false idl=${IDL} blocking=${BLOCKING} ! other/tensor,dimension=3:640:480,type=uint8,framerate=5/1 ! multifilesink location=result_%1d.log" ${INDEX}-2 0 0 $PERFORMANCE
   kill -9 $pid &> /dev/null
   wait $pid
 
@@ -152,10 +128,7 @@ for BLOCKING in "${BLOCKING_LIST[@]}"; do
 
   PORT=`python3 ../get_available_port.py`
   # tensor_sink (client) --> tensor_src (server), other/tensors
-  rm -f marker.log
-  gst-launch-1.0 --gst-plugin-path=${PATH_TO_PLUGIN} tensor_src_grpc port=${PORT} num-buffers=$((NUM_BUFFERS/2)) idl=${IDL} blocking=${BLOCKING} ! 'other/tensors,num_tensors=2,dimensions=(string)3:640:480.3:640:480,types=(string)uint8.uint8,framerate=(fraction)5/1' ! multifilesink async=false location=result_%1d.log ${WAIT4MARKER} &
-  pid=$!
-  waitformarker ${INDEX}-1 "tensor-src-grpc ${INDEX}-1 launching in parallel"
+  gstTestBackground "--gst-plugin-path=${PATH_TO_PLUGIN} tensor_src_grpc port=${PORT} num-buffers=$((NUM_BUFFERS/2)) idl=${IDL} blocking=${BLOCKING} ! other/tensors,num_tensors=2,dimensions=3:640:480.3:640:480,types=uint8.uint8,framerate=5/1 ! multifilesink async=false location=result_%1d.log" ${INDEX}-1 0 0 ${TIMEOUT_SEC}
   gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=${NUM_BUFFERS} ! video/x-raw,width=640,height=480,framerate=5/1 ! tensor_converter frames-per-tensor=2 ! tensor_sink_grpc port=${PORT} idl=${IDL} blocking=${BLOCKING}" ${INDEX}-2 0 0 $PERFORMANCE
   kill -9 $pid &> /dev/null
   wait $pid
@@ -170,11 +143,8 @@ for BLOCKING in "${BLOCKING_LIST[@]}"; do
 
   PORT=`python3 ../get_available_port.py`
   # tensor_sink (server) --> tensor_src (client), other/tensors
-  rm -f marker.log
-  gst-launch-1.0 --gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=${NUM_BUFFERS} ! video/x-raw,width=640,height=480,framerate=5/1 ! tensor_converter frames-per-tensor=2 ! tensor_sink_grpc port=${PORT} server=true idl=${IDL} blocking=${BLOCKING} async=false ${WAIT4MARKER} &
-  pid=$!
-  waitformarker ${INDEX}-1 "tensor-sink-grpc ${INDEX}-1 launching in parallel"
-  gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} tensor_src_grpc port=${PORT} num-buffers=$((NUM_BUFFERS/2)) server=false idl=${IDL} blocking=${BLOCKING} ! 'other/tensors,num_tensors=2,dimensions=(string)3:640:480.3:640:480,types=(string)uint8.uint8,framerate=(fraction)5/1' ! multifilesink location=result_%1d.log" ${INDEX}-2 0 0 $PERFORMANCE
+  gstTestBackground " --gst-plugin-path=${PATH_TO_PLUGIN} videotestsrc num-buffers=${NUM_BUFFERS} ! video/x-raw,width=640,height=480,framerate=5/1 ! tensor_converter frames-per-tensor=2 ! tensor_sink_grpc port=${PORT} server=true idl=${IDL} blocking=${BLOCKING} async=false" ${INDEX}-1 0 0 ${TIMEOUT_SEC}
+  gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} tensor_src_grpc port=${PORT} num-buffers=$((NUM_BUFFERS/2)) server=false idl=${IDL} blocking=${BLOCKING} ! other/tensors,num_tensors=2,dimensions=3:640:480.3:640:480,types=uint8.uint8,framerate=5/1 ! multifilesink location=result_%1d.log" ${INDEX}-2 0 0 $PERFORMANCE
   kill -9 $pid &> /dev/null
   wait $pid