diff options
author | Chase Qi <chase.qi@linaro.org> | 2017-11-22 12:09:42 +0800 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2017-11-27 10:40:44 +0000 |
commit | dca4fb61a9dcc74945305358b2059abc9301c648 (patch) | |
tree | 7e2a8684d1ccfdcf35d6fb82634c9b9397e7531a /automated | |
parent | 4ffe3d240e2ed30346f7cedef4838d1af768b466 (diff) |
plans: introduce linaro test plan v2
* Simplify test plan format.
* Update test-runner for the change in test plan.
* Update existing test plans to v2.
Change-Id: Ic10e6eb3d17cbf54140831d0e030dcbbb95c75db
Signed-off-by: Chase Qi <chase.qi@linaro.org>
Diffstat (limited to 'automated')
-rwxr-xr-x | automated/utils/test-runner.py | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/automated/utils/test-runner.py b/automated/utils/test-runner.py index 267a74a..c5e9172 100755 --- a/automated/utils/test-runner.py +++ b/automated/utils/test-runner.py @@ -92,22 +92,30 @@ class TestPlan(object): with open(self.test_plan, 'r') as f: test_plan = yaml.safe_load(f) try: + plan_version = test_plan['metadata'].get('format') + self.logger.info('Test plan version: {}'.format(plan_version)) + if plan_version == "Linaro Test Plan v2": + tests = test_plan['tests'][kind] + elif plan_version == "Linaro Test Plan v1" or plan_version is None: + tests = [] + for requirement in test_plan['requirements']: + if 'tests' in requirement.keys(): + if requirement['tests'] and \ + kind in requirement['tests'].keys() and \ + requirement['tests'][kind]: + for test in requirement['tests'][kind]: + tests.append(test) + test_list = [] unique_tests = [] # List of test hashes - for requirement in test_plan['requirements']: - if 'tests' in requirement.keys(): - if requirement['tests'] and \ - kind in requirement['tests'].keys() and \ - requirement['tests'][kind]: - for test in requirement['tests'][kind]: - test_hash = hash(json.dumps(test, sort_keys=True)) - if test_hash in unique_tests: - # Test is already in the test_list; don't add it again. - self.logger.warning( - "Skipping duplicate test {}".format(test)) - continue - unique_tests.append(test_hash) - test_list.append(test) + for test in tests: + test_hash = hash(json.dumps(test, sort_keys=True)) + if test_hash in unique_tests: + # Test is already in the test_list; don't add it again. + self.logger.warning("Skipping duplicate test {}".format(test)) + continue + unique_tests.append(test_hash) + test_list.append(test) for test in test_list: test['uuid'] = str(uuid4()) except KeyError as e: |