twister: Switch to a non-greedy regex

When parsing test names from symbol names, use a non-greedy match to
avoid parsing test names with __ in them.

The symbol looks like z_ztest_unit_test__SUITE__TEST. It is more likely
that a test name will contain __ than a suite name, so now something
z_ztest_unit_test__a_b__c_d__e_f will be parsed as suite:a_b
test:c_d__e_f, whereas it used to be parsed as suite:a_b__c_d test:e_f

Signed-off-by: Jeremy Bettis <jbettis@google.com>
This commit is contained in:
Jeremy Bettis 2023-08-28 22:04:38 +00:00 committed by Carles Cufí
commit 1e471eb2a7

View file

@ -684,7 +684,7 @@ class ProjectBuilder(FilterBuilder):
elf = ELFFile(open(elf_file, "rb"))
logger.debug(f"Test instance {self.instance.name} already has {len(self.instance.testcases)} cases.")
new_ztest_unit_test_regex = re.compile(r"z_ztest_unit_test__([^\s]*)__([^\s]*)")
new_ztest_unit_test_regex = re.compile(r"z_ztest_unit_test__([^\s]+?)__([^\s]*)")
detected_cases = []
for section in elf.iter_sections():
if isinstance(section, SymbolTableSection):