Skip to content

Commit e496b09

Browse files
authored
Rewrite the test suite, AGAIN. (#4095)
See cabal-testsuite/README.md for a detailed description of the new architecture. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
1 parent 2f5c861 commit e496b09

File tree

127 files changed

+2872
-2547
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+2872
-2547
lines changed

Cabal/Distribution/Simple/GHC.hs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ import Distribution.Package
8282
import qualified Distribution.ModuleName as ModuleName
8383
import Distribution.ModuleName (ModuleName)
8484
import Distribution.Simple.Program
85+
import Distribution.Simple.Program.Builtin (runghcProgram)
8586
import qualified Distribution.Simple.Program.HcPkg as HcPkg
8687
import qualified Distribution.Simple.Program.Ar as Ar
8788
import qualified Distribution.Simple.Program.Ld as Ld
@@ -148,9 +149,13 @@ configure verbosity hcPath hcPkgPath conf0 = do
148149
hpcProgram' = hpcProgram {
149150
programFindLocation = guessHpcFromGhcPath ghcProg
150151
}
152+
runghcProgram' = runghcProgram {
153+
programFindLocation = guessRunghcFromGhcPath ghcProg
154+
}
151155
progdb3 = addKnownProgram haddockProgram' $
152156
addKnownProgram hsc2hsProgram' $
153-
addKnownProgram hpcProgram' progdb2
157+
addKnownProgram hpcProgram' $
158+
addKnownProgram runghcProgram' progdb2
154159

155160
languages <- Internal.getLanguages verbosity implInfo ghcProg
156161
extensions0 <- Internal.getExtensions verbosity implInfo ghcProg
@@ -283,6 +288,11 @@ guessHpcFromGhcPath :: ConfiguredProgram
283288
-> IO (Maybe (FilePath, [FilePath]))
284289
guessHpcFromGhcPath = guessToolFromGhcPath hpcProgram
285290

291+
guessRunghcFromGhcPath :: ConfiguredProgram
292+
-> Verbosity -> ProgramSearchPath
293+
-> IO (Maybe (FilePath, [FilePath]))
294+
guessRunghcFromGhcPath = guessToolFromGhcPath runghcProgram
295+
286296

287297
getGhcInfo :: Verbosity -> ConfiguredProgram -> IO [(String, String)]
288298
getGhcInfo verbosity ghcProg = Internal.getGhcInfo verbosity implInfo ghcProg

Cabal/Distribution/Simple/Program/Builtin.hs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module Distribution.Simple.Program.Builtin (
1818
-- * Programs that Cabal knows about
1919
ghcProgram,
2020
ghcPkgProgram,
21+
runghcProgram,
2122
ghcjsProgram,
2223
ghcjsPkgProgram,
2324
lhcProgram,
@@ -70,6 +71,7 @@ builtinPrograms =
7071
[
7172
-- compilers and related progs
7273
ghcProgram
74+
, runghcProgram
7375
, ghcPkgProgram
7476
, ghcjsProgram
7577
, ghcjsPkgProgram
@@ -121,6 +123,15 @@ ghcProgram = (simpleProgram "ghc") {
121123
(programVersion ghcProg)
122124
}
123125

126+
runghcProgram :: Program
127+
runghcProgram = (simpleProgram "runghc") {
128+
programFindVersion = findProgramVersion "--version" $ \str ->
129+
case words str of
130+
-- "runghc 7.10.3"
131+
(_:ver:_) -> ver
132+
_ -> ""
133+
}
134+
124135
ghcPkgProgram :: Program
125136
ghcPkgProgram = (simpleProgram "ghc-pkg") {
126137
programFindVersion = findProgramVersion "--version" $ \str ->

Cabal/misc/gen-extra-source-files.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ main' fp = do
2828
let testModuleFiles = getOtherModulesFiles cabal
2929
let skipPredicates' = skipPredicates ++ map (==) testModuleFiles
3030

31-
-- Read all files git knows about under "tests" and "PackageTests" (cabal-testsuite)
32-
files0 <- lines <$> readProcess "git" ["ls-files", "tests", "PackageTests"] ""
31+
-- Read all files git knows about under "tests"
32+
files0 <- lines <$> readProcess "git" ["ls-files", "tests"] ""
3333

3434
-- Filter
3535
let files1 = filter (\f -> takeExtension f `elem` whitelistedExtensionss ||

appveyor.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,17 @@ build_script:
2121
- Setup test --show-details=streaming --test-option=--hide-successes
2222
- Setup install
2323
- cd ..\cabal-testsuite
24+
- ghc --make -threaded -i Setup.hs -package Cabal-1.25.0.0
2425
- echo "" | ..\cabal install --only-dependencies --enable-tests
25-
- ghc --make -threaded -i -i. Setup.hs -Wall -Werror
2626
- Setup configure --user --ghc-option=-Werror --enable-tests
2727
- Setup build
28-
- Setup test --show-details=streaming --test-option=--hide-successes
28+
# Must install the test suite, so that our GHCi invocation picks it up
29+
- Setup install
30+
# Copy the setup script into the spot cabal-tests expects it
31+
- mkdir dist\setup
32+
- cp Setup.exe dist\setup
33+
- dist\build\cabal-tests\cabal-tests.exe -j3
34+
# - Setup test --show-details=streaming --test-option=--hide-successes
2935
- cd ..\cabal-install
3036
- ghc --make -threaded -i -i. Setup.hs -Wall -Werror
3137
- echo "" | ..\cabal install happy

cabal-install/Distribution/Client/Configure.hs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,10 @@ planLocalPackage :: Verbosity -> Compiler
296296
-> IO (Progress String String SolverInstallPlan)
297297
planLocalPackage verbosity comp platform configFlags configExFlags
298298
installedPkgIndex (SourcePackageDb _ packagePrefs) pkgConfigDb = do
299-
pkg <- readPackageDescription verbosity =<< defaultPackageDesc verbosity
299+
pkg <- readPackageDescription verbosity =<<
300+
case flagToMaybe (configCabalFilePath configFlags) of
301+
Nothing -> defaultPackageDesc verbosity
302+
Just fp -> return fp
300303
solver <- chooseSolver verbosity (fromFlag $ configSolver configExFlags)
301304
(compilerInfo comp)
302305

@@ -387,7 +390,10 @@ configurePackage verbosity platform comp scriptOptions configFlags
387390
where
388391
gpkg = packageDescription spkg
389392
configureFlags = filterConfigureFlags configFlags {
390-
configIPID = toFlag (display ipid),
393+
configIPID = if isJust (flagToMaybe (configIPID configFlags))
394+
-- Make sure cabal configure --ipid works.
395+
then configIPID configFlags
396+
else toFlag (display ipid),
391397
configConfigurationsFlags = flags,
392398
-- We generate the legacy constraints as well as the new style precise
393399
-- deps. In the end only one set gets passed to Setup.hs configure,

cabal-testsuite/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.dist

0 commit comments

Comments
 (0)