lint: Grep for `AUTO` test suites in file names
What changed, and why it matters
This is a minor code-quality change. It fixes a test linting script so it also checks test files that use a simpler Boost test setup (BOOST_AUTO_TEST_SUITE), and renames one test suite to match its filename. There is no security issue here.
No security action needed. This is a routine lint/test maintenance commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit updates test/lint/lint-tests.py to grep for both BOOST_FIXTURE_TEST_SUITE and BOOST_AUTO_TEST_SUITE, ensuring test suite names match their filenames regardless of which Boost macro is used. It also renames the test suite in src/test/feerounder_tests.cpp from fee_rounder_tests to feerounder_tests to satisfy the lint rule. This is purely a testing/linting improvement.
Changed components
test/lint/lint-tests.pysrc/test/feerounder_tests.cppInspect captured patch +6 / −6
diff --git a/src/test/feerounder_tests.cpp b/src/test/feerounder_tests.cpp
index 82cd7d65..d88a4f77 100644
--- a/src/test/feerounder_tests.cpp
+++ b/src/test/feerounder_tests.cpp
@@ -9,7 +9,7 @@
#include <set>
-BOOST_AUTO_TEST_SUITE(fee_rounder_tests)
+BOOST_AUTO_TEST_SUITE(feerounder_tests)
BOOST_AUTO_TEST_CASE(FeeRounder)
{
diff --git a/test/lint/lint-tests.py b/test/lint/lint-tests.py
index c7354bc4..75e4eb54 100755
--- a/test/lint/lint-tests.py
+++ b/test/lint/lint-tests.py
@@ -13,12 +13,12 @@ import subprocess
import sys
-def grep_boost_fixture_test_suite():
+def grep_boost_test_suites():
command = [
"git",
"grep",
"-E",
- r"^BOOST_FIXTURE_TEST_SUITE\(",
+ r"^(BOOST_FIXTURE_TEST_SUITE|BOOST_AUTO_TEST_SUITE)\(",
"--",
"src/ipc/test/**.cpp",
"src/test/**.cpp",
@@ -31,7 +31,7 @@ def check_matching_test_names(test_suite_list):
not_matching = [
x
for x in test_suite_list
- if re.search(r"/(.*?)\.cpp:BOOST_FIXTURE_TEST_SUITE\(\1(_[a-z0-9]+)?, .*\)", x) is None
+ if re.search(r"/(.*?)\.cpp:(?:BOOST_FIXTURE_TEST_SUITE|BOOST_AUTO_TEST_SUITE)\(\1(_[a-z0-9]+)?[,)]", x) is None
]
if len(not_matching) > 0:
not_matching = "\n".join(not_matching)
@@ -61,7 +61,7 @@ def get_duplicates(input_list):
def check_unique_test_names(test_suite_list):
- output = [re.search(r"\((.*?),", x) for x in test_suite_list]
+ output = [re.search(r"\((.*?)[,)]", x) for x in test_suite_list]
output = [x.group(1) for x in output if x is not None]
output = get_duplicates(output)
output = sorted(list(output))
@@ -78,7 +78,7 @@ def check_unique_test_names(test_suite_list):
def main():
- test_suite_list = grep_boost_fixture_test_suite().splitlines()
+ test_suite_list = grep_boost_test_suites().splitlines()
exit_code = check_matching_test_names(test_suite_list)
exit_code |= check_unique_test_names(test_suite_list)
sys.exit(exit_code)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.