Skip to content

cabal-install integration-tests replacement omnibus patch #4124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 56 commits into from
Nov 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
3b8589f
Remove redundant import.
ezyang Nov 19, 2016
4c7f935
Make --builddir/--distdir/etc affect dist-newstyle.
ezyang Nov 25, 2016
b74c03f
Add --project-file global flag, for the name of cabal.project files.
ezyang Nov 25, 2016
847d3f5
Documentation for --builddir and --project-file flags.
ezyang Nov 25, 2016
fa3746a
Use --project-file and --builddir in cabal new-build tests.
ezyang Nov 21, 2016
ef432a4
Add default-language pragmas to cabal-testsuite.cabal
ezyang Nov 21, 2016
7e7b4e9
Switch cabal-tests to executable so it is always configured.
ezyang Nov 21, 2016
65f8eec
Add support for reading plan.json from new-build in test suite.
ezyang Nov 26, 2016
dd7fa17
Enable cabal-install tests with cabal-testsuite in CI.
ezyang Nov 26, 2016
e309598
Port backpack/includes2 to new test suite.
ezyang Nov 25, 2016
7b90a21
Port backpack/includes3 to new test suite.
ezyang Nov 25, 2016
c20c114
Add accidentally dropped ConfigureComponent/SubLib test
ezyang Nov 25, 2016
20c0c2d
Ignore Setup executables.
ezyang Nov 25, 2016
40b2799
Update gitignore on Configure test.
ezyang Nov 25, 2016
c855e3a
gitignore on ForeignLibs test
ezyang Nov 25, 2016
30ae89c
Export Control.Monad from Test.Cabal.Prelude.
ezyang Nov 26, 2016
4985a2b
Add isOSX test to Test.Cabal.Prelude.
ezyang Nov 26, 2016
9935f16
Port custom/plain to new testsuite
ezyang Nov 26, 2016
276fec3
Add isLinux test to Test.Cabal.Prelude.
ezyang Nov 26, 2016
ca95eb8
Port custom/segfault to new test suite
ezyang Nov 26, 2016
282d737
Port custom-setup/custom_setup_without_Cabal_doesnt_allow_Cabal_impor…
ezyang Nov 26, 2016
9466758
Port custom-setup/custom_setup_without_Cabal_doesnt_require_Cabal to …
ezyang Nov 26, 2016
accb42f
When running cabalTest, interpret setup as cabal.
ezyang Nov 26, 2016
4a0c940
Make testPrefixDir non-IO.
ezyang Nov 26, 2016
aa0d840
Disable cabal-install test in ConfiguredComponent/Sublib/setup.test.hs
ezyang Nov 26, 2016
0ec2495
Set HOME directory on tests to be more hermetic.
ezyang Nov 26, 2016
63252fb
Sandbox support in the test suite.
ezyang Nov 26, 2016
c4b22e9
Port custom/custom_dep to new test suite.
ezyang Nov 26, 2016
ffec942
Port custom-setup/installs_Cabal_as_setup_dep to new test suite
ezyang Nov 26, 2016
a1a015c
Make assertOutputContains less chatty.
ezyang Nov 26, 2016
dadb89d
Port exec/adds_sandbox_bin_directory_to_path to new test suite
ezyang Nov 26, 2016
f6303e7
Remove some obsolete test gitignore entries.
ezyang Nov 26, 2016
c2008fd
Port exec/auto_configures_on_exec to new test suite
ezyang Nov 26, 2016
2ae93d3
Tweaks for when to pass --builddir to cabal executable.
ezyang Nov 26, 2016
322214c
Teach cabal exec the --builddir option.
ezyang Nov 26, 2016
6d3a00a
Port exec/can_run_executables_installed_in_sandbox to new test suite
ezyang Nov 26, 2016
158cc06
Port exec/configures_cabal_to_use_sandbox to use new test suite
ezyang Nov 26, 2016
e8ce472
Port exec/configures_ghc_to_use_sandbox to new test suite.
ezyang Nov 26, 2016
ea0c388
Port exec/exit_with_failure_without_args to new test suite.
ezyang Nov 26, 2016
768da11
Port exec/runs_given_command to new test suite.
ezyang Nov 26, 2016
af26fb6
Add new-build variant of CustomDep test.
ezyang Nov 26, 2016
749fd0c
Remove unneeded files from extra-source-files (TODO: break this commi…
ezyang Nov 26, 2016
9c41ff0
Add support for known broken tests.
ezyang Nov 26, 2016
b5ee225
Add expectBrokenIf and expectBrokenUnless variants.
ezyang Nov 26, 2016
42e9018
Prefix testDistDir with work to disambiguate.
ezyang Nov 26, 2016
59f7943
Swap from testWorkDir to testDistDir for cabal builddir.
ezyang Nov 26, 2016
09fc2a7
Support for configuring repositories in tests.
ezyang Nov 27, 2016
ae03fd0
Enable hackage-repo-tool in CI
ezyang Nov 27, 2016
c1caede
Port custom-setup/new_build_requires_Cabal_1_20 to new test suite.
ezyang Nov 26, 2016
f8ba858
Program-ify everything in test suite.
ezyang Nov 27, 2016
326da71
Centralize use of record/require.
ezyang Nov 27, 2016
9a3cd91
Cleanup between setup and cabal tests
ezyang Nov 27, 2016
99d0bdf
Reuse packagedb in InternalLibraries/Executable/setup-static.test.hs
ezyang Nov 27, 2016
b431765
Try harder not to runTestM twice when it can be avoided.
ezyang Nov 27, 2016
ca6f056
Split up OS X tests to get them under the time.
ezyang Nov 27, 2016
b1a5ae8
8.0.1 builds are bumping limit, so move TEST_OTHER_VERSIONS to 7.4.2
ezyang Nov 27, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ tags
progress.txt

# test files
dist-test
register.sh
/Cabal/tests/PackageTests/Configure/include/HsZlibConfig.h
/Cabal/tests/PackageTests/Configure/zlib.buildinfo

# python artifacts from documentation builds
*.pyc
19 changes: 13 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ matrix:
sudo: required
# These don't have -dyn/-prof whitelisted yet, so we have to
# do the old-style installation
- env: GHCVER=7.4.2 SCRIPT=script CABAL_LIB_ONLY=YES
- env: GHCVER=7.4.2 SCRIPT=script CABAL_LIB_ONLY=YES TEST_OTHER_VERSIONS=YES
os: linux
sudo: required
- env: GHCVER=7.6.3 SCRIPT=script
Expand All @@ -40,13 +40,13 @@ matrix:
- env: GHCVER=7.10.3 SCRIPT=script
os: linux
sudo: required
- env: GHCVER=8.0.1 SCRIPT=script DEPLOY_DOCS=YES TEST_OTHER_VERSIONS=YES
- env: GHCVER=8.0.1 SCRIPT=script DEPLOY_DOCS=YES
sudo: required
os: linux
- env: GHCVER=8.0.1 SCRIPT=solver-debug-flags
sudo: required
os: linux
- env: GHCVER=8.0.1 SCRIPT=script PARSEC=YES TEST_OTHER_VERSIONS=YES
- env: GHCVER=8.0.1 SCRIPT=script PARSEC=YES
os: linux
sudo: required
- env: GHCVER=8.0.1 SCRIPT=bootstrap
Expand All @@ -56,15 +56,22 @@ matrix:
# We axed GHC 7.6 and earlier because it's not worth the trouble to
# make older GHC work with clang's cpp. See
# https://ghc.haskell.org/trac/ghc/ticket/8493
- env: GHCVER=7.8.4 SCRIPT=script
- env: GHCVER=7.8.4 SCRIPT=script CABAL_LIB_ONLY=YES
os: osx
osx_image: xcode6.4 # We need 10.10
- env: GHCVER=7.8.4 SCRIPT=script CABAL_INSTALL_ONLY=YES
os: osx
osx_image: xcode6.4

# TODO: We might want to specify OSX version
# https://docs.travis-ci.com/user/osx-ci-environment/#OS-X-Version
- env: GHCVER=7.10.3 SCRIPT=script
- env: GHCVER=7.10.3 SCRIPT=script CABAL_LIB_ONLY=YES
os: osx
- env: GHCVER=7.10.3 SCRIPT=script CABAL_INSTALL_ONLY=YES
os: osx
- env: GHCVER=8.0.1 SCRIPT=script CABAL_LIB_ONLY=YES
os: osx
- env: GHCVER=8.0.1 SCRIPT=script
- env: GHCVER=8.0.1 SCRIPT=script CABAL_INSTALL_ONLY=YES
os: osx
- env: GHCVER=8.0.1 SCRIPT=bootstrap
os: osx
Expand Down
8 changes: 8 additions & 0 deletions Cabal/Distribution/Simple/Program/Db.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ module Distribution.Simple.Program.Db (
-- ** Query and manipulate the program db
configureProgram,
configureAllKnownPrograms,
unconfigureProgram,
lookupProgramVersion,
reconfigurePrograms,
requireProgram,
Expand Down Expand Up @@ -365,6 +366,13 @@ configurePrograms verbosity progs progdb =
foldM (flip (configureProgram verbosity)) progdb progs


-- | Unconfigure a program. This is basically a hack and you shouldn't
-- use it, but it can be handy for making sure a 'requireProgram'
-- actually reconfigures.
unconfigureProgram :: String -> ProgramDb -> ProgramDb
unconfigureProgram progname =
updateConfiguredProgs $ Map.delete progname

-- | Try to configure all the known programs that have not yet been configured.
--
configureAllKnownPrograms :: Verbosity
Expand Down
27 changes: 26 additions & 1 deletion Cabal/doc/nix-local-build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,32 @@ package, and thus apply globally:

The command line variant of this field is ``--keep-going``.

.. option:: --builddir=DIR

Specifies the name of the directory where build products for
build will be stored; defaults to ``dist-newstyle``. If a
relative name is specified, this directory is resolved relative
to the root of the project (i.e., where the ``cabal.project``
file lives.)

This option cannot be specified via a ``cabal.project`` file.

.. option:: --project-file=FILE

Specifies the name of the project file used to specify the
rest of the top-level configuration; defaults to ``cabal.project``.
This name not only specifies the name of the main project file,
but also the auxiliary project files ``cabal.project.freeze``
and ``cabal.project.local``; for example, if you specify
``--project-file=my.project``, then the other files that will
be probed are ``my.project.freeze`` and ``my.project.local``.

If the specified project file is a relative path, we will
look for the file relative to the current working directory,
and then for the parent directory, until the project file is
found or we have hit the top of the user's home directory.

This option cannot be specified via a ``cabal.project`` file.

Solver configuration options
----------------------------
Expand Down Expand Up @@ -1697,5 +1723,4 @@ Most users generally won't need these.
The command line variant of this field is
``--cabal-lib-version=1.24.0.1``.


.. include:: references.inc
5 changes: 5 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ build_script:
- Setup build
- Setup test --show-details=streaming --test-option=--hide-successes
- Setup install
# hackage-repo-tool doesn't build on Windows:
# https://github.com/well-typed/hackage-security/issues/175
# - echo "" | ..\cabal install hackage-repo-tool --allow-newer=Cabal,time --constraint="Cabal == 1.25.0.0"
- cd ..\cabal-testsuite
- ghc --make -threaded -i Setup.hs -package Cabal-1.25.0.0
- echo "" | ..\cabal install --only-dependencies --enable-tests
Expand All @@ -45,3 +48,5 @@ build_script:
- ..\cabal test integration-tests2 --show-details=streaming --test-option=--hide-successes
- ..\cabal test solver-quickcheck --show-details=streaming --test-option=--hide-successes --test-option=--quickcheck-tests=1000
- ..\cabal test memory-usage-tests --show-details=streaming
- cd ..\cabal-testsuite
- dist\build\cabal-tests\cabal-tests.exe -j3 --skip-setup-tests --with-cabal=..\cabal-install\dist\build\cabal\cabal.exe
9 changes: 5 additions & 4 deletions cabal-install/Distribution/Client/CmdConfigure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ configureCommand = Client.installCommand {
commandUsage = usageAlternatives "new-configure" [ "[FLAGS]" ],
commandDescription = Just $ \_ -> wrapText $
"Configures a Nix-local build project, downloading source from"
++ " the network and writing out a cabal.project.local file which"
++ " saves any FLAGS, to be reapplied on subsequent invocations to "
++ "new-build.",
++ " the network and writing out a cabal.project.local file"
++ " (or $project_file.local, if --project-file is specified)"
++ " which saves any FLAGS, to be reapplied on subsequent invocations to"
++ " new-build.",
commandNotes = Just $ \pname ->
"Examples:\n"
++ " " ++ pname ++ " new-configure "
Expand Down Expand Up @@ -65,7 +66,7 @@ configureAction (configFlags, configExFlags, installFlags, haddockFlags)
hookPrePlanning = \rootDir _ cliConfig ->
-- Write out the @cabal.project.local@ so it gets picked up by the
-- planning phase.
writeProjectLocalExtraConfig rootDir cliConfig,
writeProjectLocalExtraConfig installFlags rootDir cliConfig,

hookSelectPlanSubset = \buildSettings' elaboratedPlan -> do
-- Select the same subset of targets as 'CmdBuild' would
Expand Down
13 changes: 7 additions & 6 deletions cabal-install/Distribution/Client/CmdFreeze.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Distribution.Client.ProjectPlanning
import Distribution.Client.ProjectConfig
( ProjectConfig(..), ProjectConfigShared(..)
, commandLineFlagsToProjectConfig, writeProjectLocalFreezeConfig
, findProjectRoot )
, findProjectRoot, getProjectFileName )
import Distribution.Client.Targets
( UserConstraint(..) )
import Distribution.Solver.Types.ConstraintSource
Expand Down Expand Up @@ -60,6 +60,7 @@ freezeCommand = Client.installCommand {
commandDescription = Just $ \_ -> wrapText $
"Performs dependency solving on a Nix-local build project, and"
++ " then writes out the precise dependency configuration to cabal.project.freeze"
++ " (or $project_file.freeze if --project-file is specified)"
++ " so that the plan is always used in subsequent builds.",
commandNotes = Just $ \pname ->
"Examples:\n"
Expand All @@ -86,23 +87,23 @@ freezeAction (configFlags, configExFlags, installFlags, haddockFlags)
cabalDir <- defaultCabalDir
let cabalDirLayout = defaultCabalDirLayout cabalDir

projectRootDir <- findProjectRoot
let distDirLayout = defaultDistDirLayout projectRootDir
projectRootDir <- findProjectRoot installFlags
let distDirLayout = defaultDistDirLayout configFlags projectRootDir

let cliConfig = commandLineFlagsToProjectConfig
globalFlags configFlags configExFlags
installFlags haddockFlags


(_, elaboratedPlan, _, _) <-
rebuildInstallPlan verbosity
rebuildInstallPlan verbosity installFlags
projectRootDir distDirLayout cabalDirLayout
cliConfig

let freezeConfig = projectFreezeConfig elaboratedPlan
writeProjectLocalFreezeConfig projectRootDir freezeConfig
writeProjectLocalFreezeConfig installFlags projectRootDir freezeConfig
notice verbosity $
"Wrote freeze file: " ++ projectRootDir </> "cabal.project.freeze"
"Wrote freeze file: " ++ projectRootDir </> getProjectFileName installFlags <.> "freeze"

where
verbosity = fromFlagOrDefault normal (configVerbosity configFlags)
Expand Down
3 changes: 2 additions & 1 deletion cabal-install/Distribution/Client/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ instance Semigroup SavedConfig where
installNumJobs = combine installNumJobs,
installKeepGoing = combine installKeepGoing,
installRunTests = combine installRunTests,
installOfflineMode = combine installOfflineMode
installOfflineMode = combine installOfflineMode,
installProjectFileName = combine installProjectFileName
}
where
combine = combine' savedInstallFlags
Expand Down
11 changes: 7 additions & 4 deletions cabal-install/Distribution/Client/DistDirLayout.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module Distribution.Client.DistDirLayout (
) where

import System.FilePath
import Distribution.Simple.Setup (fromFlagOrDefault, ConfigFlags, configDistPref)
import Distribution.Package
( PackageId, ComponentId, UnitId )
import Distribution.Compiler
Expand Down Expand Up @@ -106,12 +107,14 @@ data CabalDirLayout = CabalDirLayout {
cabalWorldFile :: FilePath
}


defaultDistDirLayout :: FilePath -> DistDirLayout
defaultDistDirLayout projectRootDirectory =
-- | Given the path to the root directory, create the 'DistDirLayout'
-- associated with it. Respects @--builddir@ setting.
defaultDistDirLayout :: ConfigFlags -> FilePath -> DistDirLayout
defaultDistDirLayout configFlags projectRootDirectory =
DistDirLayout {..}
where
distDirectory = projectRootDirectory </> "dist-newstyle"
distDirName = fromFlagOrDefault "dist-newstyle" (configDistPref configFlags)
distDirectory = projectRootDirectory </> distDirName
--TODO: switch to just dist at some point, or some other new name

distBuildRootDirectory = distDirectory </> "build"
Expand Down
Loading