From 20879a15ae54976cfd452bf41c5371b8fee5522f Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Sat, 24 Jul 2021 13:14:59 +0200 Subject: [PATCH] Hack around wrong .mix directories for tests #5213 --- Cabal/src/Distribution/Simple/Hpc.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Cabal/src/Distribution/Simple/Hpc.hs b/Cabal/src/Distribution/Simple/Hpc.hs index b678772c1e6..ae4fb7c122a 100644 --- a/Cabal/src/Distribution/Simple/Hpc.hs +++ b/Cabal/src/Distribution/Simple/Hpc.hs @@ -68,7 +68,15 @@ mixDir :: FilePath -- ^ \"dist/\" prefix -> Way -> FilePath -- ^ Component name -> FilePath -- ^ Directory containing test suite's .mix files -mixDir distPref way name = hpcDir distPref way "mix" name +mixDir distPref way name = hpcDir distPrefBuild way "mix" name + where + -- This is a hack for HPC over test suites, needed to match the directory + -- where HPC stores .mix files when the main library of the same package + -- is being processed, perhaps in a previous cabal run (#5213). + distPrefElements = splitDirectories distPref + distPrefBuild = case drop (length distPrefElements - 2) distPrefElements of + "t" : _ -> joinPath $ take (length distPrefElements - 2) distPrefElements + _ -> distPref tixDir :: FilePath -- ^ \"dist/\" prefix -> Way