Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Cabal
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Glasgow Haskell Compiler
Packages
Cabal
Commits
d3e589d4
Commit
d3e589d4
authored
7 months ago
by
Javier Sagredo
Browse files
Options
Downloads
Patches
Plain Diff
Enable symlink creation on tests on Windows
parent
39b69247
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cabal-testsuite/src/Test/Cabal/Prelude.hs
+8
-7
8 additions, 7 deletions
cabal-testsuite/src/Test/Cabal/Prelude.hs
with
8 additions
and
7 deletions
cabal-testsuite/src/Test/Cabal/Prelude.hs
+
8
−
7
View file @
d3e589d4
...
...
@@ -54,6 +54,7 @@ import Control.Concurrent.Async (withAsync)
import
qualified
Data.Aeson
as
JSON
import
qualified
Data.ByteString.Lazy
as
BSL
import
Control.Monad
(
unless
,
when
,
void
,
forM_
,
liftM2
,
liftM4
)
import
Control.Monad.Catch
(
bracket_
)
import
Control.Monad.Trans.Reader
(
withReaderT
,
runReaderT
)
import
Control.Monad.IO.Class
(
MonadIO
(
..
))
import
qualified
Crypto.Hash.SHA256
as
SHA256
...
...
@@ -70,10 +71,9 @@ import Control.Retry (exponentialBackoff, limitRetriesByCumulativeDelay)
import
Network.Wait
(
waitTcpVerbose
)
import
System.Environment
import
System.Process
import
System.IO
#
ifndef
mingw32_HOST_OS
import
Control.Monad.Catch
(
bracket_
)
import
System.Posix.Files
(
createSymbolicLink
)
import
System.Posix.Resource
#
endif
...
...
@@ -1123,19 +1123,20 @@ withDelay m = do
Just
_
->
m
-- | Create a symlink for the duration of the provided action. If the symlink
-- already exists, it is deleted.
withSymlink
::
FilePath
->
FilePath
->
TestM
a
->
TestM
a
withSy
m
link
::
FilePath
->
FilePath
->
TestM
a
->
TestM
a
#
if
def
ined
(
mingw32_HOST_OS
)
&&
!
MIN_VERSION_directory
(
1
,
3
,
1
)
withSymlink
_oldpath
_newpath
_act
=
withSymli
nk
_oldpath
_newpath
_act
=
error
"
Test.Cabal.Prelude
.withSymlink: does not work on Windows
with directory <1.3.1
!"
#
else
withSymlink
oldpath
newpath0
act
=
do
liftIO
$
hPutStrLn
stderr
$
"Symlinking "
<>
oldpath
<>
" <== "
<>
newpath0
env
<-
getTestEnv
let
newpath
=
testCurrentDir
env
</>
newpath0
symlinkExists
<-
liftIO
$
doesFileExist
newpath
when
symlinkExists
$
liftIO
$
removeFile
newpath
when
symlinkExists
$
lift
IO
$
rem
oveFile
newpath
bracket_
(
liftIO
$
createSymbolicLink
oldpath
newpath
)
bracket_
(
liftIO
$
create
File
Link
oldpath
newpath
)
(
liftIO
$
pure
()
)
act
#
endif
writeSourceFile
::
FilePath
->
String
->
TestM
()
...
...
This diff is collapsed.
Click to expand it.
Javier Sagredo
@Jasagredo
mentioned in commit
33f6b063
·
5 months ago
mentioned in commit
33f6b063
mentioned in commit 33f6b06327f45c31abd20ea65876bc78d39d1f96
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment