1 import Test
.Cabal
.Prelude
2 import qualified System
.Process
as Process
3 import Control
.Concurrent
(threadDelay
)
4 import System
.Directory
(removeFile)
5 import Control
.Exception
(catch, throwIO
)
6 import System
.IO.Error
(isDoesNotExistError)
7 import qualified Data
.Time
.Clock
as Time
8 import qualified Data
.Time
.Format
as Time
10 import System
.Environment
11 import System
.FilePath
16 res
<- cabalWithStdin
"v2-build" ["all"] ""
17 exe_path
<- withPlan
$ planExePath
"setup-test" "cabal-aaaa"
18 addToPath
(takeDirectory exe_path
) $ do
19 -- Test that the thing works at all
20 res
<- fails
$ cabal_raw_action
["aaaa"] (\h
-> () <$ Process
.waitForProcess h
)
21 assertOutputContains
"aaaa" res
22 -- Check the exit code is the one returned by subcommand
23 unless (resultExitCode res
== ExitFailure
99) (assertFailure
$ "Incorrect exit code: " ++ show (resultExitCode res
))
26 cabal_raw_action
:: [String] -> (Process
.ProcessHandle
-> IO ()) -> TestM Result
27 cabal_raw_action args action
= do
28 configured_prog
<- requireProgramM cabalProgram
30 r
<- liftIO
$ runAction
(testVerbosity env
)
31 (Just
$ testCurrentDir env
)
33 (programPath configured_prog
)