mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 15:30:14 +01:00
tracie: Print results in a machine readable format
Signed-off-by: Rohan Garg <rohan.garg@collabora.com> Reviewed-by: Alexandros Frantzis <alexandros.frantzis@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4435>
This commit is contained in:
parent
1618159772
commit
efbbf8bb81
2 changed files with 37 additions and 6 deletions
|
|
@ -56,9 +56,24 @@ run_test() {
|
||||||
cleanup
|
cleanup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert_results_yaml_contains() {
|
||||||
|
grep -q "actual: $1" $4
|
||||||
|
assert "[ $? = 0 ]"
|
||||||
|
|
||||||
|
grep -q "expected: $2" $4
|
||||||
|
assert "[ $? = 0 ]"
|
||||||
|
|
||||||
|
if [ $3 != "" ]; then
|
||||||
|
grep -q $3 $4
|
||||||
|
fi
|
||||||
|
|
||||||
|
assert "[ $? = 0 ]"
|
||||||
|
}
|
||||||
|
|
||||||
tracie_succeeds_if_all_images_match() {
|
tracie_succeeds_if_all_images_match() {
|
||||||
run_tracie
|
run_tracie
|
||||||
assert "[ $? = 0 ]"
|
assert "[ $? = 0 ]"
|
||||||
|
assert_results_yaml_contains 5efda83854befe0155ff8517a58d5b51 5efda83854befe0155ff8517a58d5b51 "" "$PWD/results/results.yml"
|
||||||
}
|
}
|
||||||
|
|
||||||
tracie_fails_on_image_mismatch() {
|
tracie_fails_on_image_mismatch() {
|
||||||
|
|
@ -67,6 +82,7 @@ tracie_fails_on_image_mismatch() {
|
||||||
|
|
||||||
run_tracie
|
run_tracie
|
||||||
assert "[ $? != 0 ]"
|
assert "[ $? != 0 ]"
|
||||||
|
assert_results_yaml_contains 5efda83854befe0155ff8517a58d5b51 8e0a801367e1714463475a824dab363b "trace2/test/vk-test-device/olive.testtrace-0.png" "$PWD/results/results.yml"
|
||||||
}
|
}
|
||||||
|
|
||||||
tracie_skips_traces_without_checksum() {
|
tracie_skips_traces_without_checksum() {
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,9 @@ def ensure_trace(repo_url, repo_commit, trace):
|
||||||
def check_trace(repo_url, repo_commit, device_name, trace, expectation):
|
def check_trace(repo_url, repo_commit, device_name, trace, expectation):
|
||||||
ensure_trace(repo_url, repo_commit, trace)
|
ensure_trace(repo_url, repo_commit, trace)
|
||||||
|
|
||||||
|
result = {}
|
||||||
|
result[trace['path']] = {}
|
||||||
|
|
||||||
trace_path = Path(TRACES_DB_PATH + trace['path'])
|
trace_path = Path(TRACES_DB_PATH + trace['path'])
|
||||||
checksum, image_file, log_file = replay(trace_path, device_name)
|
checksum, image_file, log_file = replay(trace_path, device_name)
|
||||||
if checksum is None:
|
if checksum is None:
|
||||||
|
|
@ -127,13 +130,19 @@ def check_trace(repo_url, repo_commit, device_name, trace, expectation):
|
||||||
ok = False
|
ok = False
|
||||||
|
|
||||||
trace_dir = os.path.split(trace['path'])[0]
|
trace_dir = os.path.split(trace['path'])[0]
|
||||||
results_path = os.path.join(RESULTS_PATH, trace_dir, "test", device_name)
|
dir_in_results = os.path.join(trace_dir, "test", device_name)
|
||||||
|
results_path = os.path.join(RESULTS_PATH, dir_in_results)
|
||||||
os.makedirs(results_path, exist_ok=True)
|
os.makedirs(results_path, exist_ok=True)
|
||||||
shutil.move(log_file, os.path.join(results_path, os.path.split(log_file)[1]))
|
shutil.move(log_file, os.path.join(results_path, os.path.split(log_file)[1]))
|
||||||
if not ok or os.environ.get('TRACIE_STORE_IMAGES', '0') == '1':
|
if not ok or os.environ.get('TRACIE_STORE_IMAGES', '0') == '1':
|
||||||
shutil.move(image_file, os.path.join(results_path, os.path.split(image_file)[1]))
|
image_name = os.path.split(image_file)[1]
|
||||||
|
shutil.move(image_file, os.path.join(results_path, image_name))
|
||||||
|
result[trace['path']]['image'] = os.path.join(dir_in_results, image_name)
|
||||||
|
|
||||||
return ok
|
result[trace['path']]['expected'] = expectation['checksum']
|
||||||
|
result[trace['path']]['actual'] = checksum
|
||||||
|
|
||||||
|
return ok, result
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
@ -156,11 +165,17 @@ def main():
|
||||||
|
|
||||||
traces = y['traces']
|
traces = y['traces']
|
||||||
all_ok = True
|
all_ok = True
|
||||||
|
results = {}
|
||||||
for trace in traces:
|
for trace in traces:
|
||||||
for expectation in trace['expectations']:
|
for expectation in trace['expectations']:
|
||||||
if expectation['device'] == args.device_name:
|
if expectation['device'] == args.device_name:
|
||||||
ok = check_trace(repo, commit_id, args.device_name, trace, expectation)
|
ok, result = check_trace(repo, commit_id, args.device_name, trace, expectation)
|
||||||
all_ok = all_ok and ok
|
all_ok = all_ok and ok
|
||||||
|
results.update(result)
|
||||||
|
|
||||||
|
with open(os.path.join(RESULTS_PATH, 'results.yml'), 'w') as f:
|
||||||
|
yaml.safe_dump(results, f, default_flow_style=False)
|
||||||
|
|
||||||
|
|
||||||
sys.exit(0 if all_ok else 1)
|
sys.exit(0 if all_ok else 1)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue