Skip to content

Error running test coverage when tests depend on internal lbraries. #4105

@mihaimaruseac

Description

@mihaimaruseac

General summary/comments (optional)

Running stack test --coverage on a project with internal libraries where the test also depends on the internal library fails with Multiple files matching test-0.1.0.0-*.conf found in /tmp/internal-libs/b/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/package.conf.inplace/. Maybe try 'stack clean' on this package?

Steps to reproduce

  1. Starting from this simple example run stack test --coverage.

Expected

The command should succeed and output should be similar to

test-0.1.0.0: configure (lib + internal-lib + test)
Configuring test-0.1.0.0...
test-0.1.0.0: build (lib + internal-lib + test)
Preprocessing library 'sublib' for test-0.1.0.0..
Building library 'sublib' for test-0.1.0.0..
[1 of 1] Compiling B                ( src-sublib/B.hs, .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/sublib/B.o )
Preprocessing library for test-0.1.0.0..
Building library for test-0.1.0.0..
[1 of 1] Compiling Src              ( src/Src.hs, .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/Src.o )
Preprocessing test suite 'test' for test-0.1.0.0..
Building test suite 'test' for test-0.1.0.0..
[1 of 1] Compiling Main             ( exe/Main.hs, .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/test/test-tmp/Main.o )
Linking .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/test/test ...
test-0.1.0.0: copy/register
Installing internal library sublib in /tmp/internal-libs/b/.stack-work/install/x86_64-linux-tinfo6/lts-11.11/8.2.2/lib/x86_64-linux-ghc-8.2.2/test-0.1.0.0-LK8fulHuYNc5gAYF1YHqqE-sublib
Installing library in /tmp/internal-libs/b/.stack-work/install/x86_64-linux-tinfo6/lts-11.11/8.2.2/lib/x86_64-linux-ghc-8.2.2/test-0.1.0.0-4ES9u6pMaO3STaO41lsVi
Registering library 'sublib' for test-0.1.0.0..
Registering library for test-0.1.0.0..
test-0.1.0.0: test (suite: test)
            
Progress 1/2: test-0.1.0.042
42
                          
test-0.1.0.0: Test suite test passed
Generating coverage report for test's test-suite "test"
100% expressions used (2/2)
100% boolean coverage (0/0)
     100% guards (0/0)    
     100% 'if' conditions (0/0)
     100% qualifiers (0/0)
100% alternatives used (0/0)
100% local declarations used (0/0)
100% top-level declarations used (2/2)
The coverage report for test's test-suite "test" is available at /tmp/internal-libs/b/.stack-work/install/x86_64-linux-tinfo6/lts-11.11/8.2.2/hpc/test/test/hpc_index.html
Completed 2 action(s).    
Only one tix file found in /tmp/internal-libs/b/.stack-work/install/x86_64-linux-tinfo6/lts-11.11/8.2.2/hpc/, so not generating a unified coverage report.

An index of the generated HTML coverage reports is available at /tmp/internal-libs/b/.stack-work/install/x86_64-linux-tinfo6/lts-11.11/8.2.2/hpc/index.html

Actual

The command failed with

test-0.1.0.0: configure (lib + test)
Configuring test-0.1.0.0...
test-0.1.0.0: build (lib + test)
Preprocessing library 'sublib' for test-0.1.0.0..
Building library 'sublib' for test-0.1.0.0..
[1 of 1] Compiling B                ( src-sublib/B.hs, .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/sublib/B.o )
Preprocessing library for test-0.1.0.0..
Building library for test-0.1.0.0..
[1 of 1] Compiling Src              ( src/Src.hs, .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/Src.o )
Preprocessing test suite 'test' for test-0.1.0.0..
Building test suite 'test' for test-0.1.0.0..
[1 of 1] Compiling Main             ( exe/Main.hs, .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/test/test-tmp/Main.o )
Linking .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/test/test ...
test-0.1.0.0: copy/register
Installing internal library sublib in /tmp/internal-libs/b/.stack-work/install/x86_64-linux-tinfo6/lts-11.11/8.2.2/lib/x86_64-linux-ghc-8.2.2/test-0.1.0.0-LK8fulHuYNc5gAYF1YHqqE-sublib
Installing library in /tmp/internal-libs/b/.stack-work/install/x86_64-linux-tinfo6/lts-11.11/8.2.2/lib/x86_64-linux-ghc-8.2.2/test-0.1.0.0-4ES9u6pMaO3STaO41lsVi
Registering library 'sublib' for test-0.1.0.0..
Registering library for test-0.1.0.0..
test-0.1.0.0: test (suite: test)
            
