Skip to content

Commit ee0ce41

Browse files
committed
Extend the .mix path hack to -O0 and -O2
1 parent 54f2185 commit ee0ce41

File tree

2 files changed

+15
-6
lines changed
  • Cabal/src/Distribution/Simple
  • cabal-testsuite/PackageTests/Regression/T5213ExeCoverage

2 files changed

+15
-6
lines changed

Cabal/src/Distribution/Simple/Hpc.hs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,19 @@ mixDir distPref way name = hpcDir distPrefBuild way </> "mix" </> name
7777
-- @./dist-newstyle/build/x86_64-linux/ghc-9.0.1/cabal-gh5213-0.1/t/tests@
7878
-- but the path where library mix files reside has two less components
7979
-- at the end (@t/tests@) and this reduced path needs to be passed to
80-
-- both @hpc@ and @ghc@.
80+
-- both @hpc@ and @ghc@. For non-default optimization levels, the path
81+
-- suffix is one element longer and the extra path element needs
82+
-- to be preserved.
8183
distPrefElements = splitDirectories distPref
82-
distPrefBuild = case drop (length distPrefElements - 2) distPrefElements of
83-
"t" : _ -> joinPath $ take (length distPrefElements - 2) distPrefElements
84+
distPrefBuild = case drop (length distPrefElements - 3) distPrefElements of
85+
["t", _, "noopt"] ->
86+
joinPath $ take (length distPrefElements - 3) distPrefElements
87+
++ ["noopt"]
88+
["t", _, "opt"] ->
89+
joinPath $ take (length distPrefElements - 3) distPrefElements
90+
++ ["opt"]
91+
[_, "t", _] ->
92+
joinPath $ take (length distPrefElements - 2) distPrefElements
8493
_ -> distPref
8594

8695
tixDir :: FilePath -- ^ \"dist/\" prefix

cabal-testsuite/PackageTests/Regression/T5213ExeCoverage/cabal.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Building test suite 'tests' for cabal-gh5213-0.1..
1414
Running 1 test suites...
1515
Test suite tests: RUNNING...
1616
Test suite tests: PASS
17-
Test suite logged to: <ROOT>/cabal.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/cabal-gh5213-0.1/t/tests/test/cabal-gh5213-0.1-tests.log
18-
Test coverage report written to <ROOT>/cabal.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/cabal-gh5213-0.1/t/tests/hpc/vanilla/html/tests/hpc_index.html
17+
Test suite logged to: <ROOT>/cabal.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/cabal-gh5213-0.1/t/tests/noopt/test/cabal-gh5213-0.1-tests.log
18+
Test coverage report written to <ROOT>/cabal.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/cabal-gh5213-0.1/t/tests/noopt/hpc/vanilla/html/tests/hpc_index.html
1919
1 of 1 test suites (1 of 1 test cases) passed.
20-
Package coverage report written to <ROOT>/cabal.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/cabal-gh5213-0.1/t/tests/hpc/vanilla/html/cabal-gh5213-0.1/hpc_index.html
20+
Package coverage report written to <ROOT>/cabal.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/cabal-gh5213-0.1/t/tests/noopt/hpc/vanilla/html/cabal-gh5213-0.1/hpc_index.html

0 commit comments

Comments
 (0)