mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-09-06 13:41:29 +00:00
Checking for duplicated or missing test IDs
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit is contained in:
committed by
Otavio Pontes
parent
b4d852f29b
commit
1b9efc01ce
+2
-1
@@ -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
|
||||
|
||||
@@ -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 \
|
||||
|
||||
Executable
+50
@@ -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
|
||||
Reference in New Issue
Block a user