diff --git a/cabal-testsuite/src/Test/Cabal/Monad.hs b/cabal-testsuite/src/Test/Cabal/Monad.hs index 3dd1c747d3248536de16417943c2c62a0b8f81ff..04eb659696ccb06d3844eb644be1010da3b7d378 100644 --- a/cabal-testsuite/src/Test/Cabal/Monad.hs +++ b/cabal-testsuite/src/Test/Cabal/Monad.hs @@ -556,13 +556,25 @@ mkNormalizerEnv = do return NormalizerEnv { normalizerRoot - = addTrailingPathSeparator (testSourceDir env), + = (if buildOS == Windows + then joinDrive "\\" . dropDrive + else id) + $ addTrailingPathSeparator (testSourceDir env), normalizerTmpDir - = addTrailingPathSeparator (testTmpDir env), + = (if buildOS == Windows + then joinDrive "\\" . dropDrive + else id) + $ addTrailingPathSeparator (testTmpDir env), normalizerCanonicalTmpDir - = addTrailingPathSeparator canonicalizedTestTmpDir, + = (if buildOS == Windows + then joinDrive "\\" . dropDrive + else id) + $ addTrailingPathSeparator canonicalizedTestTmpDir, normalizerGblTmpDir - = addTrailingPathSeparator tmpDir, + = (if buildOS == Windows + then joinDrive "\\" . dropDrive + else id) + $ addTrailingPathSeparator tmpDir, normalizerGhcVersion = compilerVersion (testCompiler env), normalizerGhcPath diff --git a/cabal-testsuite/src/Test/Cabal/OutputNormalizer.hs b/cabal-testsuite/src/Test/Cabal/OutputNormalizer.hs index 42daa7088853ad78d1b3c76f8e8fbc2c58336c62..3f4dcf5bc5a77da01f9460699dbdffe1230755fe 100644 --- a/cabal-testsuite/src/Test/Cabal/OutputNormalizer.hs +++ b/cabal-testsuite/src/Test/Cabal/OutputNormalizer.hs @@ -19,26 +19,34 @@ import qualified Data.Foldable as F normalizeOutput :: NormalizerEnv -> String -> String normalizeOutput nenv = - -- Munge away .exe suffix on filenames (Windows) - resub "([A-Za-z0-9.-]+)\\.exe" "\\1" -- Normalize backslashes to forward slashes to normalize -- file paths - . map (\c -> if c == '\\' then '/' else c) + map (\c -> if c == '\\' then '/' else c) -- Install path frequently has architecture specific elements, so -- nub it out . resub "Installing (.+) in .+" "Installing \\1 in <PATH>" -- Things that look like libraries . resub "libHS[A-Za-z0-9.-]+\\.(so|dll|a|dynlib)" "<LIBRARY>" -- look for PackageHash directories + . (if buildOS == Windows + then resub "\\\\(([A-Za-z0-9_]+)(-[A-Za-z0-9\\._]+)*)-[0-9a-f]{4,64}\\\\" + "\\\\<PACKAGE>-<HASH>\\\\" + else id) . resub "/(([A-Za-z0-9_]+)(-[A-Za-z0-9\\._]+)*)-[0-9a-f]{4,64}/" "/<PACKAGE>-<HASH>/" -- This is dumb but I don't feel like pulling in another dep for -- string search-replace. Make sure we do this before backslash -- normalization! . resub (posixRegexEscape (normalizerGblTmpDir nenv) ++ "[a-z0-9\\.-]+") "<GBLTMPDIR>" + -- Munge away .exe suffix on filenames (Windows) + . (if buildOS == Windows then resub "([A-Za-z0-9.-]+)\\.exe" "\\1" else id) + -- tmp/src-[0-9]+ is tmp\src-[0-9]+ in Windows + . (if buildOS == Windows then resub (posixRegexEscape "tmp\\src-" ++ "[0-9]+") "<TMPDIR>" else id) . resub (posixRegexEscape "tmp/src-" ++ "[0-9]+") "<TMPDIR>" . resub (posixRegexEscape (normalizerTmpDir nenv) ++ sameDir) "<ROOT>/" . resub (posixRegexEscape (normalizerCanonicalTmpDir nenv) ++ sameDir) "<ROOT>/" + -- Munge away C: prefix on filenames (Windows). We convert C:\\ to \\. + . (if buildOS == Windows then resub "([A-Z]):\\\\" "\\\\" else id) . appEndo (F.fold (map (Endo . packageIdRegex) (normalizerKnownPackages nenv))) -- Look for 0.1/installed-0d6uzW7Ubh1Fb4TB5oeQ3G -- These installed packages will vary depending on GHC version @@ -46,6 +54,10 @@ normalizeOutput nenv = . resub "[0-9]+(\\.[0-9]+)*/installed-[A-Za-z0-9.+]+" "<VERSION>/installed-<HASH>" -- incoming directories in the store + . (if buildOS == Windows then resub "\\\\incoming\\\\new-[0-9]+" + "\\\\incoming\\\\new-<RAND>" + else id) + -- incoming directories in the store . resub "/incoming/new-[0-9]+" "/incoming/new-<RAND>" -- Normalize architecture