summaryrefslogtreecommitdiffstats
path: root/tools/check-tree.sh
Commit message (Collapse)AuthorAgeFilesLines
* tools: check for consistency of .json-nft dumps in "check-tree.sh"Thomas Haller2023-11-151-1/+20
| | | | | | | | | | | | | | | | Add checks for the newly introduced .json-nft dump files. Optimally, every test that has a .nft dump should also have a .json-nft dump, and vice versa. However, currently some JSON tests fail to validate, and are missing. Only flag those missing files as warning, without failing the script. The reason to warn about this, is that we really should fix those tests, and having a annoying warning increases the pressure and makes it discoverable. Signed-off-by: Thomas Haller <thaller@redhat.com> Signed-off-by: Florian Westphal <fw@strlen.de>
* tools: check more strictly for bash shebang in "check-tree.sh"Thomas Haller2023-11-151-2/+7
| | | | | | | | | | | | | | | | | There is no problem in principle to allow any executable/shebang. However, it also not clear why we would want to use anything except bash. Unless we have a good use case, check and reject anything else. Also not that `./tests/shell/run-tests.sh -x` only works if the shebang is either exactly "#!/bin/bash" or "#!/bin/bash -e". While it probably could be made work with other shebangs, the simpler thing is to just use bash consistently. Just check that they are all bash scripts. If there ever is a use-case, we can always adjust this check. Signed-off-by: Thomas Haller <thaller@redhat.com> Signed-off-by: Florian Westphal <fw@strlen.de>
* tools: simplify error handling in "check-tree.sh" by adding msg_err()/msg_warn()Thomas Haller2023-11-151-17/+20
| | | | | | | | | | | | msg_err() also sets EXIT_CODE=, so we don't have to duplicate this. Also add msg_warn() to print non-fatal warnings. Will be used in the future. As "check-tree.sh" tests the consistency of the source tree, a warning only makes sense to point something out that really should be fixed, but is not yet. Signed-off-by: Thomas Haller <thaller@redhat.com> Signed-off-by: Florian Westphal <fw@strlen.de>
* check-tree.sh: check and flag /bin/sh usageFlorian Westphal2023-10-241-0/+1
| | | | | | | | | | | | Almost all shell tests use /bin/bash already. In some cases we've had shell tests use /bin/sh, but still having a bashism. This causes failures on systems where sh is dash or another, strict bourne shell. Flag those via check-tree.sh. Signed-off-by: Florian Westphal <fw@strlen.de>
* tools: reject unexpected files in "tests/shell/testcases/" with "check-tree.sh"Thomas Haller2023-10-241-2/+17
| | | | | | | | | "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>
* tools: add "tools/check-tree.sh" script to check consistency of nft dumpsThomas Haller2023-09-151-0/+91
The script performs some checks on the source tree, and fails if any problems are found. Currently it only checks for the dumps files, but it shall be extended to perform various consistency checks of the source tree. This script was already successful at finding issues with the dumps. Running it helps to make sure we don't make mistakes. Later it should also integrate with `make check` and/or be called from CI. Signed-off-by: Thomas Haller <thaller@redhat.com> Signed-off-by: Florian Westphal <fw@strlen.de>