1# Copyright 2021 Nordic Semiconductor 2# SPDX-License-Identifier: Apache-2.0 3 4source ${ZEPHYR_BASE}/tests/bsim/sh_common.source 5 6EXECUTE_TIMEOUT=300 7 8function Skip(){ 9 for i in "${SKIP[@]}" ; do 10 if [ "$i" == "$1" ] ; then 11 return 0 12 fi 13 done 14 15 return 1 16} 17 18function RunTest(){ 19 verbosity_level=${verbosity_level:-2} 20 extra_devs=${EXTRA_DEVS:-0} 21 22 cd ${BSIM_OUT_PATH}/bin 23 24 idx=0 25 26 s_id=$1 27 shift 1 28 29 declare -A testids 30 testid="" 31 testid_in_order=() 32 33 for arg in $@ ; do 34 if [ "$arg" == "--" ]; then 35 shift 1 36 break 37 fi 38 39 if [[ "$arg" == "-"* ]]; then 40 testids["${testid}"]+="$arg " 41 else 42 testid=$arg 43 testid_in_order+=($testid) 44 testids["${testid}"]="" 45 fi 46 47 shift 1 48 done 49 50 test_options=$@ 51 52 for testid in ${testid_in_order[@]}; do 53 if Skip $testid; then 54 echo "Skipping $testid (device #$idx)" 55 let idx=idx+1 56 continue 57 fi 58 59 echo "Starting $testid as device #$idx" 60 conf=${conf:-prj_conf} 61 62 if [ ${overlay} ]; then 63 exe_name=./bs_${BOARD}_tests_bsim_bluetooth_mesh_${conf}_${overlay} 64 else 65 exe_name=./bs_${BOARD}_tests_bsim_bluetooth_mesh_${conf} 66 fi 67 68 Execute \ 69 ${exe_name} \ 70 -v=${verbosity_level} -s=$s_id -d=$idx -sync_preboot -RealEncryption=1 \ 71 -testid=$testid ${testids["${testid}"]} ${test_options} 72 let idx=idx+1 73 done 74 75 count=$(expr $idx + $extra_devs) 76 77 echo "Starting phy with $count devices" 78 79 Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=$s_id -D=$count -argschannel -at=35 80 81 wait_for_background_jobs 82} 83 84function RunTestFlash(){ 85 s_id=$1 86 ext_arg="${s_id} " 87 idx=0 88 shift 1 89 90 for arg in $@ ; do 91 if [ "$arg" == "--" ]; then 92 ext_arg+=$@ 93 break 94 fi 95 96 ext_arg+="$arg " 97 98 if [[ "$arg" != "-"* ]]; then 99 ext_arg+="-flash=../results/${s_id}/${s_id}_${idx}.bin " 100 let idx=idx+1 101 fi 102 103 shift 1 104 done 105 106 RunTest ${ext_arg} 107} 108