haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.6k stars 689 forks source link

`cabal-install/tests/IntegrationTests2.hs` is sensitive to local configuration #10187

Closed geekosaur closed 1 month ago

geekosaur commented 1 month ago

Describe the bug If my local cabal configuration contains documentation: True, running validate.sh locally fails with

Integration tests (internal)
  Regression tests
    program options scope all:                 FAIL (1.36s)
      tests/IntegrationTests2.hs:1560:
      q
      expected: Just ["-fno-full-laziness"]
       but got: Just ["-haddock"]
      Use -p '/program options scope all/' to rerun this test only.
    program options scope local:               FAIL (1.26s)
      tests/IntegrationTests2.hs:1585:
      q
      expected: Just ["-fno-full-laziness"]
       but got: Just ["-haddock"]
      Use -p '/program options scope local/' to rerun this test only.
    program options scope specific:            FAIL (1.33s)
      tests/IntegrationTests2.hs:1610:
      q
      expected: Nothing
       but got: Just ["-haddock"]
      Use -p '/program options scope specific/' to rerun this test only.

Validation succeeds if I comment out the documentation directive in my local config.

To Reproduce Steps to reproduce the behavior:

$ vi ~/.config/cabal/config # and set "documentation: True"
$ git clone https://github.com/haskell/cabal
$ cd cabal
$ cabal build all
$ ./validate.sh --with-cabal=$(cabal list-bin cabal)

Expected behavior Validation should succeed regardless of the local setting of documentation.

System information

geekosaur commented 1 month ago

Should validate.sh point to a default config file via CABAL_CONFIG, or does it need to use some other mechanism to avoid overriding test-specific config files?

ulysses4ever commented 1 month ago

dunno but perhaps if you do something wrong and override the test-specific configs it will fail horribly?..

geekosaur commented 1 month ago

It looks like IntegrationTests2 already has a default cabal config; it's just not using it, as far as I can tell, or at least isn't using it everywhere it needs to be used. I'm thinking that needs to be moved into validate.sh.