tracie: Switch to using shutil.move for cross filesystem moves
authorRohan Garg <rohan.garg@collabora.com>
Mon, 30 Mar 2020 17:12:00 +0000 (19:12 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 2 Apr 2020 10:53:05 +0000 (10:53 +0000)
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 <rohan.garg@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4377>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4377>

.gitlab-ci/tracie/tracie.py

index 388a73423bf0942757e251d31aae7404caa807ca..efedcbc4880fd616ec9374758192ffa57280223a 100644 (file)
@@ -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