Skip to content

Commit 96dea0f

Browse files
authored
Merge pull request #8672 from haskell/issue-8401-cabal-tests-help
cabal-testsuite #8401: communicate better the need for `--with-cabal`
2 parents 55d6f32 + a97cd47 commit 96dea0f

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

cabal-testsuite/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ How to run
77
1. Build `cabal-testsuite` (`cabal build cabal-testsuite:cabal-tests`)
88
2. Run the `cabal-tests` executable. It will scan for all tests
99
in your current directory and subdirectories and run them.
10-
To run a specific set of tests, use `cabal-tests PATH ...`.
11-
(e.g. `cabal run cabal-testsuite:cabal-tests -- cabal-testsuite/PackageTests/TestOptions/setup.test.hs`)
10+
To run a specific set of tests, use `cabal-tests --with-cabal=CABALBIN PATH ...`.
11+
(e.g. `cabal run cabal-testsuite:cabal-tests -- --with-cabal=cabal cabal-testsuite/PackageTests/TestOptions/setup.test.hs`)
1212
You can control parallelism using the `-j` flag.
1313

1414
There are a few useful flags:

cabal-testsuite/main/cabal-tests.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ main = do
8282
-- https://github.com/appveyor/ci/issues/1364
8383
hSetBuffering stderr LineBuffering
8484

85-
-- Parse arguments
86-
args <- execParser (info mainArgParser mempty)
85+
-- Parse arguments. N.B. 'helper' adds the option `--help`.
86+
args <- execParser $ info (mainArgParser <**> helper) mempty
8787
let verbosity = if mainArgVerbose args then verbose else normal
8888

8989
-- To run our test scripts, we need to be able to run Haskell code

cabal-testsuite/src/Test/Cabal/Monad.hs

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE CPP #-}
12
{-# LANGUAGE ScopedTypeVariables #-}
23

34
-- | The test monad
@@ -72,7 +73,10 @@ import Distribution.Text
7273
import Distribution.Verbosity
7374
import Distribution.Version
7475

75-
import Data.Monoid ((<>), mempty)
76+
#if !MIN_VERSION_base(4,11,0)
77+
import Data.Monoid ((<>))
78+
#endif
79+
import Data.Monoid (mempty)
7680
import qualified Control.Exception as E
7781
import Control.Monad
7882
import Control.Monad.Trans.Reader
@@ -100,8 +104,8 @@ data CommonArgs = CommonArgs {
100104
commonArgParser :: Parser CommonArgs
101105
commonArgParser = CommonArgs
102106
<$> optional (option str
103-
( help "Path to cabal-install executable to test"
104-
Data.Monoid.<> long "with-cabal"
107+
( help "Path to cabal-install executable to test. If omitted, tests involving cabal-install are skipped!"
108+
<> long "with-cabal"
105109
<> metavar "PATH"
106110
))
107111
<*> optional (option str

0 commit comments

Comments
 (0)