summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheng Shao <terrorjack@type.dance>2023-04-18 02:11:57 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-04-27 16:00:35 -0400
commit791cce64a3ea23fc0ad95fb7e7083a0ff0c35154 (patch)
treef2d207566e26e7a7299728ea05f7f466d5b9773f
parente6416b10cc9ec0ce022f58b618cd18f83fb01b8d (diff)
downloadhaskell-791cce64a3ea23fc0ad95fb7e7083a0ff0c35154.tar.gz
testsuite: fix permission bits in copy_files
When the testsuite driver copy files instead of symlinking them, it should also copy the permission bits, otherwise there'll be permission denied errors. Also, enforce file copying when testing wasm32, since wasmtime doesn't handle host symlinks quite well (https://github.com/bytecodealliance/wasmtime/issues/6227).
-rw-r--r--testsuite/driver/testlib.py2
-rw-r--r--testsuite/driver/testutil.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 8a9c280835..8ab42e4508 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -1264,7 +1264,7 @@ async def do_test(name: TestName,
for extra_file in files:
src = in_srcdir(extra_file)
dst = in_testdir(os.path.basename(extra_file.rstrip('/\\')))
- force_copy = opts.copy_files
+ force_copy = opts.copy_files or arch("wasm32")
if src.is_file():
link_or_copy_file(src, dst, force_copy)
elif src.is_dir():
diff --git a/testsuite/driver/testutil.py b/testsuite/driver/testutil.py
index 973d4bcae5..9e0cdc5d49 100644
--- a/testsuite/driver/testutil.py
+++ b/testsuite/driver/testutil.py
@@ -115,10 +115,12 @@ def symlinks_work() -> bool:
if not symlinks_work():
def link_or_copy_file(src: Path, dst: Path, force_copy=False):
shutil.copyfile(str(src), str(dst))
+ shutil.copymode(str(src), str(dst))
else:
def link_or_copy_file(src: Path, dst: Path, force_copy=False):
if force_copy:
shutil.copyfile(str(src), str(dst))
+ shutil.copymode(str(src), str(dst))
else:
os.symlink(str(src), str(dst))