Skip to content

Commit

Permalink
Enable autoreconf tests on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jasagredo committed Jul 31, 2024
1 parent 9564935 commit 6760dbb
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 9 deletions.
21 changes: 17 additions & 4 deletions cabal-testsuite/PackageTests/Configure/cabal.test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,22 @@ import Test.Cabal.Prelude
import Control.Monad.IO.Class
import Data.Maybe
import System.Directory
import System.Environment
import Data.List (isSuffixOf)

-- Test for 'build-type: Configure' example from the setup manual.
main = cabalTest $ do
hasAutoreconf <- liftIO $ fmap isJust $ findExecutable "autoreconf"
skipUnless "no autoreconf" hasAutoreconf
_ <- shell "autoreconf" ["-i"]
cabal "v2-build" []
if isWindows
then do
mSh <- liftIO $ lookupEnv "SHELL"
case mSh of
Nothing -> skip "Missing $SHELL"
Just sh -> do
env <- getTestEnv
void $ shell sh [ "-l", "-c", "cd $(cygpath -m '" <> testTmpDir env <> "') && autoreconf -i"]
cabal "v2-build" []
else do
hasAutoreconf <- liftIO $ fmap isJust $ findExecutable "autoreconf"
skipUnless "no autoreconf" hasAutoreconf
_ <- shell "autoreconf" ["-i"]
cabal "v2-build" []
22 changes: 17 additions & 5 deletions cabal-testsuite/PackageTests/Configure/setup.test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@ import Test.Cabal.Prelude
import Control.Monad.IO.Class
import Data.Maybe
import System.Directory
import System.Environment

-- Test for 'build-type: Configure' example from the setup manual.
main = setupTest $ do
hasAutoreconf <- liftIO $ fmap isJust $ findExecutable "autoreconf"
skipUnless "no autoreconf" hasAutoreconf
_ <- shell "autoreconf" ["-i"]
setup_build []
main = setupTest $
if isWindows
then do
mSh <- liftIO $ lookupEnv "SHELL"
case mSh of
Nothing -> skip "Missing $SHELL"
Just sh -> do
env <- getTestEnv
void $ shell sh [ "-l", "-c", "cd $(cygpath -m '" <> testTmpDir env <> "') && autoreconf -i"]
setup_build []
else do
hasAutoreconf <- liftIO $ fmap isJust $ findExecutable "autoreconf"
skipUnless "no autoreconf" hasAutoreconf
_ <- shell "autoreconf" ["-i"]
setup_build []

0 comments on commit 6760dbb

Please sign in to comment.