Commit fc27efb7 authored by Oleg Grenrus's avatar Oleg Grenrus

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
parent 53eddce4
......@@ -53,6 +53,9 @@ matrix:
- env: GHCVER=8.6.5 SCRIPT=script USE_GOLD=YES
os: linux
sudo: required
- env: GHCVER=8.8.1 SCRIPT=script USE_GOLD=YES
os: linux
sudo: required
#- env: GHCVER=8.8.1 SCRIPT=script USE_GOLD=YES
# os: linux
# sudo: required
......@@ -120,7 +123,7 @@ before_install:
- export PATH=$HOME/bin:$PATH
- export PATH=$HOME/.cabal/bin:$PATH
- export PATH=$HOME/.local/bin:$PATH
- export PATH=/opt/cabal/2.4/bin:$PATH
- export PATH=/opt/cabal/3.0/bin:$PATH
- if [ "$USE_GOLD" = "YES" ]; then sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20; fi
- if [ "$USE_GOLD" = "YES" ]; then sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10; fi
- ld -v
......
......@@ -294,7 +294,9 @@ library
ghc-options: -Wall -fno-ignore-asserts -fwarn-tabs
if impl(ghc >= 8.0)
ghc-options: -Wcompat -Wnoncanonical-monad-instances
-Wnoncanonical-monadfail-instances
if impl(ghc <8.8)
ghc-options: -Wnoncanonical-monadfail-instances
if !impl(ghc >= 8.0)
-- at least one of lib:Cabal's dependency (i.e. `parsec`)
......
......@@ -11,10 +11,12 @@ module Distribution.Client.CmdBuild (
selectComponentTarget
) where
import Prelude ()
import Distribution.Client.Compat.Prelude
import Distribution.Client.ProjectOrchestration
import Distribution.Client.CmdErrorMessages
import Distribution.Compat.Semigroup ((<>))
import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags
, liftOptions, yesNoOpt )
......
......@@ -9,6 +9,9 @@ module Distribution.Client.CmdSdist
, SdistFlags(..), defaultSdistFlags
, OutputFormat(..)) where
import Prelude ()
import Distribution.Client.Compat.Prelude
import Distribution.Client.CmdErrorMessages
( Plural(..), renderComponentKind )
import Distribution.Client.ProjectOrchestration
......@@ -29,9 +32,6 @@ import Distribution.Client.DistDirLayout
import Distribution.Client.ProjectConfig
( findProjectRoot, readProjectConfig )
import Distribution.Compat.Semigroup
((<>))
import Distribution.Package
( Package(packageId) )
import Distribution.PackageDescription.Configuration
......@@ -64,8 +64,6 @@ import qualified Codec.Archive.Tar.Entry as Tar
import qualified Codec.Compression.GZip as GZip
import Control.Exception
( throwIO )
import Control.Monad
( when, forM_ )
import Control.Monad.Trans
( liftIO )
import Control.Monad.State.Lazy
......@@ -77,7 +75,7 @@ import qualified Data.ByteString.Lazy.Char8 as BSL
import Data.Either
( partitionEithers )
import Data.List
( find, sortOn, nub )
( sortOn )
import qualified Data.Set as Set
import System.Directory
( getCurrentDirectory, setCurrentDirectory
......@@ -192,7 +190,7 @@ sdistAction SdistFlags{..} targetStrings globalFlags = do
| length pkgs > 1, not listSources, Just "-" <- mOutputPath' ->
die' verbosity "Can't write multiple tarballs to standard output!"
| otherwise ->
mapM_ (\pkg -> packageToSdist verbosity (distProjectRootDirectory distLayout) format (outputPath pkg) pkg) pkgs
traverse_ (\pkg -> packageToSdist verbosity (distProjectRootDirectory distLayout) format (outputPath pkg) pkg) pkgs
data IsExec = Exec | NoExec
deriving (Show, Eq)
......@@ -256,7 +254,7 @@ packageToSdist verbosity projectRootDir format outputFile pkg = do
Left err -> liftIO $ die' verbosity ("Error packing sdist: " ++ err)
Right path -> tell [Tar.directoryEntry path]
forM_ files $ \(perm, file) -> do
for_ files $ \(perm, file) -> do
let fileDir = takeDirectory (prefix </> file)
perm' = case perm of
Exec -> Tar.executableFilePermissions
......@@ -276,9 +274,9 @@ packageToSdist verbosity projectRootDir format outputFile pkg = do
entries <- execWriterT (evalStateT entriesM mempty)
let -- Pretend our GZip file is made on Unix.
normalize bs = BSL.concat [first, "\x03", rest']
normalize bs = BSL.concat [pfx, "\x03", rest']
where
(first, rest) = BSL.splitAt 9 bs
(pfx, rest) = BSL.splitAt 9 bs
rest' = BSL.tail rest
-- The Unix epoch, which is the default value, is
-- unsuitable because it causes unpacking problems on
......
......@@ -18,12 +18,14 @@ module Distribution.Client.GZipUtils (
maybeDecompress,
) where
import Prelude ()
import Distribution.Client.Compat.Prelude
import Codec.Compression.Zlib.Internal
import Data.ByteString.Lazy.Internal as BS (ByteString(Empty, Chunk))
#if MIN_VERSION_zlib(0,6,0)
import Control.Exception (throw)
import Control.Monad (liftM)
import Control.Monad.ST.Lazy (ST, runST)
import qualified Data.ByteString as Strict
#endif
......
......@@ -141,7 +141,9 @@ executable cabal
if impl(ghc >= 8.0)
ghc-options: -Wcompat
-Wnoncanonical-monad-instances
-Wnoncanonical-monadfail-instances
if impl(ghc < 8.8)
ghc-options: -Wnoncanonical-monadfail-instances
ghc-options: -rtsopts -threaded
......
......@@ -73,7 +73,9 @@ Version: 3.1.0.0
if impl(ghc >= 8.0)
ghc-options: -Wcompat
-Wnoncanonical-monad-instances
-Wnoncanonical-monadfail-instances
if impl(ghc < 8.8)
ghc-options: -Wnoncanonical-monadfail-instances
%enddef
%def CABAL_BUILDINFO
%if CABAL_FLAG_LIB
......
......@@ -2,17 +2,17 @@ module UnitTests.Distribution.Client.GZipUtils (
tests
) where
import Prelude ()
import Distribution.Client.Compat.Prelude
import Codec.Compression.GZip as GZip
import Codec.Compression.Zlib as Zlib
import Control.Exception.Base (evaluate)
import Control.Exception (try, SomeException)
import Control.Monad (void)
import Data.ByteString as BS (null)
import Data.ByteString.Lazy as BSL (pack, toChunks)
import Data.ByteString.Lazy.Char8 as BSLL (pack, init, length)
import Data.Monoid ((<>))
import Distribution.Client.GZipUtils (maybeDecompress)
import Data.Word (Word8)
import Test.Tasty
import Test.Tasty.HUnit
......@@ -34,7 +34,7 @@ maybeDecompressUnitTest =
>> assertBool "decompress gzip (with show)" (show (maybeDecompress compressedGZip) == show original)
>> assertBool "decompress zlib" (maybeDecompress compressedZlib == original)
>> assertBool "decompress gzip" (maybeDecompress compressedGZip == original)
>> assertBool "have no empty chunks" (Prelude.all (not . BS.null) . BSL.toChunks . maybeDecompress $ compressedZlib)
>> assertBool "have no empty chunks" (all (not . BS.null) . BSL.toChunks . maybeDecompress $ compressedZlib)
>> (runBrokenStream >>= assertBool "decompress broken stream" . isLeft)
where
original = BSLL.pack "original uncompressed input"
......
......@@ -23,8 +23,6 @@ module Test.Cabal.Monad (
-- * Recording mode
RecordMode(..),
testRecordMode,
-- * Regex utility (move me somewhere else)
resub,
-- * Derived values from 'TestEnv'
testCurrentDir,
testWorkDir,
......@@ -58,6 +56,7 @@ module Test.Cabal.Monad (
import Test.Cabal.Script
import Test.Cabal.Plan
import Test.Cabal.OutputNormalizer
import Distribution.Simple.Compiler
( PackageDBStack, PackageDB(..), compilerFlavor
......@@ -67,20 +66,17 @@ import Distribution.Simple.Program.Db
import Distribution.Simple.Program
import Distribution.Simple.Configure
( configCompilerEx )
import Distribution.Version
import Distribution.Text
import Distribution.Package
import Distribution.Verbosity
import Data.Monoid ((<>), mempty)
import qualified Control.Exception as E
import Control.Monad
import Control.Monad.Trans.Reader
import Control.Monad.IO.Class
import Data.Maybe
import Control.Applicative
import Data.Monoid
import qualified Data.Foldable as F
import System.Directory
import System.Exit
import System.FilePath
......@@ -89,7 +85,6 @@ import System.IO.Error (isDoesNotExistError)
import System.IO.Temp (withSystemTempDirectory)
import System.Process hiding (env)
import Options.Applicative
import Text.Regex
data CommonArgs = CommonArgs {
argCabalInstallPath :: Maybe FilePath,
......@@ -104,7 +99,7 @@ commonArgParser :: Parser CommonArgs
commonArgParser = CommonArgs
<$> optional (option str
( help "Path to cabal-install executable to test"
<> long "with-cabal"
Data.Monoid.<> long "with-cabal"
<> metavar "PATH"
))
<*> optional (option str
......@@ -233,7 +228,7 @@ diffProgram = simpleProgram "diff"
-- | Run a test in the test monad according to program's arguments.
runTestM :: String -> TestM a -> IO a
runTestM mode m = withSystemTempDirectory "cabal-testsuite" $ \tmp_dir -> do
args <- execParser (info testArgParser mempty)
args <- execParser (info testArgParser Data.Monoid.mempty)
let dist_dir = testArgDistDir args
(script_dir0, script_filename) = splitFileName (testArgScriptPath args)
script_base = dropExtensions script_filename
......@@ -397,57 +392,6 @@ writeFileNoCR f s =
hSetNewlineMode h noNewlineTranslation
hPutStr h s
normalizeOutput :: NormalizerEnv -> String -> String
normalizeOutput nenv =
-- Munge away .exe suffix on filenames (Windows)
resub "([A-Za-z0-9.-]+)\\.exe" "\\1"
-- Normalize backslashes to forward slashes to normalize
-- file paths
. map (\c -> if c == '\\' then '/' else c)
-- Install path frequently has architecture specific elements, so
-- nub it out
. resub "Installing (.+) in .+" "Installing \\1 in <PATH>"
-- Things that look like libraries
. resub "libHS[A-Za-z0-9.-]+\\.(so|dll|a|dynlib)" "<LIBRARY>"
-- This is dumb but I don't feel like pulling in another dep for
-- string search-replace. Make sure we do this before backslash
-- normalization!
. resub (posixRegexEscape (normalizerRoot nenv)) "<ROOT>/"
. resub (posixRegexEscape (normalizerTmpDir nenv)) "<TMPDIR>/"
. appEndo (F.fold (map (Endo . packageIdRegex) (normalizerKnownPackages nenv)))
-- Look for foo-0.1/installed-0d6...
-- These installed packages will vary depending on GHC version
-- Makes assumption that installed packages don't have numbers
-- in package name segment.
-- Apply this before packageIdRegex, otherwise this regex doesn't match.
. resub "([a-zA-Z]+(-[a-zA-Z])*)-[0-9]+(\\.[0-9]+)*/installed-[A-Za-z0-9.]+"
"\\1-<VERSION>/installed-<HASH>..."
-- Normalize architecture
. resub (posixRegexEscape (display (normalizerPlatform nenv))) "<ARCH>"
-- Some GHC versions are chattier than others
. resub "^ignoring \\(possibly broken\\) abi-depends field for packages" ""
-- Normalize the current GHC version. Apply this BEFORE packageIdRegex,
-- which will pick up the install ghc library (which doesn't have the
-- date glob).
. (if normalizerGhcVersion nenv /= nullVersion
then resub (posixRegexEscape (display (normalizerGhcVersion nenv))
-- Also glob the date, for nightly GHC builds
++ "(\\.[0-9]+)?")
"<GHCVER>"
else id)
where
packageIdRegex pid =
resub (posixRegexEscape (display pid) ++ "(-[A-Za-z0-9.-]+)?")
((display (packageName pid)) ++ "-<VERSION>")
data NormalizerEnv = NormalizerEnv {
normalizerRoot :: FilePath,
normalizerTmpDir :: FilePath,
normalizerGhcVersion :: Version,
normalizerKnownPackages :: [PackageId],
normalizerPlatform :: Platform
}
mkNormalizerEnv :: TestM NormalizerEnv
mkNormalizerEnv = do
env <- getTestEnv
......@@ -469,16 +413,6 @@ mkNormalizerEnv = do
= testPlatform env
}
posixSpecialChars :: [Char]
posixSpecialChars = ".^$*+?()[{\\|"
posixRegexEscape :: String -> String
posixRegexEscape = concatMap (\c -> if c `elem` posixSpecialChars then ['\\', c] else [c])
resub :: String {- search -} -> String {- replace -} -> String {- input -} -> String
resub search replace s =
subRegex (mkRegex search) s replace
requireProgramM :: Program -> TestM ConfiguredProgram
requireProgramM program = do
env <- getTestEnv
......
module Test.Cabal.OutputNormalizer (
NormalizerEnv (..),
normalizeOutput,
) where
import Data.Monoid (Endo (..))
import Distribution.Version
import Distribution.Text
import Distribution.Pretty
import Distribution.Package
import Distribution.System
import qualified Data.Foldable as F
import Text.Regex
normalizeOutput :: NormalizerEnv -> String -> String
normalizeOutput nenv =
-- Munge away .exe suffix on filenames (Windows)
resub "([A-Za-z0-9.-]+)\\.exe" "\\1"
-- Normalize backslashes to forward slashes to normalize
-- file paths
. map (\c -> if c == '\\' then '/' else c)
-- Install path frequently has architecture specific elements, so
-- nub it out
. resub "Installing (.+) in .+" "Installing \\1 in <PATH>"
-- Things that look like libraries
. resub "libHS[A-Za-z0-9.-]+\\.(so|dll|a|dynlib)" "<LIBRARY>"
-- This is dumb but I don't feel like pulling in another dep for
-- string search-replace. Make sure we do this before backslash
-- normalization!
. resub (posixRegexEscape (normalizerRoot nenv)) "<ROOT>/"
. resub (posixRegexEscape (normalizerTmpDir nenv)) "<TMPDIR>/"
. appEndo (F.fold (map (Endo . packageIdRegex) (normalizerKnownPackages nenv)))
-- Look for foo-0.1/installed-0d6...
-- These installed packages will vary depending on GHC version
-- Makes assumption that installed packages don't have numbers
-- in package name segment.
-- Apply this before packageIdRegex, otherwise this regex doesn't match.
. resub "([a-zA-Z]+(-[a-zA-Z])*)-[0-9]+(\\.[0-9]+)*/installed-[A-Za-z0-9.]+"
"\\1-<VERSION>/installed-<HASH>..."
-- Normalize architecture
. resub (posixRegexEscape (display (normalizerPlatform nenv))) "<ARCH>"
-- Some GHC versions are chattier than others
. resub "^ignoring \\(possibly broken\\) abi-depends field for packages" ""
-- Normalize the current GHC version. Apply this BEFORE packageIdRegex,
-- which will pick up the install ghc library (which doesn't have the
-- date glob).
. (if normalizerGhcVersion nenv /= nullVersion
then resub (posixRegexEscape (display (normalizerGhcVersion nenv))
-- Also glob the date, for nightly GHC builds
++ "(\\.[0-9]+)?")
"<GHCVER>"
else id)
-- hackage-security locks occur non-deterministically
. resub "(Released|Acquired|Waiting) .*hackage-security-lock\n" ""
where
packageIdRegex pid =
resub (posixRegexEscape (display pid) ++ "(-[A-Za-z0-9.-]+)?")
(prettyShow (packageName pid) ++ "-<VERSION>")
data NormalizerEnv = NormalizerEnv
{ normalizerRoot :: FilePath
, normalizerTmpDir :: FilePath
, normalizerGhcVersion :: Version
, normalizerKnownPackages :: [PackageId]
, normalizerPlatform :: Platform
}
posixSpecialChars :: [Char]
posixSpecialChars = ".^$*+?()[{\\|"
posixRegexEscape :: String -> String
posixRegexEscape = concatMap (\c -> if c `elem` posixSpecialChars then ['\\', c] else [c])
resub :: String {- search -} -> String {- replace -} -> String {- input -} -> String
resub search replace s =
subRegex (mkRegex search) s replace
......@@ -26,7 +26,7 @@ common shared
default-language: Haskell2010
build-depends:
, base >= 4.6 && <4.13
, base >= 4.6 && <4.14
-- this needs to match the in-tree lib:Cabal version
, Cabal == 3.1.0.0
......@@ -36,14 +36,15 @@ library
import: shared
exposed-modules:
Test.Cabal.Workdir
Test.Cabal.Script
Test.Cabal.Run
Test.Cabal.CheckArMetadata
Test.Cabal.Monad
Test.Cabal.OutputNormalizer
Test.Cabal.Plan
Test.Cabal.Prelude
Test.Cabal.Run
Test.Cabal.Script
Test.Cabal.Server
Test.Cabal.Monad
Test.Cabal.CheckArMetadata
Test.Cabal.Workdir
other-modules:
Test.Cabal.ScriptEnv0
......
......@@ -13,7 +13,7 @@ if [ -z ${STACK_CONFIG+x} ]; then
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
travis_retry sudo add-apt-repository -y ppa:hvr/ghc
travis_retry sudo apt-get update
travis_retry sudo apt-get install --force-yes cabal-install-2.4 ghc-$GHCVER-prof ghc-$GHCVER-dyn
travis_retry sudo apt-get install --force-yes cabal-install-3.0 ghc-$GHCVER-prof ghc-$GHCVER-dyn
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
if [ "$SCRIPT" = "meta" ]; then
......@@ -67,7 +67,7 @@ if [ -z ${STACK_CONFIG+x} ]; then
cd ..;
mkdir "${HOME}/bin"
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"
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"
chmod a+x "${HOME}/bin/cabal"
"${HOME}/bin/cabal" --version
......
......@@ -73,7 +73,8 @@ timed cabal update
# Install executables if necessary
# ---------------------------------------------------------------------
timed cabal install $jobs happy
# TODO: we need v2-install -z
(cd /tmp && timed cabal v2-install $jobs happy --overwrite-policy=always)
# ---------------------------------------------------------------------
# Setup our local project
......@@ -159,7 +160,8 @@ fi
# test suites are baked into the cabal binary
timed cabal new-build $jobs $CABAL_INSTALL_FLAGS cabal-install:cabal
timed cabal new-install $jobs hackage-repo-tool --overwrite-policy=always
# TODO: we need v2-install -z
(cd /tmp && timed cabal new-install $jobs hackage-repo-tool --overwrite-policy=always)
if [ "x$SKIP_TESTS" = "xYES" ]; then
exit 1;
......
......@@ -12,7 +12,7 @@ before_install:
- export PATH=$HOME/bin:$PATH
- export PATH=$HOME/.cabal/bin:$PATH
- export PATH=$HOME/.local/bin:$PATH
- export PATH=/opt/cabal/2.4/bin:$PATH
- export PATH=/opt/cabal/3.0/bin:$PATH
- export PATH=/opt/happy/1.19.5/bin:$PATH
- export PATH=/opt/alex/3.1.7/bin:$PATH
- ./travis-install.sh
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment