summaryrefslogtreecommitdiffstats
path: root/tools/check-tree.sh
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-10-23 18:13:16 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2023-10-24 11:31:02 +0200
commitc047776f4fd75fcc78feaca558d0db80355b6725 (patch)
treed7ee8cd61b2fd518043af07d03e27909cc9604c5 /tools/check-tree.sh
parent15500d0b1c07e8c497609e4509f7c8489cbc4b83 (diff)
tools: reject unexpected files in "tests/shell/testcases/" with "check-tree.sh"
"check-tree.sh" does consistency checks on the source tree. Extend the check to flag more unexpected files. We don't want to accidentally have left over files. Signed-off-by: Thomas Haller <thaller@redhat.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tools/check-tree.sh')
-rwxr-xr-xtools/check-tree.sh19
1 files changed, 17 insertions, 2 deletions
diff --git a/tools/check-tree.sh b/tools/check-tree.sh
index ede3e699..c3aaa08d 100755
--- a/tools/check-tree.sh
+++ b/tools/check-tree.sh
@@ -2,6 +2,10 @@
# Preform various consistency checks of the source tree.
+unset LANGUAGE
+export LANG=C
+export LC_ALL=C
+
die() {
printf '%s\n' "$*"
exit 1
@@ -56,7 +60,7 @@ check_shell_dumps() {
fi
}
-SHELL_TESTS=( $(find "tests/shell/testcases/" -type f -executable | LANG=C sort) )
+SHELL_TESTS=( $(find "tests/shell/testcases/" -type f -executable | sort) )
if [ "${#SHELL_TESTS[@]}" -eq 0 ] ; then
echo "No executable tests under \"tests/shell/testcases/\" found"
@@ -75,8 +79,19 @@ if [ "${SHELL_TESTS[*]}" != "${SHELL_TESTS2[*]}" ] ; then
fi
##############################################################################
+#
+F=( $(find tests/shell/testcases/ -type f | grep '^tests/shell/testcases/[^/]\+/dumps/[^/]\+\.\(nft\|nodump\)$' -v | sort) )
+IGNORED_FILES=( tests/shell/testcases/bogons/nft-f/* )
+for f in "${F[@]}" ; do
+ if ! array_contains "$f" "${SHELL_TESTS[@]}" "${IGNORED_FILES[@]}" ; then
+ echo "Unexpected file \"$f\""
+ EXIT_CODE=1
+ fi
+done
+
+##############################################################################
-FILES=( $(find "tests/shell/testcases/" -type f | sed -n 's#\(tests/shell/testcases\(/.*\)\?/\)dumps/\(.*\)\.\(nft\|nodump\)$#\0#p' | LANG=C sort) )
+FILES=( $(find "tests/shell/testcases/" -type f | sed -n 's#\(tests/shell/testcases\(/.*\)\?/\)dumps/\(.*\)\.\(nft\|nodump\)$#\0#p' | sort) )
for f in "${FILES[@]}" ; do
f2="$(echo "$f" | sed -n 's#\(tests/shell/testcases\(/.*\)\?/\)dumps/\(.*\)\.\(nft\|nodump\)$#\1\3#p')"