diff options
author | Paul Sokolovsky <paul.sokolovsky@linaro.org> | 2020-07-02 13:20:34 +0300 |
---|---|---|
committer | Paul Sokolovskyy <paul.sokolovsky@linaro.org> | 2020-07-02 14:11:27 +0000 |
commit | f526050f7a5baa1fa966253676ab8e9eb2354c2f (patch) | |
tree | 74848ba0b4b23c0aef79e0b629280849ef8bb23e /zephyr-upstream | |
parent | d92ac10b42edf4d3bef7b3ad87ffaad70b4a82b6 (diff) |
zephyr-upstream: submit_for_testing: Refactor testcase.yaml handling code
So far, we paid atention only to tests with "harness: console", but we're
also interested in other harness types, so factor out a function to get
a YAML section which contains directives related to harness (which, per
testcase.yaml structure, can be either a "common" section, or section
pertinent to a specific test name).
Change-Id: Ic5db73ff79352d636794d4e56c1ca1b8c6114cad
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Diffstat (limited to 'zephyr-upstream')
-rw-r--r-- | zephyr-upstream/submit_for_testing.py | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/zephyr-upstream/submit_for_testing.py b/zephyr-upstream/submit_for_testing.py index b3ca54eea5..3ee1820f67 100644 --- a/zephyr-upstream/submit_for_testing.py +++ b/zephyr-upstream/submit_for_testing.py @@ -189,28 +189,35 @@ def parse_yaml_harness_config(yaml_node): else: return None -def get_regex(test, yaml): - # Parse yaml data to extract list of regular expressions to be searched, - # if present. Otherwise return None. +# Get a node with "harness" directive from testcase.yaml, which is either +# "common" node, or node for a specific test name +def get_section_with_harness(test_path, yaml): for key in yaml: if key == "common": yaml_node = yaml["common"] - ret = parse_yaml_harness_config(yaml_node) - if ret is not None: - return ret + if "harness" in yaml_node: + return yaml_node elif key == "tests": - path = test.split('/') + path = test_path.split('/') if len(path) < 4: print("Unexpected directory structure encountered. Aborting...") sys.exit(1) test_name = path[-3] yaml_node = yaml["tests"][test_name] - ret = parse_yaml_harness_config(yaml_node) - if ret is not None: - return ret - + if "harness" in yaml_node: + return yaml_node + return None +def get_regex(test, yaml): + # Parse yaml data to extract list of regular expressions to be searched, + # if present. Otherwise return None. + + yaml_node = get_section_with_harness(test, yaml) + if not yaml_node: + return None + return parse_yaml_harness_config(yaml_node) + def main(): parser = argparse.ArgumentParser() parser.add_argument("--board-name", |