diff --git a/Trace/Hpc/Mix.hs b/Trace/Hpc/Mix.hs index 4a7fc7428b8d3902fa0065c910776314317e25f0..f4025d943499ea94bd40cafa65eb9cde45437419 100644 --- a/Trace/Hpc/Mix.hs +++ b/Trace/Hpc/Mix.hs @@ -49,7 +49,7 @@ data Mix = Mix Hash -- hash of mix entry + timestamp Int -- tab stop value. [MixEntry] -- entries - deriving (Show,Read) + deriving (Show,Read,Eq) type MixEntry = (HpcPos, BoxLabel) @@ -104,9 +104,13 @@ readMix dirNames mod' = do | dirName <- dirNames ] case catMaybes res of - [r] -> return r - xs@(_:_) -> error $ "found " ++ show(length xs) ++ " instances of " ++ modName ++ " in " ++ show dirNames - _ -> error $ "can not find " ++ modName ++ " in " ++ show dirNames + xs@(x:_:_) | any (/= x) (tail xs) -> + -- Only complain if multiple *different* `Mix` files with the + -- same name are found (#9619). + error $ "found " ++ show(length xs) ++ " different instances of " + ++ modName ++ " in " ++ show dirNames + (x:_) -> return x + _ -> error $ "can not find " ++ modName ++ " in " ++ show dirNames mixName :: FilePath -> String -> String mixName dirName name = dirName </> name <.> "mix" diff --git a/tests/simple/tixs/.hpc.copy/Main.mix b/tests/simple/tixs/.hpc.copy/Main.mix new file mode 100644 index 0000000000000000000000000000000000000000..75ce018698bb30fc45c8100dc6aaf43e1a283354 --- /dev/null +++ b/tests/simple/tixs/.hpc.copy/Main.mix @@ -0,0 +1 @@ +Mix "hpc001.hs" 2012-01-29 18:01:54 UTC 2454134535 8 [(1:21-1:27,ExpBox False),(1:29-1:35,ExpBox False),(1:14-1:36,ExpBox False),(1:8-1:36,ExpBox False),(1:1-1:36,TopLevelBox ["main"])] \ No newline at end of file diff --git a/tests/simple/tixs/test.T b/tests/simple/tixs/test.T index 48ca67f60a3d889cfb419e7edabbe69f55a1abbd..8e98d0e8faad5a5d8e5407cecfa01c5146303134 100644 --- a/tests/simple/tixs/test.T +++ b/tests/simple/tixs/test.T @@ -67,3 +67,7 @@ test('hpc_hand_overlay', "{hpc} report total3.tix"]) test('hpc_bad_001', exit_code(1), run_command, ["{hpc} bad arguments"]) + +test('T9619', ignore_output, run_command, + # Having the same mix file in two different hpcdirs should work. + ["{hpc} report hpc_sample.tix --hpcdir=.hpc --hpcdir=.hpc.copy"])