From 72a384f4fe064f9ea377644d57858d38f5febb66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 19 Nov 2021 14:30:32 +0100 Subject: [PATCH] cmdlineTests: Ensure that leading symbols in names affect the sort order --- test/cmdlineTests.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/cmdlineTests.sh b/test/cmdlineTests.sh index 416b97b32..4c54291c9 100755 --- a/test/cmdlineTests.sh +++ b/test/cmdlineTests.sh @@ -54,7 +54,7 @@ do shift ;; *) - matching_tests=$(find . -mindepth 1 -maxdepth 1 -type d -name "$1" | cut -c 3- | sort) + matching_tests=$(find . -mindepth 1 -maxdepth 1 -type d -name "$1" | cut -c 3- | LC_COLLATE=C sort) if [[ $matching_tests == "" ]] then @@ -72,7 +72,11 @@ done if (( ${#selected_tests[@]} == 0 && ${#patterns_with_no_matches[@]} == 0 )) then - selected_tests=(*) + # NOTE: We want leading symbols in names to affect the sort order but without + # LC_COLLATE=C sort seems to ignore them. + all_tests=$(echo * | tr '[:space:]' '\n' | LC_COLLATE=C sort) + # shellcheck disable=SC2206 # We do not support test names containing spaces. + selected_tests=($all_tests) fi popd > /dev/null