From d0f836e5aef29c5887cb5f3d3cba2b1d7d5d78fd Mon Sep 17 00:00:00 2001 From: Rohan Garg Date: Mon, 30 Mar 2020 19:12:00 +0200 Subject: [PATCH] tracie: Switch to using shutil.move for cross filesystem moves When running tracie in a docker container, renaming files from inside the container to a bind-mounted folder on the host causes a invalid cross-device link due to os.rename limitations. Switching to shutil allows us to overcome this. Signed-off-by: Rohan Garg Reviewed-by: Eric Anholt Reviewed-by: Alexandros Frantzis Tested-by: Marge Bot Part-of: --- .gitlab-ci/tracie/tracie.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci/tracie/tracie.py b/.gitlab-ci/tracie/tracie.py index 388a73423bf..efedcbc4880 100644 --- a/.gitlab-ci/tracie/tracie.py +++ b/.gitlab-ci/tracie/tracie.py @@ -8,6 +8,7 @@ import sys import tempfile import time import yaml +import shutil from pathlib import Path from PIL import Image @@ -128,9 +129,9 @@ def check_trace(repo_url, repo_commit, device_name, trace, expectation): trace_dir = os.path.split(trace['path'])[0] results_path = os.path.join(RESULTS_PATH, trace_dir, "test", device_name) os.makedirs(results_path, exist_ok=True) - os.rename(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': - os.rename(image_file, os.path.join(results_path, os.path.split(image_file)[1])) + shutil.move(image_file, os.path.join(results_path, os.path.split(image_file)[1])) return ok -- 2.30.2