sanitycheck: support only_tags for boards

Support running/building only specific tags and ignoring everything
else.

Adding this to a platform yaml file will enable tests with one of of
tags listed to be executed on the platform.

This is useful for special platform configurations used for testing
specific features for example.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2020-07-16 16:27:04 -04:00
commit e8e367ada4
4 changed files with 15 additions and 2 deletions

View file

@ -154,6 +154,8 @@ testing:
ignore_tags:
Do not attempt to build (and therefore run) tests marked with this list of
tags.
only_tags:
Only execute tests with this list of tags on a specific platform.
Test Cases
**********

View file

@ -49,6 +49,11 @@ mapping:
mapping:
"default":
type: bool
"only_tags":
type: seq
seq:
-
type: str
"ignore_tags":
type: seq
seq:

View file

@ -1306,6 +1306,7 @@ class Platform:
self.ram = 128
self.ignore_tags = []
self.only_tags = []
self.default = False
# if no flash size is specified by the board, take a default of 512K
self.flash = 512
@ -1330,6 +1331,7 @@ class Platform:
self.ram = data.get("ram", 128)
testing = data.get("testing", {})
self.ignore_tags = testing.get("ignore_tags", [])
self.only_tags = testing.get("only_tags", [])
self.default = testing.get("default", False)
# if no flash size is specified by the board, take a default of 512K
self.flash = data.get("flash", 512)
@ -2803,7 +2805,11 @@ class TestSuite(DisablePyTestCollectionMixin):
continue
if set(plat.ignore_tags) & tc.tags:
discards[instance] = "Excluded tags per platform"
discards[instance] = "Excluded tags per platform (exclude_tags)"
continue
if not tc.tags or (plat.only_tags and tc.tags - set(plat.only_tags)):
discards[instance] = "Excluded tags per platform (only_tags)"
continue
# if nothing stopped us until now, it means this configuration

View file

@ -147,7 +147,7 @@ TESTDATA_PART1 = [
("arch_exclude", ['x86_demo'], None, None, "In test case arch exclude"),
("arch_whitelist", ['arm'], None, None, "Not in test case arch whitelist"),
("skip", True, None, None, "Skip filter"),
("tags", set(['sensor', 'bluetooth']), "ignore_tags", ['bluetooth'], "Excluded tags per platform"),
("tags", set(['sensor', 'bluetooth']), "ignore_tags", ['bluetooth'], "Excluded tags per platform (exclude_tags)"),
("min_flash", "2024", "flash", "1024", "Not enough FLASH"),
("min_ram", "500", "ram", "256", "Not enough RAM"),
("None", "None", "env", ['BSIM_OUT_PATH', 'demo_env'], "Environment (BSIM_OUT_PATH, demo_env) not satisfied"),