Skip to content

Commit b94bc9e

Browse files
committed
Add GHC-8.8 job to travis
Use cabal-install-3.0, as otherwise we won't be able to build custom setup for GHC-8.8
1 parent 53eddce commit b94bc9e

File tree

8 files changed

+104
-83
lines changed

8 files changed

+104
-83
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ matrix:
5353
- env: GHCVER=8.6.5 SCRIPT=script USE_GOLD=YES
5454
os: linux
5555
sudo: required
56+
- env: GHCVER=8.8.1 SCRIPT=script USE_GOLD=YES
57+
os: linux
58+
sudo: required
5659
#- env: GHCVER=8.8.1 SCRIPT=script USE_GOLD=YES
5760
# os: linux
5861
# sudo: required
@@ -120,7 +123,7 @@ before_install:
120123
- export PATH=$HOME/bin:$PATH
121124
- export PATH=$HOME/.cabal/bin:$PATH
122125
- export PATH=$HOME/.local/bin:$PATH
123-
- export PATH=/opt/cabal/2.4/bin:$PATH
126+
- export PATH=/opt/cabal/3.0/bin:$PATH
124127
- if [ "$USE_GOLD" = "YES" ]; then sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20; fi
125128
- if [ "$USE_GOLD" = "YES" ]; then sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10; fi
126129
- ld -v

Cabal/Cabal.cabal

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,9 @@ library
294294
ghc-options: -Wall -fno-ignore-asserts -fwarn-tabs
295295
if impl(ghc >= 8.0)
296296
ghc-options: -Wcompat -Wnoncanonical-monad-instances
297-
-Wnoncanonical-monadfail-instances
297+
298+
if impl(ghc <8.8)
299+
ghc-options: -Wnoncanonical-monadfail-instances
298300

299301
if !impl(ghc >= 8.0)
300302
-- at least one of lib:Cabal's dependency (i.e. `parsec`)

cabal-testsuite/Test/Cabal/Monad.hs

