diff --git a/cabal-install/tests/IntegrationTests2.hs b/cabal-install/tests/IntegrationTests2.hs index c4341ed72ef..e729b41e9d7 100644 --- a/cabal-install/tests/IntegrationTests2.hs +++ b/cabal-install/tests/IntegrationTests2.hs @@ -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 @@ -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 -> @@ -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 diff --git a/tests/IntegrationTests2/config/cabal.config b/tests/IntegrationTests2/config/cabal.config new file mode 100644 index 00000000000..94a10d9c113 --- /dev/null +++ b/tests/IntegrationTests2/config/cabal.config @@ -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: