bsim tests: run_parallel: Allow providing tests explicitly

Add the options to provide a file with a list of tests
to run with a possible TESTS_FILE variable,
or to provide the actual list of tests directly
in TESTS_LIST.

If a file is provided, comments (#) and empty lines will be
skipped.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2023-04-04 16:31:15 +02:00 committed by Carles Cufí
commit f8d747f85c

View file

@ -4,8 +4,6 @@
# Syntax run_parallel.sh [-h] [options] # Syntax run_parallel.sh [-h] [options]
set -u
start=$SECONDS start=$SECONDS
function display_help(){ function display_help(){
@ -15,6 +13,9 @@ function display_help(){
echo " The results will be saved to \${RESULTS_FILE}, by default" echo " The results will be saved to \${RESULTS_FILE}, by default"
echo " ../RunResults.xml" echo " ../RunResults.xml"
echo " Testcases are searched for in \${SEARCH_PATH}, by default this folder" echo " Testcases are searched for in \${SEARCH_PATH}, by default this folder"
echo " You can instead also provide a space separated test list with \${TESTS_LIST}, "
echo " or an input file including a list of tests \${TESTS_FILE} (w one line"
echo " per test, you can comment lines with #)"
} }
# Parse command line # Parse command line
@ -28,12 +29,19 @@ fi
err=0 err=0
i=0 i=0
SEARCH_PATH="${SEARCH_PATH:-.}" if [ -n "${TESTS_FILE}" ]; then
#remove comments and empty lines from file
all_cases=$(sed 's/#.*$//;/^$/d' "${TESTS_FILE}")
elif [ -n "${TESTS_LIST}" ]; then
all_cases=${TESTS_LIST}
else
SEARCH_PATH="${SEARCH_PATH:-.}"
all_cases=`find ${SEARCH_PATH} -name "*.sh" | \
grep -Ev "(/_|run_parallel|compile.sh)"`
#we dont run ourselves
fi
#All the testcases we want to run: set -u
all_cases=`find ${SEARCH_PATH} -name "*.sh" | \
grep -Ev "(/_|run_parallel|compile.sh)"`
#we dont run ourselves
RESULTS_FILE="${RESULTS_FILE:-`pwd`/../RunResults.xml}" RESULTS_FILE="${RESULTS_FILE:-`pwd`/../RunResults.xml}"
tmp_res_file=tmp.xml tmp_res_file=tmp.xml