1
1
#! /bin/bash
2
2
3
3
# SPDX-License-Identifier: BSD-3-Clause
4
- # Copyright 2022 Intel Corporation
4
+ # Copyright 2022-2025 Intel Corporation
5
5
6
- set -e
6
+ SCRIPT_DIR=" $( readlink -f " $( dirname -- " ${BASH_SOURCE[0]} " ) " ) "
7
+ REPOSITORY_DIR=" $( readlink -f " ${SCRIPT_DIR} /../.." ) "
7
8
8
- ST_PORT_TX=0000:af:01.1
9
- ST_PORT_RX=0000:af:01.0
10
- ST_SIP_TX=192.168.87.80
11
- ST_SIP_RX=192.168.87.81
12
- ST_TX_IP=239.168.87.20
13
- ST_RX_IP=239.168.87.20
14
- TEST_TIME_SEC=15
9
+ # shellcheck source="script/common.sh"
10
+ . " ${REPOSITORY_DIR} /script/common.sh"
15
11
16
- TEST_BIN_PATH=../../build/app
17
- LOG_LEVEL=notice
12
+ ST_PORT_TX=" ${ST_PORT_TX:- ' 0000:af:01.1' } "
13
+ ST_PORT_RX=" ${ST_PORT_RX:- ' 0000:af:01.0' } "
14
+ ST_SIP_TX=" ${ST_SIP_TX:- ' 192.168.87.80' } "
15
+ ST_SIP_RX=" ${ST_SIP_RX:- ' 192.168.87.81' } "
16
+ ST_TX_IP=" ${ST_TX_IP:- ' 239.168.87.20' } "
17
+ ST_RX_IP=" ${ST_RX_IP:- ' 239.168.87.20' } "
18
+ TEST_TIME_SEC=" ${TEST_TIME_SEC:- 15} "
18
19
19
- export KAHAWAI_CFG_PATH=../../kahawai.json
20
+ TEST_BIN_PATH=" ${TEST_BIN_PATH:- " ${REPOSITORY_DIR} /build/app" } "
21
+ LOG_LEVEL=" ${LOG_LEVEL:- notice} "
20
22
21
23
test_tx_and_rx () {
22
24
local name=$1
@@ -30,53 +32,59 @@ test_tx_and_rx() {
30
32
if [ -n " $5 " ]; then
31
33
height=$5
32
34
fi
33
- echo " ${name} : start ${tx_prog} , width:${width} height:${height} "
35
+ log_info " ${name} : start ${tx_prog} , width:${width} height:${height} "
34
36
" ${TEST_BIN_PATH} " /" ${tx_prog} " --log_level " ${LOG_LEVEL} " --p_port " ${ST_PORT_TX} " --p_sip " ${ST_SIP_TX} " --p_tx_ip " ${ST_TX_IP} " --width " ${width} " --height " ${height} " &
35
37
# ${TEST_BIN_PATH}/${tx_prog} > /dev/null --log_level ${LOG_LEVEL} --p_port ${ST_PORT_TX} --p_sip ${ST_SIP_TX} --p_tx_ip ${ST_TX_IP} --width ${width} --height ${height} 2>&1 &
36
38
pid_tx=$!
37
- echo " ${name} : start ${rx_prog} "
39
+ log_info " ${name} : start ${rx_prog} "
38
40
" ${TEST_BIN_PATH} " /" ${rx_prog} " --log_level " ${LOG_LEVEL} " --p_port " ${ST_PORT_RX} " --p_sip " ${ST_SIP_RX} " --p_rx_ip " ${ST_RX_IP} " --width " ${width} " --height " ${height} " &
39
41
pid_rx=$!
40
- echo " ${name} : pid_tx ${pid_tx} , pid_rx ${pid_rx} , wait ${TEST_TIME_SEC} s"
41
- sleep ${TEST_TIME_SEC}
42
+ log_info " ${name} : pid_tx ${pid_tx} , pid_rx ${pid_rx} , wait ${TEST_TIME_SEC} s"
43
+ sleep " ${TEST_TIME_SEC} "
42
44
43
- echo " ${name} : wait all thread ending"
45
+ log_info " ${name} : wait all thread ending"
44
46
kill -SIGINT ${pid_tx}
45
47
kill -SIGINT ${pid_rx}
46
48
wait ${pid_tx}
47
- echo " ${name} : ${tx_prog} exit"
49
+ log_info " ${name} : ${tx_prog} exit"
48
50
wait ${pid_rx}
49
- echo " ${name} : ${rx_prog} exit"
50
- echo " ${name} : ****** Done ******"
51
- echo " "
51
+ log_info " ${name} : ${rx_prog} exit"
52
+ log_success " ${name} : ****** Done ******"
53
+ log_info " "
52
54
}
53
55
54
- # test video
55
- test_tx_and_rx st20 TxVideoSample RxVideoSample
56
- # test st20p
57
- test_tx_and_rx st20p TxSt20PipelineSample RxSt20PipelineSample
58
- # test st22p
59
- test_tx_and_rx st22p TxSt22PipelineSample RxSt22PipelineSample
56
+ # Allow sourcing of the script.
57
+ if [[ " ${BASH_SOURCE[0]} " == " ${0} " ]]; then
58
+ set -e -o pipefail
59
+ export KAHAWAI_CFG_PATH=" ${REPOSITORY_DIR} /kahawai.json"
60
60
61
- # test rtp video
62
- test_tx_and_rx st20_rtp TxRtpVideoSample RxRtpVideoSample
63
- # test slice video
64
- test_tx_and_rx st20_slice TxSliceVideoSample RxSliceVideoSample
65
- # test st22
66
- test_tx_and_rx st22 TxSt22VideoSample RxSt22VideoSample
61
+ print_logo_anim
62
+ # test video
63
+ test_tx_and_rx st20 TxVideoSample RxVideoSample
64
+ # test st20p
65
+ test_tx_and_rx st20p TxSt20PipelineSample RxSt20PipelineSample
66
+ # test st22p
67
+ test_tx_and_rx st22p TxSt22PipelineSample RxSt22PipelineSample
67
68
68
- # test RxSt20TxSt20Fwd
69
- test_tx_and_rx RxSt20TxSt20Fwd TxSt20PipelineSample RxSt20TxSt20Fwd
70
- # test RxSt20pTxSt20pFwd
71
- test_tx_and_rx RxSt20pTxSt20pFwd TxSt20PipelineSample RxSt20pTxSt20pFwd
72
- # test RxSt20pTxSt22pFwd
73
- test_tx_and_rx RxSt20pTxSt22pFwd TxSt20PipelineSample RxSt20pTxSt22pFwd
69
+ # test rtp video
70
+ test_tx_and_rx st20_rtp TxRtpVideoSample RxRtpVideoSample
71
+ # test slice video
72
+ test_tx_and_rx st20_slice TxSliceVideoSample RxSliceVideoSample
73
+ # test st22
74
+ test_tx_and_rx st22 TxSt22VideoSample RxSt22VideoSample
74
75
75
- # test TxVideoSplitSample
76
- test_tx_and_rx TxVideoSplitSample TxVideoSplitSample RxSt20PipelineSample
77
- # test RxSt20TxSt20SplitFwd, not enable now
78
- test_tx_and_rx RxSt20TxSt20SplitFwd TxSt20PipelineSample RxSt20TxSt20SplitFwd 3840 2160
76
+ # test RxSt20TxSt20Fwd
77
+ test_tx_and_rx RxSt20TxSt20Fwd TxSt20PipelineSample RxSt20TxSt20Fwd
78
+ # test RxSt20pTxSt20pFwd
79
+ test_tx_and_rx RxSt20pTxSt20pFwd TxSt20PipelineSample RxSt20pTxSt20pFwd
80
+ # test RxSt20pTxSt22pFwd
81
+ test_tx_and_rx RxSt20pTxSt22pFwd TxSt20PipelineSample RxSt20pTxSt22pFwd
79
82
80
- echo " ****** All test OK ******"
83
+ # test TxVideoSplitSample
84
+ test_tx_and_rx TxVideoSplitSample TxVideoSplitSample RxSt20PipelineSample
85
+ # test RxSt20TxSt20SplitFwd, not enable now
86
+ test_tx_and_rx RxSt20TxSt20SplitFwd TxSt20PipelineSample RxSt20TxSt20SplitFwd 3840 2160
81
87
82
- unset KAHAWAI_CFG_PATH
88
+ log_success " ****** All test OK ******"
89
+ unset KAHAWAI_CFG_PATH
90
+ fi
0 commit comments