11#! /bin/bash
22
33# SPDX-License-Identifier: BSD-3-Clause
4- # Copyright 2022 Intel Corporation
4+ # Copyright 2022-2025 Intel Corporation
55
6- set -e
6+ SCRIPT_DIR=" $( readlink -f " $( dirname -- " ${BASH_SOURCE[0]} " ) " ) "
7+ REPOSITORY_DIR=" $( readlink -f " ${SCRIPT_DIR} /../.." ) "
78
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"
1511
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} "
1819
19- export KAHAWAI_CFG_PATH=../../kahawai.json
20+ TEST_BIN_PATH=" ${TEST_BIN_PATH:- " ${REPOSITORY_DIR} /build/app" } "
21+ LOG_LEVEL=" ${LOG_LEVEL:- notice} "
2022
2123test_tx_and_rx () {
2224 local name=$1
@@ -30,53 +32,59 @@ test_tx_and_rx() {
3032 if [ -n " $5 " ]; then
3133 height=$5
3234 fi
33- echo " ${name} : start ${tx_prog} , width:${width} height:${height} "
35+ log_info " ${name} : start ${tx_prog} , width:${width} height:${height} "
3436 " ${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} " &
3537 # ${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 &
3638 pid_tx=$!
37- echo " ${name} : start ${rx_prog} "
39+ log_info " ${name} : start ${rx_prog} "
3840 " ${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} " &
3941 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} "
4244
43- echo " ${name} : wait all thread ending"
45+ log_info " ${name} : wait all thread ending"
4446 kill -SIGINT ${pid_tx}
4547 kill -SIGINT ${pid_rx}
4648 wait ${pid_tx}
47- echo " ${name} : ${tx_prog} exit"
49+ log_info " ${name} : ${tx_prog} exit"
4850 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 " "
5254}
5355
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"
6060
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
6768
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
7475
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
7982
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
8187
82- unset KAHAWAI_CFG_PATH
88+ log_success " ****** All test OK ******"
89+ unset KAHAWAI_CFG_PATH
90+ fi
0 commit comments