tools: make sure that test groups are described in the documentation
[xfstests-dev.git] / tools / nextid
1 #!/bin/bash
2
3 # Compute the next available test id in a given test directory.
4
5 if [ $# != 1 ] || [ "$1" = "--help" ] || [ ! -d "tests/$1/" ]; then
6         echo "Usage: $0 test_dir"
7         exit 1
8 fi
9
10 . ./common/test_names
11
12 i=0
13 eof=1
14
15 while read found other_junk;
16 do
17         i=$((i+1))
18         id=`printf "%03d" $i`
19         if [ "$id" != "$found" ]; then
20                 eof=0
21                 break
22         fi
23 done < <(cd "tests/$1/" ; ../../tools/mkgroupfile | \
24          grep "^$VALID_TEST_NAME\>" | tr - ' ')
25
26 if [ $eof -eq 1 ]; then
27    i=$((i+1))
28    id=`printf "%03d" $i`
29 fi
30
31 echo "$1/$id"