diff options
author | Andres Gomez <agomez@igalia.com> | 2020-07-30 00:47:21 +0300 |
---|---|---|
committer | Andres Gomez <agomez@igalia.com> | 2020-11-02 22:16:11 +0200 |
commit | 75a05d12b1e368477c83f68306e0ec47ef1ea902 (patch) | |
tree | ab4955653e780650d9b8d87aa076756d379e53ef /framework | |
parent | cb575a209fb9e09769af70e9b8ca89a37db373fa (diff) |
framwork/replay: use core.check_dir whenever possible
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/353>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/replay/compare_replay.py | 5 | ||||
-rw-r--r-- | framework/replay/download_utils.py | 4 | ||||
-rw-r--r-- | framework/replay/dump_trace_images.py | 5 |
3 files changed, 8 insertions, 6 deletions
diff --git a/framework/replay/compare_replay.py b/framework/replay/compare_replay.py index 1d380884e..2989d96f6 100644 --- a/framework/replay/compare_replay.py +++ b/framework/replay/compare_replay.py @@ -29,6 +29,7 @@ import yaml from glob import glob from os import path +from framework import core from framework import status from framework.replay import query_traces_yaml as qty from framework.replay.download_utils import ensure_file @@ -66,7 +67,7 @@ def _check_trace(trace_path, expected_checksum): trace_dir = path.dirname(trace_path) dir_in_results = path.join('trace', OPTIONS.device_name, trace_dir) results_path = path.join(OPTIONS.results_path, dir_in_results) - os.makedirs(results_path, exist_ok=True) + core.check_dir(results_path) checksum, image_file = _replay(path.join(OPTIONS.db_path, trace_path), results_path) @@ -98,7 +99,7 @@ def _check_trace(trace_path, expected_checksum): def _write_results(results): - os.makedirs(OPTIONS.results_path, exist_ok=True) + core.check_dir(OPTIONS.results_path) results_file_path = path.join(OPTIONS.results_path, 'results.yml') with open(results_file_path, 'w') as f: yaml.safe_dump(results, f, default_flow_style=False) diff --git a/framework/replay/download_utils.py b/framework/replay/download_utils.py index aa21be550..2f760493a 100644 --- a/framework/replay/download_utils.py +++ b/framework/replay/download_utils.py @@ -23,12 +23,12 @@ # # SPDX-License-Identifier: MIT -import os import requests from os import path from time import time +from framework import core from framework.replay.options import OPTIONS @@ -42,7 +42,7 @@ def ensure_file(file_path): '{} missing'.format(destination_file_path)) return - os.makedirs(path.dirname(destination_file_path), exist_ok=True) + core.check_dir(path.dirname(destination_file_path)) if not OPTIONS.download['force'] and path.exists(destination_file_path): return diff --git a/framework/replay/dump_trace_images.py b/framework/replay/dump_trace_images.py index 6f5fa75f2..6ebb529be 100644 --- a/framework/replay/dump_trace_images.py +++ b/framework/replay/dump_trace_images.py @@ -28,6 +28,7 @@ import subprocess from os import path +from framework import core from framework.replay.options import OPTIONS from framework.replay.trace_utils import trace_type_from_filename, TraceType @@ -46,7 +47,7 @@ def _run_logged_command(cmd, env, log_path): ret = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env) logoutput = '[dump_trace_images] Running: {}\n'.format( ' '.join(cmd)).encode() + ret.stdout - os.makedirs(path.dirname(log_path), exist_ok=True) + core.check_dir(path.dirname(log_path)) with open(log_path, 'wb') as log: log.write(logoutput) if ret.returncode: @@ -139,7 +140,7 @@ def dump_from_trace(trace_path, output_dir=None, calls=[]): if output_dir is None: output_dir = path.join('trace', OPTIONS.device_name, path.dirname(trace_path)) - os.makedirs(output_dir, exist_ok=True) + core.check_dir(output_dir) trace_type = trace_type_from_filename(path.basename(trace_path)) try: if trace_type == TraceType.APITRACE: |