Skip to content

Commit b1e29e7

Browse files
Jon Derrickosandov
authored andcommitted
Create test name from most recently used test number
The 'new' script can inadvertently use a test name that was removed, ex nvme/001, which may create confusion if identically-named tests exist among different versions. Instead, generate a test name at the numerical tail end of the test group. Signed-off-by: Jon Derrick <[email protected]>
1 parent f3bcd8c commit b1e29e7

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

new

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,11 @@ EOF
9696
echo "Created tests/${group}/rc"
9797
fi
9898

99-
for ((i = 1; ; i++)); do
100-
seq="$(printf "%03d" "$i")"
101-
test_name="${group}/${seq}"
102-
if [[ ! -e tests/${test_name} ]]; then
103-
break
104-
fi
99+
for test in tests/"$group"/+([0-9]); do
100+
:
105101
done
102+
seq=${test##tests/$group/+(0)}
103+
test_name="${group}/$(printf "%03d" $((seq + 1)))"
106104

107105
cat << EOF > "tests/${test_name}"
108106
#!/bin/bash

0 commit comments

Comments
 (0)