Skip to contentSkip to conversation

kselftests: Sort the collections list to avoid duplicate tests

PATCH In review Rishabh Bhatnagar 2 participants 2 messages Jun 1, 2023 – Jun 5, 2023 Kselftest

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kselftests: Sort the collections list to avoid duplicate tests

If the collections list is not sorted uniq doesn't weed out duplicate tests correctly. Make sure to sort it before running uniq.

---
 tools/testing/selftests/run_kselftest.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/run_kselftest.sh +1 -1
index 97165a83df63..e0cb10c85169 100755
@@ -85,7 +85,7 @@ if [ -n "$TESTS" ]; then
 	available="$(echo "$valid" | sed -e 's/ /\n/g')"
 fi
 
-collections=$(echo "$available" | cut -d: -f1 | uniq)
+collections=$(echo "$available" | cut -d: -f1 | sort | uniq)
 for collection in $collections ; do
 	[ -w /dev/kmsg ] && echo "kselftest: Running tests in $collection" >> /dev/kmsg
 	tests=$(echo "$available" | grep "^$collection:" | cut -d: -f2)
Signature · 1 line
2.39.2
maintainer
#1 lore raw
Quoted 13 lines · Rishabh Bhatnagar

If the collections list is not sorted uniq doesn't weed out duplicate tests correctly. Make sure to sort it before running uniq.

---
  tools/testing/selftests/run_kselftest.sh | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/run_kselftest.sh +0 -0
index 97165a83df63..e0cb10c85169 100755

tools/testing/selftests/run_kselftest.sh if [ -n "$TESTS" ]; then · line 91

Quoted 8 lines
tools/testing/selftests/run_kselftest.sh +1 -1
@@ -85,7 +85,7 @@ if [ -n "$TESTS" ]; then
  	available="$(echo "$valid" | sed -e 's/ /\n/g')"
  fi
 
-collections=$(echo "$available" | cut -d: -f1 | uniq)
+collections=$(echo "$available" | cut -d: -f1 | sort | uniq)
  for collection in $collections ; do
  	[ -w /dev/kmsg ] && echo "kselftest: Running tests in $collection" >> /dev/kmsg
  	tests=$(echo "$available" | grep "^$collection:" | cut -d: -f2)

Applied to linux-kselftest next for Linux 6.5-rc1.

thanks,
-- Shuah