`detailed-0.9` and `--enable-coverage` fail together
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
#### Description
Writing a `test-suite` with `type: detailed-0.9` and then trying to run it with `cabal v2-build --enable-tests --enable-coverage` always fails with an error about a missing `cabal_macros.h`.
#### To Reproduce
In `test-test.cabal`:
```cabal
cabal-version: 3.6
name: test-test
version: 0.1.0.0
test-suite tests
type: detailed-0.9
test-module: Test
-- type: exitcode-stdio-1.0
-- main-is: Main.hs
build-depends: base, Cabal
hs-source-dirs: test
default-language: Haskell2010
```
In `test/Test.hs`:
```haskell
module Test where
tests :: IO [a]
tests = return []
```
In `test/Main.hs`:
```haskell
module Main where
main :: IO ()
main = return ()
```
Now:
```
$ cabal v2-build --enable-tests --enable-coverage
Resolving dependencies...
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
- test-test-0.1.0.0 (test:tests) (first run)
Configuring test-test-0.1.0.0...
Preprocessing test suite 'tests' for test-test-0.1.0.0..
Building test suite 'tests' for test-test-0.1.0.0..
[1 of 1] Compiling Test ( test/Test.hs, /private/var/folders/kp/9f66jkqn693_s4mw3r89tt680000gn/T/tmp.E4EAtimA/dist-newstyle/build/x86_64-osx/ghc-8.10.7/test-test-0.1.0.0/build/tests/Test.o, /private/var/folders/kp/9f66jkqn693_s4mw3r89tt680000gn/T/tmp.E4EAtimA/dist-newstyle/build/x86_64-osx/ghc-8.10.7/test-test-0.1.0.0/build/tests/Test.dyn_o )
[1 of 1] Compiling Main ( /private/var/folders/kp/9f66jkqn693_s4mw3r89tt680000gn/T/tmp.E4EAtimA/dist-newstyle/build/x86_64-osx/ghc-8.10.7/test-test-0.1.0.0/build/testsStub/testsStub-tmp/testsStub.hs, /private/var/folders/kp/9f66jkqn693_s4mw3r89tt680000gn/T/tmp.E4EAtimA/dist-newstyle/build/x86_64-osx/ghc-8.10.7/test-test-0.1.0.0/build/testsStub/testsStub-tmp/Main.o )
:2:10: error:
fatal error: '/private/var/folders/kp/9f66jkqn693_s4mw3r89tt680000gn/T/tmp.E4EAtimA/dist-newstyle/build/x86_64-osx/ghc-8.10.7/test-test-0.1.0.0/build/testsStub/autogen/cabal_macros.h' file not found
#include "/private/var/folders/kp/9f66jkqn693_s4mw3r89tt680000gn/T/tmp.E4EAtimA/dist-newstyle/build/x86_64-osx/ghc-8.10.7/test-test-0.1.0.0/build/testsStub/autogen/cabal_macros.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
`clang' failed in phase `C Compiler'. (Exit code: 1)
$ # swap the commenting in the cabal file to switch to exitcode-stdio-1.0
$ cabal v2-build --enable-tests --enable-coverage # will be fine
Resolving dependencies...
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
- test-test-0.1.0.0 (test:tests) (configuration changed)
Configuring test-test-0.1.0.0...
Preprocessing test suite 'tests' for test-test-0.1.0.0..
Building test suite 'tests' for test-test-0.1.0.0..
[1 of 1] Compiling Main ( test/Main.hs, /private/var/folders/kp/9f66jkqn693_s4mw3r89tt680000gn/T/tmp.E4EAtimA/dist-newstyle/build/x86_64-osx/ghc-8.10.7/test-test-0.1.0.0/build/tests/tests-tmp/Main.o )
Linking /private/var/folders/kp/9f66jkqn693_s4mw3r89tt680000gn/T/tmp.E4EAtimA/dist-newstyle/build/x86_64-osx/ghc-8.10.7/test-test-0.1.0.0/build/tests/tests ...
```
#### Expected Behavior
Both builds should work. (If you try to run the tests in the `exitcode-stdio` case with `cabal test`, it will fail because there is no `library` stanza, but the build error in the `detailed` case persists if you add a `library`.)
#### System information
* macOS 12.0.1 Monterey x86_64
* GHC 8.10.7
* `cabal-install` 3.6.0.0 built with `Cabal-3.6.1.0`
Contributor guide
Assessment
This issue has not been assessed yet.