Lines changed: 4 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ module Test.Cabal.Monad (
2323
-- * Recording mode
2424
RecordMode(..),
2525
testRecordMode,
26-
-- * Regex utility (move me somewhere else)
27-
resub,
2826
-- * Derived values from 'TestEnv'
2927
testCurrentDir,
3028
testWorkDir,
@@ -58,6 +56,7 @@ module Test.Cabal.Monad (
5856

5957
import Test.Cabal.Script
6058
import Test.Cabal.Plan
59+
import Test.Cabal.OutputNormalizer
6160

6261
import Distribution.Simple.Compiler
6362
( PackageDBStack, PackageDB(..), compilerFlavor
@@ -67,20 +66,17 @@ import Distribution.Simple.Program.Db
6766
import Distribution.Simple.Program
6867
import Distribution.Simple.Configure
6968
( configCompilerEx )
70-
import Distribution.Version
7169
import Distribution.Text
72-
import Distribution.Package
7370

7471
import Distribution.Verbosity
7572

73+
import Data.Monoid ((<>), mempty)
7674
import qualified Control.Exception as E
7775
import Control.Monad
7876
import Control.Monad.Trans.Reader
7977
import Control.Monad.IO.Class
8078
import Data.Maybe
8179
import Control.Applicative
82-
import Data.Monoid
83-
import qualified Data.Foldable as F
8480
import System.Directory
8581
import System.Exit
8682
import System.FilePath
@@ -89,7 +85,6 @@ import System.IO.Error (isDoesNotExistError)
8985
import System.IO.Temp (withSystemTempDirectory)
9086
import System.Process hiding (env)
9187
import Options.Applicative
92-
import Text.Regex
9388

9489
data CommonArgs = CommonArgs {
9590
argCabalInstallPath :: Maybe FilePath,
@@ -104,7 +99,7 @@ commonArgParser :: Parser CommonArgs
10499
commonArgParser = CommonArgs
105100
<$> optional (option str
106101
( help "Path to cabal-install executable to test"
107-
<> long "with-cabal"
102+
Data.Monoid.<> long "with-cabal"
108103
<> metavar "PATH"
109104
))
110105
<*> optional (option str
@@ -233,7 +228,7 @@ diffProgram = simpleProgram "diff"
233228
-- | Run a test in the test monad according to program's arguments.
234229
runTestM :: String -> TestM a -> IO a
235230
runTestM mode m = withSystemTempDirectory "cabal-testsuite" $ \tmp_dir -> do
236-
args <- execParser (info testArgParser mempty)
231+
args <- execParser (info testArgParser Data.Monoid.mempty)
237232
let dist_dir = testArgDistDir args
238233
(script_dir0, script_filename) = splitFileName (testArgScriptPath args)
239234
script_base = dropExtensions script_filename
@@ -397,57 +392,6 @@ writeFileNoCR f s =
397392
hSetNewlineMode h noNewlineTranslation
398393
hPutStr h s
399394

400-
normalizeOutput :: NormalizerEnv -> String -> String
401-
normalizeOutput nenv =
402-
-- Munge away .exe suffix on filenames (Windows)
403-
resub "([A-Za-z0-9.-]+)\\.exe" "\\1"
404-
-- Normalize backslashes to forward slashes to normalize
405-
-- file paths
406-
. map (\c -> if c == '\\' then '/' else c)
407-
-- Install path frequently has architecture specific elements, so
408-
-- nub it out
409-
. resub "Installing (.+) in .+" "Installing \\1 in <PATH>"
410-
-- Things that look like libraries
411-
. resub "libHS[A-Za-z0-9.-]+\\.(so|dll|a|dynlib)" "<LIBRARY>"
412-
-- This is dumb but I don't feel like pulling in another dep for
413-
-- string search-replace. Make sure we do this before backslash
414-
-- normalization!
415-
. resub (posixRegexEscape (normalizerRoot nenv)) "<ROOT>/"
416-
. resub (posixRegexEscape (normalizerTmpDir nenv)) "<TMPDIR>/"
417-
. appEndo (F.fold (map (Endo . packageIdRegex) (normalizerKnownPackages nenv)))
418-
-- Look for foo-0.1/installed-0d6...
419-
-- These installed packages will vary depending on GHC version
420-
-- Makes assumption that installed packages don't have numbers
421-
-- in package name segment.
422-
-- Apply this before packageIdRegex, otherwise this regex doesn't match.
423-
. resub "([a-zA-Z]+(-[a-zA-Z])*)-[0-9]+(\\.[0-9]+)*/installed-[A-Za-z0-9.]+"
424-
"\\1-<VERSION>/installed-<HASH>..."
425-
-- Normalize architecture
426-
. resub (posixRegexEscape (display (normalizerPlatform nenv))) "<ARCH>"
427-
-- Some GHC versions are chattier than others
428-
. resub "^ignoring \\(possibly broken\\) abi-depends field for packages" ""
429-
-- Normalize the current GHC version. Apply this BEFORE packageIdRegex,
430-
-- which will pick up the install ghc library (which doesn't have the
431-
-- date glob).
432-
. (if normalizerGhcVersion nenv /= nullVersion
433-
then resub (posixRegexEscape (display (normalizerGhcVersion nenv))
434-
-- Also glob the date, for nightly GHC builds
435-
++ "(\\.[0-9]+)?")
436-
"<GHCVER>"
437-
else id)
438-
where
439-
packageIdRegex pid =
440-
resub (posixRegexEscape (display pid) ++ "(-[A-Za-z0-9.-]+)?")
441-
((display (packageName pid)) ++ "-<VERSION>")
442-
443-
data NormalizerEnv = NormalizerEnv {
444-
normalizerRoot :: FilePath,
445-
normalizerTmpDir :: FilePath,
446-
normalizerGhcVersion :: Version,
447-
normalizerKnownPackages :: [PackageId],
448-
normalizerPlatform :: Platform
449-
}
450-
451395
mkNormalizerEnv :: TestM NormalizerEnv
452396
mkNormalizerEnv = do
453397
env <- getTestEnv
@@ -469,16 +413,6 @@ mkNormalizerEnv = do
469413
= testPlatform env
470414
}
471415

472-
posixSpecialChars :: [Char]
473-
posixSpecialChars = ".^$*+?()[{\\|"
474-
475-
posixRegexEscape :: String -> String
476-
posixRegexEscape = concatMap (\c -> if c `elem` posixSpecialChars then ['\\', c] else [c])
477-
478-
resub :: String {- search -} -> String {- replace -} -> String {- input -} -> String
479-
resub search replace s =
480-
subRegex (mkRegex search) s replace
481-
482416
requireProgramM :: Program -> TestM ConfiguredProgram
483417
requireProgramM program = do
484418
env <- getTestEnv
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
module Test.Cabal.OutputNormalizer (
2+
NormalizerEnv (..),
3+
normalizeOutput,
4+
) where
5+
6+
import Data.Monoid (Endo (..))
7+
8+
import Distribution.Version
9+
import Distribution.Text
10+
import Distribution.Pretty
11+
import Distribution.Package
12+
import Distribution.System
13+
14+
import qualified Data.Foldable as F
15+
16+
import Text.Regex
17+
18+
normalizeOutput :: NormalizerEnv -> String -> String
19+
normalizeOutput nenv =
20+
-- Munge away .exe suffix on filenames (Windows)
21+
resub "([A-Za-z0-9.-]+)\\.exe" "\\1"
22+
-- Normalize backslashes to forward slashes to normalize
23+
-- file paths
24+
. map (\c -> if c == '\\' then '/' else c)
25+
-- Install path frequently has architecture specific elements, so
26+
-- nub it out
27+
. resub "Installing (.+) in .+" "Installing \\1 in <PATH>"
28+
-- Things that look like libraries
29+
. resub "libHS[A-Za-z0-9.-]+\\.(so|dll|a|dynlib)" "<LIBRARY>"
30+
-- This is dumb but I don't feel like pulling in another dep for
31+
-- string search-replace. Make sure we do this before backslash
32+
-- normalization!
33+
. resub (posixRegexEscape (normalizerRoot nenv)) "<ROOT>/"
34+
. resub (posixRegexEscape (normalizerTmpDir nenv)) "<TMPDIR>/"
35+
. appEndo (F.fold (map (Endo . packageIdRegex) (normalizerKnownPackages nenv)))
36+
-- Look for foo-0.1/installed-0d6...
37+
-- These installed packages will vary depending on GHC version
38+
-- Makes assumption that installed packages don't have numbers
39+
-- in package name segment.
40+
-- Apply this before packageIdRegex, otherwise this regex doesn't match.
41+
. resub "([a-zA-Z]+(-[a-zA-Z])*)-[0-9]+(\\.[0-9]+)*/installed-[A-Za-z0-9.]+"
42+
"\\1-<VERSION>/installed-<HASH>..."
43+
-- Normalize architecture
44+
. resub (posixRegexEscape (display (normalizerPlatform nenv))) "<ARCH>"
45+
-- Some GHC versions are chattier than others
46+
. resub "^ignoring \\(possibly broken\\) abi-depends field for packages" ""
47+
-- Normalize the current GHC version. Apply this BEFORE packageIdRegex,
48+
-- which will pick up the install ghc library (which doesn't have the
49+
-- date glob).
50+
. (if normalizerGhcVersion nenv /= nullVersion
51+
then resub (posixRegexEscape (display (normalizerGhcVersion nenv))
52+
-- Also glob the date, for nightly GHC builds
53+
++ "(\\.[0-9]+)?")
54+
"<GHCVER>"
55+
else id)
56+
-- hackage-security locks occur non-deterministically
57+
. resub "(Released|Acquired|Waiting) .*hackage-security-lock\n" ""
58+
where
59+
packageIdRegex pid =
60+
resub (posixRegexEscape (display pid) ++ "(-[A-Za-z0-9.-]+)?")
61+
(prettyShow (packageName pid) ++ "-<VERSION>")
62+
63+
data NormalizerEnv = NormalizerEnv
64+
{ normalizerRoot :: FilePath
65+
, normalizerTmpDir :: FilePath
66+
, normalizerGhcVersion :: Version
67+
, normalizerKnownPackages :: [PackageId]
68+
, normalizerPlatform :: Platform
69+
}
70+
71+
posixSpecialChars :: [Char]
72+
posixSpecialChars = ".^$*+?()[{\\|"
73+
74+
posixRegexEscape :: String -> String
75+
posixRegexEscape = concatMap (\c -> if c `elem` posixSpecialChars then ['\\', c] else [c])
76+
77+
resub :: String {- search -} -> String {- replace -} -> String {- input -} -> String
78+
resub search replace s =
79+
subRegex (mkRegex search) s replace

cabal-testsuite/cabal-testsuite.cabal

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ common shared
2626
default-language: Haskell2010
2727

2828
build-depends:
29-
, base >= 4.6 && <4.13
29+
, base >= 4.6 && <4.14
3030
-- this needs to match the in-tree lib:Cabal version
3131
, Cabal == 3.1.0.0
3232

@@ -36,14 +36,15 @@ library
3636
import: shared
3737

3838
exposed-modules:
39-
Test.Cabal.Workdir
40-
Test.Cabal.Script
41-
Test.Cabal.Run
39+
Test.Cabal.CheckArMetadata
40+
Test.Cabal.Monad
41+
Test.Cabal.OutputNormalizer
4242
Test.Cabal.Plan
4343
Test.Cabal.Prelude
44+
Test.Cabal.Run
45+
Test.Cabal.Script
4446
Test.Cabal.Server
45-
Test.Cabal.Monad
46-
Test.Cabal.CheckArMetadata
47+
Test.Cabal.Workdir
4748

4849
other-modules:
4950
Test.Cabal.ScriptEnv0

travis-install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if [ -z ${STACK_CONFIG+x} ]; then
1313
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
1414
travis_retry sudo add-apt-repository -y ppa:hvr/ghc
1515
travis_retry sudo apt-get update
16-
travis_retry sudo apt-get install --force-yes cabal-install-2.4 ghc-$GHCVER-prof ghc-$GHCVER-dyn
16+
travis_retry sudo apt-get install --force-yes cabal-install-3.0 ghc-$GHCVER-prof ghc-$GHCVER-dyn
1717
if [ "x$TEST_OTHER_VERSIONS" = "xYES" ]; then travis_retry sudo apt-get install --force-yes ghc-7.0.4-prof ghc-7.0.4-dyn ghc-7.2.2-prof ghc-7.2.2-dyn ghc-head-prof ghc-head-dyn; fi
1818

1919
if [ "$SCRIPT" = "meta" ]; then
@@ -67,7 +67,7 @@ if [ -z ${STACK_CONFIG+x} ]; then
6767
cd ..;
6868

6969
mkdir "${HOME}/bin"
70-
travis_retry curl -L https://downloads.haskell.org/~cabal/cabal-install-2.4.0.0/cabal-install-2.4.0.0-x86_64-apple-darwin-sierra.tar.gz | tar xzO > "${HOME}/bin/cabal"
70+
travis_retry curl -L https://downloads.haskell.org/~cabal/cabal-install-3.0.0.0/cabal-install-3.0.0.0-x86_64-apple-darwin17.7.0.tar.xz | tar xzO > "${HOME}/bin/cabal"
7171
chmod a+x "${HOME}/bin/cabal"
7272
"${HOME}/bin/cabal" --version
7373

travis-script.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ timed cabal update
7373
# Install executables if necessary
7474
# ---------------------------------------------------------------------
7575

76-
timed cabal install $jobs happy
76+
# TODO: we need v2-install -z
77+
(cd /tmp && timed cabal v2-install $jobs happy --overwrite-policy=always)
7778

7879
# ---------------------------------------------------------------------
7980
# Setup our local project
@@ -159,7 +160,8 @@ fi
159160
# test suites are baked into the cabal binary
160161
timed cabal new-build $jobs $CABAL_INSTALL_FLAGS cabal-install:cabal
161162

162-
timed cabal new-install $jobs hackage-repo-tool --overwrite-policy=always
163+
# TODO: we need v2-install -z
164+
(cd /tmp && timed cabal new-install $jobs hackage-repo-tool --overwrite-policy=always)
163165

164166
if [ "x$SKIP_TESTS" = "xYES" ]; then
165167
exit 1;

travis/binaries/.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ before_install:
1212
- export PATH=$HOME/bin:$PATH
1313
- export PATH=$HOME/.cabal/bin:$PATH
1414
- export PATH=$HOME/.local/bin:$PATH
15-
- export PATH=/opt/cabal/2.4/bin:$PATH
15+
- export PATH=/opt/cabal/3.0/bin:$PATH
1616
- export PATH=/opt/happy/1.19.5/bin:$PATH
1717
- export PATH=/opt/alex/3.1.7/bin:$PATH
1818
- ./travis-install.sh

0 commit comments

Comments
 (0)