mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-11 15:19:19 +02:00
Merge bitcoin/bitcoin#35451: lint: Grep for AUTO test suites in file names
f6bdbcf79dlint: Grep for `AUTO` test suites in file names (rustaceanrob) Pull request description: Tests without a fixture did not have their file names linted because the grep matches on `BOOST_FIXTURE`. Updates to match `BOOST_FIXTURE` or `BOOST_TEST`. ACKs for top commit: l0rinc: ACKf6bdbcf79dachow101: ACKf6bdbcf79dhebasto: ACKf6bdbcf79d. Tree-SHA512: dd1763b6ac90fa87b7e0d2faa56d1c7beedb1e2d37d16367c60ebcadd155f5955113fff7cf5c0ce5eaa9e63aeeb67ffff2c8e081f7c23978cb072207f072f2ef
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user