diff options
author | Pablo Saavedra <[email protected]> | 2020-05-13 16:44:30 +0200 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-05-18 17:27:42 +0000 |
commit | 4504d6374dbe2aa40af519c16765457bcbf81b84 (patch) | |
tree | 046675b02c0637f19c24bd4f951e3e311f4ac815 /.gitlab-ci | |
parent | e85dc9a240601a201ec662f1a17bbdbea2965bfd (diff) |
ci: Fix TypoError error when traces in traces.yml is an empty list
v2: Python's nitpick (Andres)
In case of an empty list of traces, the results.yml will contain an empty
curly braces. In YAML, an associative array can also be specified by text
enclosed in curly braces ({}),
This commit also adds the corresponding test to check the behavior of
tracie when no traces are added in the traces.yml file.
Signed-off-by: Pablo Saavedra <[email protected]>
Reviewed-by: Andres Gomez <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4916>
Diffstat (limited to '.gitlab-ci')
-rw-r--r-- | .gitlab-ci/tracie/tests/test.py | 11 | ||||
-rw-r--r-- | .gitlab-ci/tracie/tracie.py | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/.gitlab-ci/tracie/tests/test.py b/.gitlab-ci/tracie/tests/test.py index 40b1a45d3f5..21264cc882a 100644 --- a/.gitlab-ci/tracie/tests/test.py +++ b/.gitlab-ci/tracie/tests/test.py @@ -163,6 +163,17 @@ def test_tracie_only_traces_without_checksum(): assert run_tracie() +def test_tracie_with_no_traces(): + filename = "./tests/traces.yml" + content = 'traces:' + write_to(content, filename) + assert run_tracie() + expectations = [ + "{}", + ] + assert check_results_yaml_content(RESULTS_YAML, expectations) + + def test_tracie_fails_on_dump_image_error(): # "invalid" should fail to parse as rgba and # cause an error diff --git a/.gitlab-ci/tracie/tracie.py b/.gitlab-ci/tracie/tracie.py index d2c0d7355d9..854ba8a17c5 100644 --- a/.gitlab-ci/tracie/tracie.py +++ b/.gitlab-ci/tracie/tracie.py @@ -149,7 +149,7 @@ def run(filename, device_name): project_url = None commit_id = None - traces = y['traces'] + traces = y['traces'] or [] all_ok = True results = {} for trace in traces: |