[PATCH nft 2/2] tools: reject unexpected files in "tests/shell/testcases/" with "check-tree.sh"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"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@xxxxxxxxxx>
---
 tools/check-tree.sh | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/tools/check-tree.sh b/tools/check-tree.sh
index ede3e6998ecc..c3aaa08d05ce 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"
@@ -74,9 +78,20 @@ if [ "${SHELL_TESTS[*]}" != "${SHELL_TESTS2[*]}" ] ; then
 	EXIT_CODE=1
 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')"
-- 
2.41.0




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux