diff --git a/.docker/validate-7.10.3.dockerfile b/.docker/validate-7.10.3.dockerfile new file mode 100644 index 00000000000..7e6ef100f6e --- /dev/null +++ b/.docker/validate-7.10.3.dockerfile @@ -0,0 +1,51 @@ +FROM phadej/ghc:7.10.3-bionic + +# We need newer compiler, to install cabal-plan +RUN apt-get update +RUN apt-get install -y ghc-8.6.5 + +# Install cabal-plan +RUN cabal v2-update +RUN cabal v2-install -w /opt/ghc/8.6.5/bin/ghc-8.6.5 cabal-plan --constraint 'cabal-plan ^>=0.6' + +# Remove ghc-8.6.5, so it doesn't interfere +RUN apt-get remove -y ghc-8.6.5 + +# We install happy, so it's in the store; we (hopefully) don't use it directly. +RUN cabal v2-install happy --constraint 'happy ^>=1.19.12' + +# Install some other dependencies +# Remove $HOME/.ghc so there aren't any environments +RUN cabal v2-install -w ghc-7.10.3 --lib \ + aeson \ + async \ + base-compat \ + base16-bytestring \ + base64-bytestring \ + cryptohash-sha256 \ + Diff \ + echo \ + ed25519 \ + edit-distance \ + haskell-lexer \ + HTTP \ + network \ + optparse-applicative \ + pretty-show \ + regex-compat-tdfa \ + regex-tdfa \ + resolv \ + statistics \ + tar \ + tasty \ + tasty-golden \ + tasty-hunit \ + tasty-quickcheck \ + tree-diff \ + zlib \ + && rm -rf $HOME/.ghc + +# Validate +WORKDIR /build +COPY . /build +RUN sh ./validate.sh -w ghc-7.10.3 -v diff --git a/.docker/validate-7.6.3.dockerfile b/.docker/validate-7.6.3.dockerfile new file mode 100644 index 00000000000..7b046cf88d1 --- /dev/null +++ b/.docker/validate-7.6.3.dockerfile @@ -0,0 +1,62 @@ +# TODO: change to bionic +# https://github.com/haskell-CI/haskell-ci/issues/342 +FROM phadej/ghc:7.6.3-xenial + +# We need newer compiler, to install cabal-plan +RUN apt-get update +RUN apt-get install -y ghc-8.6.5 ghc-7.6.3-dyn + +# Install cabal-plan +RUN cabal v2-update +RUN cabal v2-install -w /opt/ghc/8.6.5/bin/ghc-8.6.5 cabal-plan --constraint 'cabal-plan ^>=0.6' + +# Remove ghc-8.6.5, so it doesn't interfere +RUN apt-get remove -y ghc-8.6.5 + +# We install happy, so it's in the store; we (hopefully) don't use it directly. +RUN cabal v2-install happy --constraint 'happy ^>=1.19.12' + +# Install some other dependencies +# Remove $HOME/.ghc so there aren't any environments +RUN cabal v2-install -w ghc-7.6.3 --lib \ + aeson \ + async \ + base-compat \ + base16-bytestring \ + base64-bytestring \ + cryptohash-sha256 \ + Diff \ + echo \ + ed25519 \ + edit-distance \ + haskell-lexer \ + HTTP \ + network \ + optparse-applicative \ + pretty-show \ + regex-compat-tdfa \ + regex-tdfa \ + statistics \ + tar \ + tasty \ + tasty-golden \ + tasty-hunit \ + tasty-quickcheck \ + tree-diff \ + zlib \ + --constraint="bytestring installed" \ + --constraint="binary installed" \ + --constraint="containers installed" \ + --constraint="deepseq installed" \ + --constraint="directory installed" \ + --constraint="filepath installed" \ + --constraint="pretty installed" \ + --constraint="process installed" \ + --constraint="time installed" \ + --constraint="unix installed" \ + && rm -rf $HOME/.ghc + +# Validate +WORKDIR /build +COPY . /build +RUN sh ./validate.sh -l -w ghc-7.6.3 -v diff --git a/.docker/validate-7.8.4.dockerfile b/.docker/validate-7.8.4.dockerfile new file mode 100644 index 00000000000..83d2e8fc280 --- /dev/null +++ b/.docker/validate-7.8.4.dockerfile @@ -0,0 +1,62 @@ +# TODO: change to bionic +# https://github.com/haskell-CI/haskell-ci/issues/342 +FROM phadej/ghc:7.8.4-xenial + +# We need newer compiler, to install cabal-plan +RUN apt-get update +RUN apt-get install -y ghc-8.6.5 ghc-7.8.4-dyn + +# Install cabal-plan +RUN cabal v2-update +RUN cabal v2-install -w /opt/ghc/8.6.5/bin/ghc-8.6.5 cabal-plan --constraint 'cabal-plan ^>=0.6' + +# Remove ghc-8.6.5, so it doesn't interfere +RUN apt-get remove -y ghc-8.6.5 + +# We install happy, so it's in the store; we (hopefully) don't use it directly. +RUN cabal v2-install happy --constraint 'happy ^>=1.19.12' + +# Install some other dependencies +# Remove $HOME/.ghc so there aren't any environments +RUN cabal v2-install -w ghc-7.8.4 --lib \ + aeson \ + async \ + base-compat \ + base16-bytestring \ + base64-bytestring \ + cryptohash-sha256 \ + Diff \ + echo \ + ed25519 \ + edit-distance \ + haskell-lexer \ + HTTP \ + network \ + optparse-applicative \ + pretty-show \ + regex-compat-tdfa \ + regex-tdfa \ + statistics \ + tar \ + tasty \ + tasty-golden \ + tasty-hunit \ + tasty-quickcheck \ + tree-diff \ + zlib \ + --constraint="bytestring installed" \ + --constraint="binary installed" \ + --constraint="containers installed" \ + --constraint="deepseq installed" \ + --constraint="directory installed" \ + --constraint="filepath installed" \ + --constraint="pretty installed" \ + --constraint="process installed" \ + --constraint="time installed" \ + --constraint="unix installed" \ + && rm -rf $HOME/.ghc + +# Validate +WORKDIR /build +COPY . /build +RUN sh ./validate.sh -l -w ghc-7.8.4 -v diff --git a/.docker/validate-8.0.2.dockerfile b/.docker/validate-8.0.2.dockerfile new file mode 100644 index 00000000000..10147cd0e87 --- /dev/null +++ b/.docker/validate-8.0.2.dockerfile @@ -0,0 +1,44 @@ +FROM phadej/ghc:8.0.2-bionic + +# Install cabal-plan +RUN cabal v2-update +RUN cabal v2-install cabal-plan --constraint 'cabal-plan ^>=0.6' + +# We install happy, so it's in the store; we (hopefully) don't use it directly. +RUN cabal v2-install happy --constraint 'happy ^>=1.19.12' + +# Install some other dependencies +# Remove $HOME/.ghc so there aren't any environments +RUN cabal v2-install -w ghc-8.0.2 --lib \ + aeson \ + async \ + base-compat \ + base16-bytestring \ + base64-bytestring \ + cryptohash-sha256 \ + Diff \ + echo \ + ed25519 \ + edit-distance \ + haskell-lexer \ + HTTP \ + network \ + optparse-applicative \ + pretty-show \ + regex-compat-tdfa \ + regex-tdfa \ + resolv \ + statistics \ + tar \ + tasty \ + tasty-golden \ + tasty-hunit \ + tasty-quickcheck \ + tree-diff \ + zlib \ + && rm -rf $HOME/.ghc + +# Validate +WORKDIR /build +COPY . /build +RUN sh ./validate.sh -w ghc-8.0.2 -v diff --git a/.docker/validate-8.2.2.dockerfile b/.docker/validate-8.2.2.dockerfile new file mode 100644 index 00000000000..e9bb8b904dd --- /dev/null +++ b/.docker/validate-8.2.2.dockerfile @@ -0,0 +1,44 @@ +FROM phadej/ghc:8.2.2-bionic + +# Install cabal-plan +RUN cabal v2-update +RUN cabal v2-install cabal-plan --constraint 'cabal-plan ^>=0.6' + +# We install happy, so it's in the store; we (hopefully) don't use it directly. +RUN cabal v2-install happy --constraint 'happy ^>=1.19.12' + +# Install some other dependencies +# Remove $HOME/.ghc so there aren't any environments +RUN cabal v2-install -w ghc-8.2.2 --lib \ + aeson \ + async \ + base-compat \ + base16-bytestring \ + base64-bytestring \ + cryptohash-sha256 \ + Diff \ + echo \ + ed25519 \ + edit-distance \ + haskell-lexer \ + HTTP \ + network \ + optparse-applicative \ + pretty-show \ + regex-compat-tdfa \ + regex-tdfa \ + resolv \ + statistics \ + tar \ + tasty \ + tasty-golden \ + tasty-hunit \ + tasty-quickcheck \ + tree-diff \ + zlib \ + && rm -rf $HOME/.ghc + +# Validate +WORKDIR /build +COPY . /build +RUN sh ./validate.sh -w ghc-8.2.2 -v diff --git a/.docker/validate-8.4.4.dockerfile b/.docker/validate-8.4.4.dockerfile new file mode 100644 index 00000000000..7b4891399ff --- /dev/null +++ b/.docker/validate-8.4.4.dockerfile @@ -0,0 +1,44 @@ +FROM phadej/ghc:8.6.5-bionic + +# Install cabal-plan +RUN cabal v2-update +RUN cabal v2-install cabal-plan --constraint 'cabal-plan ^>=0.6' + +# We install happy, so it's in the store; we (hopefully) don't use it directly. +RUN cabal v2-install happy --constraint 'happy ^>=1.19.12' + +# Install some other dependencies +# Remove $HOME/.ghc so there aren't any environments +RUN cabal v2-install -w ghc-8.6.5 --lib \ + aeson \ + async \ + base-compat \ + base16-bytestring \ + base64-bytestring \ + cryptohash-sha256 \ + Diff \ + echo \ + ed25519 \ + edit-distance \ + haskell-lexer \ + HTTP \ + network \ + optparse-applicative \ + pretty-show \ + regex-compat-tdfa \ + regex-tdfa \ + resolv \ + statistics \ + tar \ + tasty \ + tasty-golden \ + tasty-hunit \ + tasty-quickcheck \ + tree-diff \ + zlib \ + && rm -rf $HOME/.ghc + +# Validate +WORKDIR /build +COPY . /build +RUN sh ./validate.sh -w ghc-8.6.5 -v diff --git a/.docker/validate-8.6.5.dockerfile b/.docker/validate-8.6.5.dockerfile new file mode 100644 index 00000000000..7b4891399ff --- /dev/null +++ b/.docker/validate-8.6.5.dockerfile @@ -0,0 +1,44 @@ +FROM phadej/ghc:8.6.5-bionic + +# Install cabal-plan +RUN cabal v2-update +RUN cabal v2-install cabal-plan --constraint 'cabal-plan ^>=0.6' + +# We install happy, so it's in the store; we (hopefully) don't use it directly. +RUN cabal v2-install happy --constraint 'happy ^>=1.19.12' + +# Install some other dependencies +# Remove $HOME/.ghc so there aren't any environments +RUN cabal v2-install -w ghc-8.6.5 --lib \ + aeson \ + async \ + base-compat \ + base16-bytestring \ + base64-bytestring \ + cryptohash-sha256 \ + Diff \ + echo \ + ed25519 \ + edit-distance \ + haskell-lexer \ + HTTP \ + network \ + optparse-applicative \ + pretty-show \ + regex-compat-tdfa \ + regex-tdfa \ + resolv \ + statistics \ + tar \ + tasty \ + tasty-golden \ + tasty-hunit \ + tasty-quickcheck \ + tree-diff \ + zlib \ + && rm -rf $HOME/.ghc + +# Validate +WORKDIR /build +COPY . /build +RUN sh ./validate.sh -w ghc-8.6.5 -v diff --git a/.docker/validate-8.8.1.dockerfile b/.docker/validate-8.8.1.dockerfile new file mode 100644 index 00000000000..3f8d1603f31 --- /dev/null +++ b/.docker/validate-8.8.1.dockerfile @@ -0,0 +1,45 @@ +FROM phadej/ghc:8.8.1-bionic + +# Install cabal-plan +RUN cabal v2-update +RUN cabal v2-install cabal-plan --constraint 'cabal-plan ^>=0.6' + +# We install happy, so it's in the store; we (hopefully) don't use it directly. +RUN cabal v2-install happy --constraint 'happy ^>=1.19.12' +RUN cabal v2-install doctest --constraint 'doctest ^>= 0.16.2' + +# Install some other dependencies +# Remove $HOME/.ghc so there aren't any environments +RUN cabal v2-install -w ghc-8.8.1 --lib \ + aeson \ + async \ + base-compat \ + base16-bytestring \ + base64-bytestring \ + cryptohash-sha256 \ + Diff \ + echo \ + ed25519 \ + edit-distance \ + haskell-lexer \ + HTTP \ + network \ + optparse-applicative \ + pretty-show \ + regex-compat-tdfa \ + regex-tdfa \ + resolv \ + statistics \ + tar \ + tasty \ + tasty-golden \ + tasty-hunit \ + tasty-quickcheck \ + tree-diff \ + zlib \ + && rm -rf $HOME/.ghc + +# Validate +WORKDIR /build +COPY . /build +RUN sh ./validate.sh -w ghc-8.8.1 -v -D diff --git a/.dockerignore b/.dockerignore index 47c984d1b46..024a5f82a4c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,6 +3,8 @@ cabal.project.local .ghc.environment.* +.docker/ + **/.hpc **/*.hi **/*.o diff --git a/Cabal/Cabal.cabal b/Cabal/Cabal.cabal index 12034e3310c..0c6ade9e65a 100644 --- a/Cabal/Cabal.cabal +++ b/Cabal/Cabal.cabal @@ -319,6 +319,7 @@ library Distribution.Compat.Directory Distribution.Compat.Environment Distribution.Compat.Exception + Distribution.Compat.FilePath Distribution.Compat.Graph Distribution.Compat.Internal.TempFile Distribution.Compat.Newtype diff --git a/Cabal/ChangeLog.md b/Cabal/ChangeLog.md index 0634cf316d1..0e3f9471086 100644 --- a/Cabal/ChangeLog.md +++ b/Cabal/ChangeLog.md @@ -7,6 +7,12 @@ ([#6386](https://github.com/haskell/cabal/pull/6386) * Fix boundless sublibrary depedency parse failure ([#5846](https://github.com/haskell/cabal/issues/5846)) + * `cabal check` verifies `cpp-options` more pedantically, allowing only + options starting with `-D` and `-U`. + * Don’t rebuild world when new ghc flags that affect how error + messages are presented is specified. + * Fix dropExeExtension behaviour on Windows + ([#6287](https://github.com/haskell/cabal/pull/6287) # 3.0.0.0 [Mikhail Glushenkov](mailto:mikhail.glushenkov@gmail.com) August 2019 * The 3.0 migration guide gives advice on adapting Custom setup diff --git a/Cabal/Distribution/Compat/FilePath.hs b/Cabal/Distribution/Compat/FilePath.hs new file mode 100644 index 00000000000..8c5b11a7262 --- /dev/null +++ b/Cabal/Distribution/Compat/FilePath.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE CPP #-} + +{-# OPTIONS_GHC -fno-warn-unused-imports #-} + +module Distribution.Compat.FilePath +( isExtensionOf +, stripExtension +) where + +import Data.List ( isSuffixOf, stripPrefix ) +import System.FilePath + +#if !MIN_VERSION_filepath(1,4,2) +isExtensionOf :: String -> FilePath -> Bool +isExtensionOf ext@('.':_) = isSuffixOf ext . takeExtensions +isExtensionOf ext = isSuffixOf ('.':ext) . takeExtensions +#endif + +#if !MIN_VERSION_filepath(1,4,1) +stripExtension :: String -> FilePath -> Maybe FilePath +stripExtension [] path = Just path +stripExtension ext@(x:_) path = stripSuffix dotExt path + where + dotExt = if isExtSeparator x then ext else '.':ext + stripSuffix :: Eq a => [a] -> [a] -> Maybe [a] + stripSuffix xs ys = fmap reverse $ stripPrefix (reverse xs) (reverse ys) +#endif diff --git a/Cabal/Distribution/PackageDescription/Check.hs b/Cabal/Distribution/PackageDescription/Check.hs index 390436bcc74..74acb1d570e 100644 --- a/Cabal/Distribution/PackageDescription/Check.hs +++ b/Cabal/Distribution/PackageDescription/Check.hs @@ -1284,7 +1284,7 @@ checkCabalVersion pkg = [ prettyShow (Dependency name (eliminateMajorBoundSyntax versionRange) Set.empty) | Dependency name versionRange _ <- depsUsingMajorBoundSyntax ] - , checkVersion [2,1] (any (not . null) + , checkVersion [3,0] (any (not . null) (concatMap buildInfoField [ asmSources , cmmSources @@ -1293,7 +1293,7 @@ checkCabalVersion pkg = PackageDistInexcusable $ "The use of 'asm-sources', 'cmm-sources', 'extra-bundled-libraries' " ++ " and 'extra-library-flavours' requires the package " - ++ " to specify at least 'cabal-version: >= 2.1'." + ++ " to specify at least 'cabal-version: 3.0'." , checkVersion [2,5] (any (not . null) $ buildInfoField extraDynLibFlavours) $ PackageDistInexcusable $ diff --git a/Cabal/Distribution/Simple/Program/GHC.hs b/Cabal/Distribution/Simple/Program/GHC.hs index dff628de62c..fa67928fb98 100644 --- a/Cabal/Distribution/Simple/Program/GHC.hs +++ b/Cabal/Distribution/Simple/Program/GHC.hs @@ -173,6 +173,19 @@ normaliseGhcArgs (Just ghcVersion) PackageDescription{..} ghcArgs , "print-bind-contents", "print-evld-with-show" , "implicit-import-qualified", "error-spans" ] + , from [7,8] + [ "print-explicit-foralls" -- maybe also earlier, but GHC-7.6 doesn't have --show-options + , "print-explicit-kinds" + ] + , from [8,0] + [ "print-explicit-coercions" + , "print-explicit-runtime-reps" + , "print-equality-relations" + , "print-unicode-syntax" + , "print-expanded-synonyms" + , "print-potential-instances" + , "print-typechecker-elaboration" + ] , from [8,2] [ "diagnostics-show-caret", "local-ghci-history" , "show-warning-groups", "hide-source-paths" @@ -202,7 +215,7 @@ normaliseGhcArgs (Just ghcVersion) PackageDescription{..} ghcArgs simpleFlags :: Set String simpleFlags = Set.fromList . mconcat $ - [ [ "-n", "-#include", "-Rghc-timing", "-dsuppress-all", "-dstg-stats" + [ [ "-n", "-#include", "-Rghc-timing", "-dstg-stats" , "-dth-dec-file", "-dsource-stats", "-dverbose-core2core" , "-dverbose-stg2stg", "-dcore-lint", "-dstg-lint", "-dcmm-lint" , "-dasm-lint", "-dannot-lint", "-dshow-passes", "-dfaststring-stats" diff --git a/Cabal/Distribution/Simple/Utils.hs b/Cabal/Distribution/Simple/Utils.hs index 8dbcf07a908..12eb4ad36bd 100644 --- a/Cabal/Distribution/Simple/Utils.hs +++ b/Cabal/Distribution/Simple/Utils.hs @@ -177,6 +177,7 @@ import Distribution.Version import Distribution.Compat.CopyFile import Distribution.Compat.Internal.TempFile import Distribution.Compat.Exception +import Distribution.Compat.FilePath as FilePath import Distribution.Compat.Stack import Distribution.Verbosity import Distribution.Types.PackageId @@ -212,7 +213,7 @@ import System.Environment ( getProgName ) import System.Exit ( exitWith, ExitCode(..) ) -import System.FilePath +import System.FilePath as FilePath ( normalise, (), (<.>) , getSearchPath, joinPath, takeDirectory, splitExtension , splitDirectories, searchPathSeparator ) @@ -1411,11 +1412,25 @@ shortRelativePath from to = -- unchanged. dropExeExtension :: FilePath -> FilePath dropExeExtension filepath = - case splitExtension filepath of - (filepath', extension) | extension `elem` exeExtensions -> filepath' - | otherwise -> filepath - --- | List of possible executable file extensions on the current platform. + -- System.FilePath's extension handling functions are horribly + -- inconsistent, consider: + -- + -- isExtensionOf "" "foo" == False but + -- isExtensionOf "" "foo." == True. + -- + -- On the other hand stripExtension doesn't remove the empty extension: + -- + -- stripExtension "" "foo." == Just "foo." + -- + -- Since by "" in exeExtensions we mean 'no extension' anyways we can + -- just always ignore it here. + let exts = [ ext | ext <- exeExtensions, ext /= "" ] in + fromMaybe filepath $ do + ext <- find (`FilePath.isExtensionOf` filepath) exts + ext `FilePath.stripExtension` filepath + +-- | List of possible executable file extensions on the current build +-- platform. exeExtensions :: [String] exeExtensions = case buildOS of -- Possible improvement: on Windows, read the list of extensions from the diff --git a/Cabal/tests/UnitTests/Distribution/Simple/Utils.hs b/Cabal/tests/UnitTests/Distribution/Simple/Utils.hs index 99abc00c35c..7ebf6ac32b4 100644 --- a/Cabal/tests/UnitTests/Distribution/Simple/Utils.hs +++ b/Cabal/tests/UnitTests/Distribution/Simple/Utils.hs @@ -2,13 +2,16 @@ module UnitTests.Distribution.Simple.Utils ( tests ) where +import Distribution.Simple.BuildPaths ( exeExtension ) import Distribution.Simple.Utils +import Distribution.System ( buildPlatform ) import Distribution.Verbosity import Data.IORef import System.Directory ( doesDirectoryExist, doesFileExist , getTemporaryDirectory , removeDirectoryRecursive, removeFile ) +import System.FilePath ( (<.>) ) import System.IO (hClose, localeEncoding, hPutStrLn) import System.IO.Error import qualified Control.Exception as Exception @@ -84,6 +87,10 @@ rawSystemStdInOutTextDecodingTest ghcPath Left err | isDoesNotExistError err -> Exception.throwIO err -- no ghc! | otherwise -> return () +dropExeExtensionTest :: Assertion +dropExeExtensionTest = + assertBool "dropExeExtension didn't drop exeExtension!" $ + dropExeExtension ("foo" <.> exeExtension buildPlatform) == "foo" tests :: FilePath -> [TestTree] @@ -98,4 +105,6 @@ tests ghcPath = withTempDirRemovedTest , testCase "rawSystemStdInOut reports text decoding errors" $ rawSystemStdInOutTextDecodingTest ghcPath + , testCase "dropExeExtension drops exe extension" $ + dropExeExtensionTest ] diff --git a/Makefile b/Makefile index a496156da07..8ed8cbd0779 100644 --- a/Makefile +++ b/Makefile @@ -110,5 +110,41 @@ cabal-install-test: rm -rf .ghc.environment.* cd cabal-testsuite && `cabal-plan list-bin cabal-tests` --with-cabal=`cabal-plan list-bin cabal` --hide-successes -j3 ${TEST} -validate-via-docker: - docker build -t cabal-validate -f validate.dockerfile . +# Docker validation + +# Use this carefully, on big machine you can say +# +# make validate-via-docker-all -j4 -O +# +validate-via-docker-all : validate-via-docker-7.6.3 +validate-via-docker-all : validate-via-docker-7.8.4 +validate-via-docker-all : validate-via-docker-7.10.3 +validate-via-docker-all : validate-via-docker-8.0.2 +validate-via-docker-all : validate-via-docker-8.2.2 +validate-via-docker-all : validate-via-docker-8.4.4 +validate-via-docker-all : validate-via-docker-8.6.5 +validate-via-docker-all : validate-via-docker-8.8.1 + +validate-via-docker-7.6.3: + docker build -t cabal-validate -f .docker/validate-7.6.3.dockerfile . + +validate-via-docker-7.8.4: + docker build -t cabal-validate -f .docker/validate-7.8.4.dockerfile . + +validate-via-docker-7.10.3: + docker build -t cabal-validate -f .docker/validate-7.10.3.dockerfile . + +validate-via-docker-8.0.2: + docker build -t cabal-validate -f .docker/validate-8.0.2.dockerfile . + +validate-via-docker-8.2.2: + docker build -t cabal-validate -f .docker/validate-8.2.2.dockerfile . + +validate-via-docker-8.4.4: + docker build -t cabal-validate -f .docker/validate-8.4.4.dockerfile . + +validate-via-docker-8.6.5: + docker build -t cabal-validate -f .docker/validate-8.6.5.dockerfile . + +validate-via-docker-8.8.1: + docker build -t cabal-validate -f .docker/validate-8.8.1.dockerfile . diff --git a/cabal-testsuite/Test/Cabal/Monad.hs b/cabal-testsuite/Test/Cabal/Monad.hs index cc77a996796..3ad021925e0 100644 --- a/cabal-testsuite/Test/Cabal/Monad.hs +++ b/cabal-testsuite/Test/Cabal/Monad.hs @@ -285,13 +285,24 @@ runTestM mode m = withSystemTempDirectory "cabal-testsuite" $ \tmp_dir -> do -- them up we must configure them program_db <- configureAllKnownPrograms verbosity program_db3 + let ghcAndRunnedGhcAreTheSame :: Bool + ghcAndRunnedGhcAreTheSame = fromMaybe False $ do + ghc_program <- lookupProgram ghcProgram program_db + runner_ghc_program <- lookupProgram ghcProgram (runnerProgramDb senv) + return $ programPath ghc_program == programPath runner_ghc_program + let db_stack = case argGhcPath (testCommonArgs args) of Nothing -> runnerPackageDbStack senv -- NB: canonicalized -- Can't use the build package db stack since they -- are all for the wrong versions! TODO: Make -- this configurable - Just _ -> [GlobalPackageDB] + -- + -- Oleg: if runner ghc and provided ghc are the same, + -- use runnerPackageDbStack. See 'hasCabalForGhc' check. + Just _ + | ghcAndRunnedGhcAreTheSame -> runnerPackageDbStack senv + | otherwise -> [GlobalPackageDB] env = TestEnv { testSourceDir = script_dir, testTmpDir = tmp_dir, diff --git a/cabal-testsuite/Test/Cabal/Prelude.hs b/cabal-testsuite/Test/Cabal/Prelude.hs index e070a52522f..b7a624983f2 100644 --- a/cabal-testsuite/Test/Cabal/Prelude.hs +++ b/cabal-testsuite/Test/Cabal/Prelude.hs @@ -830,9 +830,14 @@ hasCabalForGhc = do (testVerbosity env) ghcProgram (runnerProgramDb (testScriptEnv env)) + -- TODO: I guess, to be more robust what we should check for -- specifically is that the Cabal library we want to use -- will be picked up by the package db stack of ghc-program + + -- liftIO $ putStrLn $ "ghc_program: " ++ show ghc_program + -- liftIO $ putStrLn $ "runner_ghc_program: " ++ show runner_ghc_program + return (programPath ghc_program == programPath runner_ghc_program) -- | If you want to use a Custom setup with new-build, it needs to diff --git a/cabal-testsuite/main/cabal-tests.hs b/cabal-testsuite/main/cabal-tests.hs index 3a779d13530..0ac9e752987 100644 --- a/cabal-testsuite/main/cabal-tests.hs +++ b/cabal-testsuite/main/cabal-tests.hs @@ -186,7 +186,7 @@ main = do = "UNEXPECTED OK" | otherwise = "FAIL" - unless (mainArgHideSuccesses args && status /= "FAIL") $ do + unless (mainArgHideSuccesses args && status == "OK") $ do logMeta $ path ++ replicate (margin - length path) ' ' ++ status ++ if time >= 0.01 diff --git a/validate.sh b/validate.sh index 6550e1ec1af..2c2e3804b11 100755 --- a/validate.sh +++ b/validate.sh @@ -13,6 +13,7 @@ CABALINSTALLTESTS=true CABALSUITETESTS=true CABALONLY=false DEPSONLY=false +DOCTEST=false VERBOSE=false # Help @@ -22,7 +23,7 @@ show_usage() { cat </dev/null; then +echo "$CYAN=== Cabal: doctest ===================================== $(date +%T) === $RESET" + +timed $CABALNEWBUILD Cabal:lib:Cabal --enable-tests --disable-benchmarks --write-ghc-environment-files=always || exit 1 +timed doctest --fast Cabal/Distribution Cabal/Language +timed rm -f .ghc.environment.* + +else + +echo "No doctest command found" + +fi # command -v doctest +fi # DOCTEST + if $CABALTESTS; then echo "$CYAN=== Cabal: test ======================================== $(date +%T) === $RESET"