mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-13 00:00:23 +02:00
lint: Grep for AUTO test suites in file names
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`. Co-authored-by: l0rinc <pap.lorinc@gmail.com>
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE(fee_rounder_tests)
|
BOOST_AUTO_TEST_SUITE(feerounder_tests)
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(FeeRounder)
|
BOOST_AUTO_TEST_CASE(FeeRounder)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def grep_boost_fixture_test_suite():
|
def grep_boost_test_suites():
|
||||||
command = [
|
command = [
|
||||||
"git",
|
"git",
|
||||||
"grep",
|
"grep",
|
||||||
"-E",
|
"-E",
|
||||||
r"^BOOST_FIXTURE_TEST_SUITE\(",
|
r"^(BOOST_FIXTURE_TEST_SUITE|BOOST_AUTO_TEST_SUITE)\(",
|
||||||
"--",
|
"--",
|
||||||
"src/ipc/test/**.cpp",
|
"src/ipc/test/**.cpp",
|
||||||
"src/test/**.cpp",
|
"src/test/**.cpp",
|
||||||
@@ -31,7 +31,7 @@ def check_matching_test_names(test_suite_list):
|
|||||||
not_matching = [
|
not_matching = [
|
||||||
x
|
x
|
||||||
for x in test_suite_list
|
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:
|
if len(not_matching) > 0:
|
||||||
not_matching = "\n".join(not_matching)
|
not_matching = "\n".join(not_matching)
|
||||||
@@ -61,7 +61,7 @@ def get_duplicates(input_list):
|
|||||||
|
|
||||||
|
|
||||||
def check_unique_test_names(test_suite_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 = [x.group(1) for x in output if x is not None]
|
||||||
output = get_duplicates(output)
|
output = get_duplicates(output)
|
||||||
output = sorted(list(output))
|
output = sorted(list(output))
|
||||||
@@ -78,7 +78,7 @@ def check_unique_test_names(test_suite_list):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
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_matching_test_names(test_suite_list)
|
||||||
exit_code |= check_unique_test_names(test_suite_list)
|
exit_code |= check_unique_test_names(test_suite_list)
|
||||||
sys.exit(exit_code)
|
sys.exit(exit_code)
|
||||||
|
|||||||
Reference in New Issue
Block a user