diff options
-rw-r--r-- | testsuite/driver/testglobals.py | 2 | ||||
-rw-r--r-- | testsuite/driver/testlib.py | 4 | ||||
-rw-r--r-- | testsuite/driver/testutil.py | 19 |
3 files changed, 22 insertions, 3 deletions
diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py index c39ca7a8c9..a2d79391db 100644 --- a/testsuite/driver/testglobals.py +++ b/testsuite/driver/testglobals.py @@ -3,7 +3,7 @@ # from my_typing import * -from pathlib import Path +from testutil import Path from perf_notes import MetricChange, PerfStat, Baseline, MetricOracles from datetime import datetime diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 79d504a845..849996d5f4 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -14,7 +14,8 @@ import copy import glob import sys from math import ceil, trunc -from pathlib import Path, PurePath +from pathlib import PurePath +from testutil import Path import collections import subprocess @@ -39,6 +40,7 @@ if config.use_threads: global wantToStop wantToStop = False + # I have no idea what the type of this is global thisdir_settings thisdir_settings = None # type: ignore diff --git a/testsuite/driver/testutil.py b/testsuite/driver/testutil.py index 071b641b7f..5509acff73 100644 --- a/testsuite/driver/testutil.py +++ b/testsuite/driver/testutil.py @@ -2,12 +2,29 @@ import os import platform import subprocess import shutil -from pathlib import Path, PurePath +from pathlib import PurePath, Path import threading from my_typing import * +# Workaround for #17483. msys2 Python's wrapper for stat (called by +# Path.exists()) appears to fail randomly with errno=0. Work around this by +# retrying 10 times in the event that this happens. +if os.name == 'nt': + # Oh the horror... + def new_stat(self): + for i in range(10): + try: + result = new_stat.stat(self) + return result + except OSError as e: + if e.errno != 0: + raise e + + new_stat.stat = Path.stat # type: ignore + Path.stat = new_stat # type: ignore + PassFail = NamedTuple('PassFail', [('passFail', str), ('reason', str), |