sanitycheck: provide option to exclude tags

This will make it possible for us to optimize the list of tests we run, for
example, we could exclude footprint tests from the main run because those are
run as part of the footprint checks later in the CI job.

Use like this: sanitycheck -e footprint

Change-Id: I4e7a3aa6fac2ba1c9c99b356f08459da97fda777
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2016-10-24 17:08:56 -04:00 committed by Andrew Boie
commit dfa86e2aca

View file

@ -1289,7 +1289,7 @@ class TestSuite:
result.append((test, platform))
return result
def apply_filters(self, platform_filter, arch_filter, tag_filter,
def apply_filters(self, platform_filter, arch_filter, tag_filter, exclude_tag,
config_filter, testcase_filter, last_failed, all_plats,
platform_limit, toolchain, extra_args):
instances = []
@ -1297,6 +1297,7 @@ class TestSuite:
verbose("platform filter: " + str(platform_filter))
verbose(" arch_filter: " + str(arch_filter))
verbose(" tag_filter: " + str(tag_filter))
verbose(" exclude_tag: " + str(exclude_tag))
verbose(" config_filter: " + str(config_filter))
if last_failed:
@ -1329,6 +1330,9 @@ class TestSuite:
if tag_filter and not tc.tags.intersection(tag_filter):
continue
if exclude_tag and tc.tags.intersection(exclude_tag):
continue
if testcase_filter and tc_name not in testcase_filter:
continue
@ -1409,6 +1413,10 @@ class TestSuite:
discards[instance] = "Command line testcase tag filter"
continue
if exclude_tag and tc.tags.intersection(exclude_tag):
discards[instance] = "Command line testcase exclude filter"
continue
if testcase_filter and tc_name not in testcase_filter:
discards[instance] = "Testcase name filter"
continue
@ -1621,6 +1629,9 @@ def parse_arguments():
help="Specify tags to restrict which tests to run by tag value. "
"Default is to not do any tag filtering. Multiple invocations "
"are treated as a logical 'or' relationship")
parser.add_argument("-e", "--exclude-tag", action="append",
help="Specify tags of tests that should not run."
"Default is to run all tests with all tags.")
parser.add_argument("-f", "--only-failed", action="store_true",
help="Run only those tests that failed the previous sanity check "
"invocation.")
@ -1830,7 +1841,7 @@ def main():
os.path.join(ZEPHYR_BASE, "samples")]
ts = TestSuite(args.arch_root, args.testcase_root, args.outdir, args.coverage)
discards = ts.apply_filters(args.platform, args.arch, args.tag, args.config,
discards = ts.apply_filters(args.platform, args.arch, args.tag, args.exclude_tag, args.config,
args.test, args.only_failed, args.all,
args.platform_limit, toolchain, args.extra_args)