twister: enhance support for board@revision as platform name
This adds an extra layer to match the revision part where this needs to be of permitted patterns as described in. cmake/modules/extensions.cmake. Without this, the matching may produce undesirable results. For example, if there is a file named qemu_x86_tiny_1.conf, the testplan will create a board name qemu_x86@tiny.1 (which is definitely not correct). Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
c2c467a6ff
commit
835680f0e7
1 changed files with 21 additions and 10 deletions
|
@ -371,7 +371,15 @@ class TestPlan:
|
|||
if not "@" in platform.name:
|
||||
tmp_dir = os.listdir(os.path.dirname(file))
|
||||
for item in tmp_dir:
|
||||
result = re.match(f"{platform.name}_(?P<revision>.*)\\.conf", item)
|
||||
# Need to make sure the revision matches
|
||||
# the permitted patterns as described in
|
||||
# cmake/modules/extensions.cmake.
|
||||
revision_patterns = ["[A-Z]",
|
||||
"[0-9]+",
|
||||
"(0|[1-9][0-9]*)(_[0-9]+)*(_[0-9]+)*"]
|
||||
|
||||
for pattern in revision_patterns:
|
||||
result = re.match(f"{platform.name}_(?P<revision>{pattern})\\.conf", item)
|
||||
if result:
|
||||
revision = result.group("revision")
|
||||
yaml_file = f"{platform.name}_{revision}.yaml"
|
||||
|
@ -382,6 +390,9 @@ class TestPlan:
|
|||
platform_revision.default = False
|
||||
self.platforms.append(platform_revision)
|
||||
|
||||
break
|
||||
|
||||
|
||||
except RuntimeError as e:
|
||||
logger.error("E: %s: can't load: %s" % (file, e))
|
||||
self.load_errors += 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue