Skip to content

Commit 8fa4a27

Browse files
jasagredoMikolaj
authored andcommitted
Enable autoreconf tests on Windows
(cherry picked from commit b2e4856)
1 parent 38e1ddc commit 8fa4a27

File tree

2 files changed

+42
-9
lines changed

2 files changed

+42
-9
lines changed

cabal-testsuite/PackageTests/Configure/cabal.test.hs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,26 @@ import Test.Cabal.Prelude
22
import Control.Monad.IO.Class
33
import Data.Maybe
44
import System.Directory
5+
import System.Environment
6+
import Data.List (isSuffixOf)
7+
58
-- Test for 'build-type: Configure' example from the setup manual.
69
main = cabalTest $ do
7-
hasAutoreconf <- liftIO $ fmap isJust $ findExecutable "autoreconf"
8-
skipUnless "no autoreconf" hasAutoreconf
9-
_ <- shell "autoreconf" ["-i"]
10-
cabal "v2-build" []
10+
if isWindows
11+
then do
12+
(mCI, mSh) <- liftIO $ (,) <$> lookupEnv "CI" <*> lookupEnv "SHELL"
13+
case (mCI, mSh) of
14+
(Nothing, Nothing) -> skip "Missing $SHELL"
15+
(Nothing, Just sh) -> do
16+
env <- getTestEnv
17+
void $ shell sh [ "-l", "-c", "cd $(cygpath -m '" <> testTmpDir env <> "') && autoreconf -i"]
18+
cabal "v2-build" []
19+
(Just{}, _) -> do
20+
env <- getTestEnv
21+
void $ shell "C:\\msys64\\usr\\bin\\bash.exe" [ "-l", "-c", "cd $(cygpath -m '" <> testTmpDir env <> "') && autoreconf -i"]
22+
cabal "v2-build" []
23+
else do
24+
hasAutoreconf <- liftIO $ fmap isJust $ findExecutable "autoreconf"
25+
skipUnless "no autoreconf" hasAutoreconf
26+
_ <- shell "autoreconf" ["-i"]
27+
cabal "v2-build" []

cabal-testsuite/PackageTests/Configure/setup.test.hs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,25 @@ import Test.Cabal.Prelude
22
import Control.Monad.IO.Class
33
import Data.Maybe
44
import System.Directory
5+
import System.Environment
6+
57
-- Test for 'build-type: Configure' example from the setup manual.
6-
main = setupTest $ do
7-
hasAutoreconf <- liftIO $ fmap isJust $ findExecutable "autoreconf"
8-
skipUnless "no autoreconf" hasAutoreconf
9-
_ <- shell "autoreconf" ["-i"]
10-
setup_build []
8+
main = setupTest $
9+
if isWindows
10+
then do
11+
(mCI, mSh) <- liftIO $ (,) <$> lookupEnv "CI" <*> lookupEnv "SHELL"
12+
case (mCI, mSh) of
13+
(Nothing, Nothing) -> skip "Missing $SHELL"
14+
(Nothing, Just sh) -> do
15+
env <- getTestEnv
16+
void $ shell sh [ "-l", "-c", "cd $(cygpath -m '" <> testTmpDir env <> "') && autoreconf -i"]
17+
setup_build []
18+
(Just{}, _) -> do
19+
env <- getTestEnv
20+
void $ shell "C:\\msys64\\usr\\bin\\bash.exe" [ "-l", "-c", "cd $(cygpath -m '" <> testTmpDir env <> "') && autoreconf -i"]
21+
setup_build []
22+
else do
23+
hasAutoreconf <- liftIO $ fmap isJust $ findExecutable "autoreconf"
24+
skipUnless "no autoreconf" hasAutoreconf
25+
_ <- shell "autoreconf" ["-i"]
26+
setup_build []

0 commit comments

Comments
 (0)