Skip to content

Commit

Permalink
fresh config for cabal-install integration tests
Browse files Browse the repository at this point in the history
`validate.sh` locally was being affected by my local cabal config,
leading to test failures (specifically, because I have
`documentation: True` in my config).

Note that this adds a fresh config file to the repo, which will
need to be kept up to date. The alternative is to have it create
one at the start of the tests.
  • Loading branch information
geekosaur committed Jul 16, 2024
1 parent 2fbfd55 commit ea85433
Show file tree
Hide file tree
Showing 2 changed files with 255 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cabal-install/tests/IntegrationTests2.hs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import Control.Concurrent (threadDelay)
import Control.Exception hiding (assert)
import System.FilePath
import System.Directory
import System.Environment (setEnv)
import System.IO (hPutStrLn, stderr)

import Test.Tasty
Expand All @@ -93,7 +94,9 @@ removePathForcibly = removeDirectoryRecursive
#endif

main :: IO ()
main =
main = do
-- this is needed to ensure tests aren't affected by the user's cabal config
setEnv "CABAL_CONFIG" (basedir </> "config" </> "cabal.config")
defaultMainWithIngredients
(defaultIngredients ++ [includingOptions projectConfigOptionDescriptions])
(withProjectConfig $ \config ->
Expand Down Expand Up @@ -1971,8 +1974,8 @@ testNixFlags = do
-- Tests whether config options are commented or not
testConfigOptionComments :: Assertion
testConfigOptionComments = do
_ <- createDefaultConfigFile verbosity [] (basedir </> "config/default-config")
defaultConfigFile <- readFile (basedir </> "config/default-config")
_ <- createDefaultConfigFile verbosity [] (basedir </> "config" </> "default-config")
defaultConfigFile <- readFile (basedir </> "config" </> "default-config")

" url" @=? findLineWith False "url" defaultConfigFile
" -- secure" @=? findLineWith True "secure" defaultConfigFile
Expand Down
249 changes: 249 additions & 0 deletions tests/IntegrationTests2/config/cabal.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
-- This is the configuration file for the 'cabal' command line tool.
--
-- The available configuration options are listed below.
-- Some of them have default values listed.
--
-- Lines (like this one) beginning with '--' are comments.
-- Be careful with spaces and indentation because they are
-- used to indicate layout for nested sections.
--
-- This config file was generated using the following versions
-- of Cabal and cabal-install:
-- Cabal library version: 3.11.0.0
-- cabal-install version: 3.11


repository hackage.haskell.org
url: http://hackage.haskell.org/
-- secure: True
-- root-keys:
-- key-threshold: 3

-- ignore-expiry: False
-- http-transport:
-- nix:
-- store-dir:
-- active-repositories:
-- local-no-index-repo:
remote-repo-cache: /Users/finley/.cabal/packages
-- logs-dir: /Users/finley/.cabal/logs
-- default-user-config:
-- verbose: 1
-- compiler: ghc
-- cabal-file:
-- with-compiler:
-- with-hc-pkg:
-- program-prefix:
-- program-suffix:
-- library-vanilla: True
-- library-profiling:
-- shared:
-- static:
-- executable-dynamic: False
-- executable-static: False
-- profiling:
-- executable-profiling:
-- profiling-detail:
-- library-profiling-detail:
-- optimization: True
-- debug-info: False
-- build-info:
-- library-for-ghci:
-- split-sections: False
-- split-objs: False
-- executable-stripping:
-- library-stripping:
-- configure-option:
-- user-install: True
-- package-db:
-- flags:
-- extra-include-dirs:
-- deterministic:
-- cid:
-- extra-lib-dirs:
-- extra-lib-dirs-static:
-- extra-framework-dirs:
-- extra-prog-path:
-- instantiate-with:
-- tests: False
-- coverage: False
-- library-coverage:
-- exact-configuration: False
-- benchmarks: False
-- relocatable: False
-- response-files:
-- allow-depending-on-private-libs:
-- cabal-lib-version:
-- append:
-- backup:
-- constraint:
-- preference:
-- solver: modular
-- allow-older: False
-- allow-newer: False
-- write-ghc-environment-files:
-- documentation: False
-- doc-index-file: $datadir/doc/$arch-$os-$compiler/index.html
-- only-download: False
-- target-package-db:
-- max-backjumps: 4000
-- reorder-goals: False
-- count-conflicts: True
-- fine-grained-conflicts: True
-- minimize-conflict-set: False
-- independent-goals: False
-- prefer-oldest: False
-- shadow-installed-packages: False
-- strong-flags: False
-- allow-boot-library-installs: False
-- reject-unconstrained-dependencies: none
-- reinstall: False
-- avoid-reinstalls: False
-- force-reinstalls: False
-- upgrade-dependencies: False
-- index-state:
-- root-cmd:
-- symlink-bindir:
build-summary: /Users/finley/.cabal/logs/build.log
-- build-log:
remote-build-reporting: none
-- report-planning-failure: False
-- per-component: True
-- run-tests:
-- semaphore: False
jobs: $ncpus
-- keep-going: False
-- offline: False
-- lib: False
-- package-env:
-- overwrite-policy:
-- install-method:
installdir: /Users/finley/.cabal/bin
-- username:
-- password:
-- password-command:
-- multi-repl:
-- builddir:

haddock
-- keep-temp-files: False
-- hoogle: False
-- html: False
-- html-location:
-- executables: False
-- tests: False
-- benchmarks: False
-- foreign-libraries: False
-- all:
-- internal: False
-- css:
-- hyperlink-source: False
-- quickjump: False
-- hscolour-css:
-- contents-location:
-- index-location:
-- base-url:
-- resources-dir:
-- output-dir:
-- use-unicode: False

init
-- interactive: False
-- quiet: False
-- no-comments: False
-- minimal: False
-- cabal-version: 3.0
-- license:
-- extra-doc-file:
-- tests:
-- test-dir:
-- simple: False
-- language: Haskell2010
-- application-dir: app
-- source-dir: src

install-dirs user
-- prefix: /Users/finley/.cabal
-- bindir: $prefix/bin
-- libdir: $prefix/lib
-- libsubdir: $abi/$libname
-- dynlibdir: $libdir/$abi
-- libexecdir: $prefix/libexec
-- libexecsubdir: $abi/$pkgid
-- datadir: $prefix/share
-- datasubdir: $abi/$pkgid
-- docdir: $datadir/doc/$abi/$pkgid
-- htmldir: $docdir/html
-- haddockdir: $htmldir
-- sysconfdir: $prefix/etc

install-dirs global
-- prefix: /usr/local
-- bindir: $prefix/bin
-- libdir: $prefix/lib
-- libsubdir: $abi/$libname
-- dynlibdir: $libdir/$abi
-- libexecdir: $prefix/libexec
-- libexecsubdir: $abi/$pkgid
-- datadir: $prefix/share
-- datasubdir: $abi/$pkgid
-- docdir: $datadir/doc/$abi/$pkgid
-- htmldir: $docdir/html
-- haddockdir: $htmldir
-- sysconfdir: $prefix/etc

program-locations
-- alex-location:
-- ar-location:
-- c2hs-location:
-- cpphs-location:
-- doctest-location:
-- gcc-location:
-- ghc-location:
-- ghc-pkg-location:
-- ghcjs-location:
-- ghcjs-pkg-location:
-- greencard-location:
-- haddock-location:
-- happy-location:
-- haskell-suite-location:
-- haskell-suite-pkg-location:
-- hmake-location:
-- hpc-location:
-- hsc2hs-location:
-- hscolour-location:
-- jhc-location:
-- ld-location:
-- pkg-config-location:
-- runghc-location:
-- strip-location:
-- tar-location:
-- uhc-location:

program-default-options
-- alex-options:
-- ar-options:
-- c2hs-options:
-- cpphs-options:
-- doctest-options:
-- gcc-options:
-- ghc-options:
-- ghc-pkg-options:
-- ghcjs-options:
-- ghcjs-pkg-options:
-- greencard-options:
-- haddock-options:
-- happy-options:
-- haskell-suite-options:
-- haskell-suite-pkg-options:
-- hmake-options:
-- hpc-options:
-- hsc2hs-options:
-- hscolour-options:
-- jhc-options:
-- ld-options:
-- pkg-config-options:
-- runghc-options:
-- strip-options:
-- tar-options:
-- uhc-options:

0 comments on commit ea85433

Please sign in to comment.