diff --git a/.github/workflows/scripts/setup_e2e_tests.sh b/.github/workflows/scripts/setup_e2e_tests.sh index cd1d077b946f..e56fa174377c 100755 --- a/.github/workflows/scripts/setup_e2e_tests.sh +++ b/.github/workflows/scripts/setup_e2e_tests.sh @@ -4,20 +4,21 @@ # SPDX-License-Identifier: Apache-2.0 TESTS="$(make -s -C testbed list-tests | xargs echo|sed 's/ /|/g')" -TESTS=("${TESTS//|/ }") +IFS='|' read -r -a TEST_ARRAY <<< "$TESTS" + MATRIX="{\"include\":[" curr="" -for i in "${!TESTS[@]}"; do -if (( i > 0 && i % 2 == 0 )); then - curr+="|${TESTS[$i]}" -else +for i in "${!TEST_ARRAY[@]}"; do + if (( i > 0 && i % 2 == 0 )); then + curr+="|${TEST_ARRAY[$i]}" + else if [ -n "$curr" ] && (( i>1 )); then - MATRIX+=",{\"test\":\"$curr\"}" + MATRIX+=",{\"test\":\"$curr\"}" elif [ -n "$curr" ]; then - MATRIX+="{\"test\":\"$curr\"}" + MATRIX+="{\"test\":\"$curr\"}" fi - curr="${TESTS[$i]}" -fi + curr="${TEST_ARRAY[$i]}" + fi done MATRIX+=",{\"test\":\"$curr\"}]}" echo "loadtest_matrix=$MATRIX" >> "$GITHUB_OUTPUT"