Progress 1/2: test-0.1.0.042
42
                          
test-0.1.0.0: Test suite test passed
Multiple files matching test-0.1.0.0-*.conf found in /tmp/internal-libs/b/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/package.conf.inplace/. Maybe try 'stack clean' on this package?
Completed 2 action(s).    
Only one tix file found in /tmp/internal-libs/b/.stack-work/install/x86_64-linux-tinfo6/lts-11.11/8.2.2/hpc/, so not generating a unified coverage report.

An index of the generated HTML coverage reports is available at /tmp/internal-libs/b/.stack-work/install/x86_64-linux-tinfo6/lts-11.11/8.2.2/hpc/index.html

Relevant part of the verbose log

Version 1.7.1, Git revision 681c800873816c022739ca7ed14755e85a579565 (5807 commits) x86_64 hpack-0.28.2
....<snip>....
2018-06-21 06:44:55.365802: [info] test-0.1.0.0: test (suite: test)
@(src/Stack/Build/Execute.hs:873:23)
2018-06-21 06:44:55.365869: [info] 
@(src/Stack/Build/Execute.hs:1701:29)
2018-06-21 06:44:55.366113: [debug] Run process within /tmp/internal-libs/b/: /tmp/internal-libs/b/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/test/test
@(src/Stack/Build/Execute.hs:1711:27)
Progress 1/2: test-0.1.0.042
42
2018-06-21 06:44:55.368007: [debug] Process finished in 2ms: /tmp/internal-libs/b/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/test/test
@(src/Stack/Build/Execute.hs:1711:27)
2018-06-21 06:44:55.368210: [info] 
@(src/Stack/Build/Execute.hs:1724:52)
2018-06-21 06:44:55.369490: [info] test-0.1.0.0: Test suite test passed
@(src/Stack/Build/Execute.hs:873:23)
2018-06-21 06:44:55.369591: [debug] Scanning /tmp/internal-libs/b/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/package.conf.inplace/ for files matching test-0.1.0.0
@(src/Stack/Coverage.hs:449:13)
2018-06-21 06:44:55.369840: [debug] ["/tmp/internal-libs/b/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/package.conf.inplace/package.cache","/tmp/internal-libs/b/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/package.conf.inplace/test-0.1.0.0-4ES9u6pMaO3STaO41lsVi.conf","/tmp/internal-libs/b/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/package.conf.inplace/test-0.1.0.0-LK8fulHuYNc5gAYF1YHqqE-sublib.conf","/tmp/internal-libs/b/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/package.conf.inplace/package.cache.lock"]
@(src/Stack/Coverage.hs:451:13)
2018-06-21 06:44:55.369918: [error] Multiple files matching test-0.1.0.0-*.conf found in /tmp/internal-libs/b/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/package.conf.inplace/. Maybe try 'stack clean' on this package?
@(src/Stack/Coverage.hs:123:21)
2018-06-21 06:44:55.370164: [debug] Encoding /tmp/internal-libs/b/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/stack-test-success
@(src/Stack/Build/Cache.hs:220:7)
2018-06-21 06:44:55.370362: [debug] Finished writing /tmp/internal-libs/b/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/stack-test-success
@(src/Stack/Build/Cache.hs:220:7)
2018-06-21 06:44:55.370424: [info] Completed 2 action(s).
@(src/Stack/Build/Execute.hs:631:27)
2018-06-21 06:44:55.370838: [info] Only one tix file found in /tmp/internal-libs/b/.stack-work/install/x86_64-linux-tinfo6/lts-11.11/8.2.2/hpc/, so not generating a unified coverage report.
@(src/Stack/Coverage.hs:290:14)
2018-06-21 06:44:55.371190: [info] 
An index of the generated HTML coverage reports is available at /tmp/internal-libs/b/.stack-work/install/x86_64-linux-tinfo6/lts-11.11/8.2.2/hpc/index.html
@(src/Stack/Coverage.hs:390:9)

Stack version

[b] λ stack --version
Version 1.7.1, Git revision 681c800873816c022739ca7ed14755e85a579565 (5807 commits) x86_64 hpack-0.28.2

Method of installation

  • Official binary, downloaded from stackage.org or fpcomplete's package repository

I'm currently working on this, discovered it while working on #4071

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions