Checking for duplicated or missing test IDs

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit is contained in:
Castulo Martinez
2019-04-15 13:28:44 -07:00
committed by Otavio Pontes
parent b4d852f29b
commit 1b9efc01ce
3 changed files with 55 additions and 1 deletions
+2 -1
View File
@@ -72,7 +72,8 @@ before_script:
- sudo find test/functional -exec chmod g-w {} \;
- make &&
sudo sh -c 'umask 0022 && make install' &&
sudo sh -c 'umask 0022 && make install-check'
sudo sh -c 'umask 0022 && make install-check' &&
sh -c 'make check-test-ids'
after_failure:
- cat test-suite.log
+3
View File
@@ -390,6 +390,9 @@ shellcheck-all:
shellcheck -s bash -x -e SC1008 /dev/stdin \
" \;
check-test-ids:
test/functional/check_ids.bash
release:
@git rev-parse v$(PACKAGE_VERSION) &> /dev/null; \
if [ "$$?" -eq 0 ]; then \
+50
View File
@@ -0,0 +1,50 @@
#!/bin/bash
FUNC_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=/dev/null
source "$FUNC_DIR"/testlib.bash
declare -A groups=( ["bundleadd"]="ADD" ["bundlelist"]="LST" ["bundleremove"]="REM" \
["checkupdate"]="CHK" ["hashdump"]="HSD" ["mirror"]="MIR" ["search"]="SRH" \
["update"]="UPD" ["usability"]="USA" ["verify"]="VER" )
invalid=false
for group in "${!groups[@]}"; do
group_code="${groups[$group]}"
num_tests=$(list_tests "$FUNC_DIR/$group" | wc -l)
for iter in $(seq -f "%03g" 1 "$num_tests"); do
found=0
for id in $(list_tests "$FUNC_DIR/$group" | cut -d ":" -f 1 | sort); do
if [ "$group_code$iter" = "$id" ]; then
found=$((found + 1))
fi
done
if [ "$found" -eq 0 ]; then
echo "A test with ID '$group_code$iter' was not found."
invalid=true
elif [ "$found" -gt 1 ]; then
echo "Found $found tests with duplicated IDs in '$group'."
invalid=true
fi
done
done
if [ "$invalid" = true ]; then
echo -e "\nRun 'list_tests --all' to check the test IDs."
exit 1
fi
echo "All tests have valid IDs."
exit 0