Feature: GstTest in Background
[platform/upstream/SSAT.git] / exampleCase / gstTestBackground / runTest.sh
1 #!/usr/bin/env bash
2
3 if [[ "$SSATAPILOADED" != "1" ]]
4 then
5         SILENT=0
6         INDEPENDENT=1
7         search="ssat-api.sh"
8         source $search
9
10         retcode=$?
11         count=0
12         while (( ${retcode} != 0 ))
13         do
14                 count=$((count+1))
15                 if (( ${count} > 5 ))
16                 then
17                         echo "Cannot find ssat-api.sh"
18                         exit 1
19                 fi
20
21                 search="../${search}"
22                 source $search
23                 retcode=$?
24         done
25         printf "${Blue}Independent Mode${NC}\n"
26 fi
27
28 testInit $1
29
30 command -v gst-launch-1.0 || report
31 command -v gst-inspect-1.0 || report
32
33 filename=$(mktemp)
34 gstTestBackground "videotestsrc num-buffers=5 is-live=true  ! video/x-raw,width=64,height=48,framerate=1/1 ! filesink location=${filename}" GBKG1 0 0 5
35 testResult 1 GBKG1-AFT "After launching the background" 0
36 wait $pid
37 testResult 1 GBKG1-CMP "After the background is completed" 0
38
39 gst-inspect-1.0 udpsrc &> /dev/null
40 val=$?
41 if [ "${val}" == "0" ]; then
42         gstTestBackground "udpsrc ! video/x-raw,width=64,height=48,framerate=1/1 ! fakesink async=false" GBKG2 0 0 5
43         testResult 1 GBKG2-AFT "After launching the background" 0
44         kill $pid
45         testResult 1 GBKG2-CMP "After the background is killed" 0
46
47         gstTestBackground "udpsrc ! video/x-raw,width=64,height=48,framerate=1/1 ! fakesink" GBKG3 0 1 5
48         testResult 1 GBKG3-AFT "After launching the background" 0
49         kill $pid
50         testResult 1 GBKG3-CMP "After the background is killed" 0
51 else
52         testResult 0 GBKG2 "udpsrc-based gst background test failed: udpsrc not found: gst-inspect returns ${val}." 1
53 fi
54
55
56 report