Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contest: subcases: handle retry cases #43

Merged
merged 1 commit into from
Nov 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions contest/backend/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ def result_as_l2(raw):
del data["results"]
if "time" in data:
del data["time"]
# in case of retry, the subtest might not have been re-executed
if "retry" in data:
del data["retry"]
data |= case
data["test"] = l1["test"] + '.' + case["test"]
flat.append(data)
Expand Down
23 changes: 20 additions & 3 deletions contest/remote/vmksft-p.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def get_prog_list(vm, targets):
return [(e.split(":")[0].strip(), e.split(":")[1].strip()) for e in targets]


def _parse_nested_tests(full_run):
def _parse_nested_tests(full_run, prev_results):
tests = []
nested_tests = False

Expand Down Expand Up @@ -110,8 +110,20 @@ def _parse_nested_tests(full_run):

r['result'] = result

tests.append(r)
if prev_results is not None:
for entry in prev_results:
if entry['test'] == r['test']:
entry['retry'] = result
break
else:
# the first run didn't validate this test: add it to the list
r['result'] = 'skip'
r['retry'] = result
prev_results.append(r)
else:
tests.append(r)

# return an empty list when there are prev results: no replacement needed
return tests

def _vm_thread(config, results_path, thr_id, hard_stop, in_queue, out_queue):
Expand Down Expand Up @@ -195,8 +207,13 @@ def _vm_thread(config, results_path, thr_id, hard_stop, in_queue, out_queue):
outcome['crashes'] = crashes

if config.getboolean('ksft', 'nested_tests', fallback=False):
if is_retry:
prev_results = outcome['results'] if 'results' in outcome else []
else:
prev_results = None

# this will only parse nested tests inside the TAP comments
nested_tests = _parse_nested_tests(vm.log_out)
nested_tests = _parse_nested_tests(vm.log_out, prev_results)
if nested_tests:
outcome['results'] = nested_tests

Expand Down
Loading