Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Glasgow Haskell Compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shayne Fletcher
Glasgow Haskell Compiler
Commits
9792c816
Commit
9792c816
authored
Feb 06, 2020
by
Ben Gamari
🐢
Committed by
Marge Bot
Feb 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testsuite: Probe whether symlinks are usable on Windows
Closes #17706.
parent
9e851472
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletion
+23
-1
testsuite/driver/testutil.py
testsuite/driver/testutil.py
+23
-1
No files found.
testsuite/driver/testutil.py
View file @
9792c816
import
os
import
subprocess
import
shutil
import
tempfile
from
pathlib
import
Path
,
PurePath
from
term_color
import
Color
,
colored
...
...
@@ -82,7 +83,28 @@ def testing_metrics():
#
# We define the following function to make this magic more
# explicit/discoverable. You are encouraged to use it instead of os.symlink.
if
os
.
name
==
'nt'
and
os
.
getenv
(
'FORCE_SYMLINKS'
)
==
None
:
def
symlinks_work
()
->
bool
:
if
os
.
getenv
(
'FORCE_SYMLINKS'
)
is
not
None
:
return
True
elif
os
.
name
==
'nt'
:
# On Windows we try to create a symlink to test whether symlinks are
# usable.
works
=
False
with
tempfile
.
NamedTemporaryFile
()
as
tmp
:
try
:
tmp
.
write
(
'hello'
)
os
.
symlink
(
tmp
.
name
,
'__symlink-test'
)
works
=
True
except
OSError
as
e
:
print
(
'Saw {} during symlink test; assuming symlinks do not work.'
.
format
(
e
))
finally
:
os
.
unlink
(
'__symlink-test'
)
return
works
else
:
return
True
if
not
symlinks_work
():
def
link_or_copy_file
(
src
:
Path
,
dst
:
Path
):
shutil
.
copyfile
(
str
(
src
),
str
(
dst
))
else
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment