Skip to content

Commit 3de7a2e

Browse files
committed
run-vmtest: convert args to array
Convert args to array so that later we can pass "-m *" to test_progs through args. Currently, with args being string, it is not possible. Doing args+="-m *" will result in the wildcard being expanded. Doing args+="-m '*'" will result in single quoted wildcard being passed to test_progs. Signed-off-by: Amery Hung <ameryhung@gmail.com>
1 parent 236da0f commit 3de7a2e

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

run-vmtest/run-bpf-selftests.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ OUTPUT_DIR=${OUTPUT_DIR:-/mnt/vmtest}
2525

2626
test_progs_helper() {
2727
local selftest="test_progs${1}"
28-
local args="$2"
28+
local args=("$2")
2929

30-
args+=" ${TEST_PROGS_WATCHDOG_TIMEOUT:+-w$TEST_PROGS_WATCHDOG_TIMEOUT}"
31-
args+=" ${ALLOWLIST_FILE:+-a@$ALLOWLIST_FILE}"
32-
args+=" ${DENYLIST_FILE:+-d@$DENYLIST_FILE}"
30+
if [ "${args[0]}" == "" ]; then
31+
args=("${args[@]:1}")
32+
fi
3333

3434
json_file=${selftest/-/_}
3535
if [ "$2" == "-j" ]
@@ -38,12 +38,17 @@ test_progs_helper() {
3838
fi
3939
json_file="${OUTPUT_DIR}/${json_file}.json"
4040

41+
args+=(${TEST_PROGS_WATCHDOG_TIMEOUT:+-w$TEST_PROGS_WATCHDOG_TIMEOUT})
42+
args+=(${ALLOWLIST_FILE:+-a@$ALLOWLIST_FILE})
43+
args+=(${DENYLIST_FILE:+-d@$DENYLIST_FILE})
44+
args+=(-J "${json_file}")
45+
4146
foldable start ${selftest} "Testing ${selftest}"
42-
echo "./${selftest} ${args} --json-summary \"${json_file}\""
47+
echo "./${selftest} ${args[@]}"
4348
# "&& true" does not change the return code (it is not executed
4449
# if the Python script fails), but it prevents exiting on a
4550
# failure due to the "set -e".
46-
./${selftest} ${args} --json-summary "${json_file}" && true
51+
./${selftest} "${args[@]}" && true
4752
echo "${selftest}:$?" >>"${STATUS_FILE}"
4853
foldable end ${selftest}
4954
}

0 commit comments

Comments
 (0)