From e54d47753228fc4cc9eafd92fa2b63a9563b68db Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Tue, 9 Jul 2024 00:57:48 +0200 Subject: [PATCH 1/8] Clarify why we can't run .bat files --- Cabal/src/Distribution/Simple/Utils.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Cabal/src/Distribution/Simple/Utils.hs b/Cabal/src/Distribution/Simple/Utils.hs index 47caab077af..3688f602759 100644 --- a/Cabal/src/Distribution/Simple/Utils.hs +++ b/Cabal/src/Distribution/Simple/Utils.hs @@ -1950,6 +1950,13 @@ exeExtensions = case (buildArch, buildOS) of -- Possible improvement: on Windows, read the list of extensions from the -- PATHEXT environment variable. By default PATHEXT is ".com; .exe; .bat; -- .cmd". + -- + -- See also #10179. + -- + -- Also we cannot actually run @.bat@ files as we do now, because of + -- https://github.com/haskell/process/issues/140. If we detect one of those, + -- we should record that the program is a script and run a @Process.shell@ instead + -- of a @Process.proc@. (_, Windows) -> ["", "exe"] (_, Ghcjs) -> ["", "exe"] (Wasm32, _) -> ["", "wasm"] From f8ab58caaa589f08b1ab8ede3a302b97c12d3a7a Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Tue, 9 Jul 2024 00:59:27 +0200 Subject: [PATCH 2/8] Fix local+noindex repos on Windows --- .../src/Distribution/Client/IndexUtils.hs | 4 ++-- cabal-testsuite/src/Test/Cabal/Prelude.hs | 14 +++++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/cabal-install/src/Distribution/Client/IndexUtils.hs b/cabal-install/src/Distribution/Client/IndexUtils.hs index 5958deca553..23a7754a065 100644 --- a/cabal-install/src/Distribution/Client/IndexUtils.hs +++ b/cabal-install/src/Distribution/Client/IndexUtils.hs @@ -149,7 +149,7 @@ import System.FilePath , (<.>) , () ) -import qualified System.FilePath.Posix as FilePath.Posix +import qualified System.FilePath as FilePath import System.IO import System.IO.Error (isDoesNotExistError) import System.IO.Unsafe (unsafeInterleaveIO) @@ -928,7 +928,7 @@ withIndexEntries verbosity (RepoIndex _repoCtxt (RepoLocalNoIndex (LocalRepo nam let bs = BS.toStrict contents in ((`CacheGPD` bs) <$> parseGenericPackageDescriptionMaybe bs) where - filename = prettyShow pkgId FilePath.Posix. prettyShow (packageName pkgId) ++ ".cabal" + filename = prettyShow pkgId FilePath. prettyShow (packageName pkgId) ++ ".cabal" readCabalEntry _ _ x = x withIndexEntries verbosity index callback _ = do -- non-secure repositories diff --git a/cabal-testsuite/src/Test/Cabal/Prelude.hs b/cabal-testsuite/src/Test/Cabal/Prelude.hs index d110bd9f433..176b3d994aa 100644 --- a/cabal-testsuite/src/Test/Cabal/Prelude.hs +++ b/cabal-testsuite/src/Test/Cabal/Prelude.hs @@ -544,7 +544,6 @@ src `archiveTo` dst = do -- TODO: --format ustar, like createArchive? -- --force-local is necessary for handling colons in Windows paths. tar $ ["-czf", dst] - ++ ["--force-local" | buildOS == Windows] ++ ["-C", src_parent, src_dir] infixr 4 `archiveTo` @@ -554,10 +553,6 @@ infixr 4 `archiveTo` -- external repository corresponding to all of these packages withRepo :: FilePath -> TestM a -> TestM a withRepo repo_dir m = do - -- https://github.com/haskell/cabal/issues/7065 - -- you don't simply put a windows path into URL... - skipIfWindows - env <- getTestEnv -- 1. Initialize repo directory @@ -603,16 +598,17 @@ withRepo repo_dir m = do withReaderT (\env' -> env' { testHaveRepo = True }) m -- TODO: Arguably should undo everything when we're done... where - repoUri env ="file+noindex://" ++ testRepoDir env + repoUri env ="file+noindex://" ++ (if isWindows + then map (\x -> case x of + '\\' -> '/' + _ -> x) + else id) (testRepoDir env) -- | Given a directory (relative to the 'testCurrentDir') containing -- a series of directories representing packages, generate an -- remote repository corresponding to all of these packages withRemoteRepo :: FilePath -> TestM a -> TestM a withRemoteRepo repoDir m = do - -- https://github.com/haskell/cabal/issues/7065 - -- you don't simply put a windows path into URL... - skipIfWindows -- we rely on the presence of python3 for a simple http server skipUnless "no python3" =<< isAvailableProgram python3Program From d73af0dddc6a4fe16cb70507fa252c916fc7c56a Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Tue, 9 Jul 2024 01:00:36 +0200 Subject: [PATCH 3/8] Provide `skip*IO` functions and report issue in known failures --- cabal-testsuite/src/Test/Cabal/Monad.hs | 25 ++++++++++++++++------ cabal-testsuite/src/Test/Cabal/TestCode.hs | 12 +++++------ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/cabal-testsuite/src/Test/Cabal/Monad.hs b/cabal-testsuite/src/Test/Cabal/Monad.hs index 861538692aa..3dd1c747d32 100644 --- a/cabal-testsuite/src/Test/Cabal/Monad.hs +++ b/cabal-testsuite/src/Test/Cabal/Monad.hs @@ -45,12 +45,14 @@ module Test.Cabal.Monad ( testActualFile, -- * Skipping tests skip, + skipIO, skipIf, + skipIfIO, skipUnless, + skipUnlessIO, -- * Known broken tests expectedBroken, unexpectedSuccess, - -- whenHasSharedLibraries, -- * Arguments (TODO: move me) CommonArgs(..), renderCommonArgs, @@ -176,23 +178,32 @@ testArgParser = TestArgs <*> argument str ( metavar "FILE") <*> commonArgParser -skip :: String -> TestM () -skip reason = liftIO $ do +skipIO :: String -> IO () +skipIO reason = do putStrLn ("SKIP " ++ reason) E.throwIO (TestCodeSkip reason) +skip :: String -> TestM () +skip = liftIO . skipIO + +skipIfIO :: String -> Bool -> IO () +skipIfIO reason b = when b (skipIO reason) + skipIf :: String -> Bool -> TestM () skipIf reason b = when b (skip reason) +skipUnlessIO :: String -> Bool -> IO () +skipUnlessIO reason b = unless b (skipIO reason) + skipUnless :: String -> Bool -> TestM () skipUnless reason b = unless b (skip reason) -expectedBroken :: TestM () -expectedBroken = liftIO $ do +expectedBroken :: Int -> TestM a +expectedBroken t = liftIO $ do putStrLn "EXPECTED FAIL" - E.throwIO TestCodeKnownFail + E.throwIO (TestCodeKnownFail t) -unexpectedSuccess :: TestM () +unexpectedSuccess :: TestM a unexpectedSuccess = liftIO $ do putStrLn "UNEXPECTED OK" E.throwIO TestCodeUnexpectedOk diff --git a/cabal-testsuite/src/Test/Cabal/TestCode.hs b/cabal-testsuite/src/Test/Cabal/TestCode.hs index e29c9ea6b45..4d0762bdae5 100644 --- a/cabal-testsuite/src/Test/Cabal/TestCode.hs +++ b/cabal-testsuite/src/Test/Cabal/TestCode.hs @@ -19,7 +19,7 @@ import Data.Typeable (Typeable) data TestCode = TestCodeOk | TestCodeSkip String - | TestCodeKnownFail + | TestCodeKnownFail Int | TestCodeUnexpectedOk | TestCodeFail deriving (Eq, Show, Read, Typeable) @@ -31,11 +31,11 @@ instance Exception TestCode #endif displayTestCode :: TestCode -> String -displayTestCode TestCodeOk = "OK" -displayTestCode (TestCodeSkip msg) = "SKIP " ++ msg -displayTestCode TestCodeKnownFail = "OK (known failure)" -displayTestCode TestCodeUnexpectedOk = "FAIL (unexpected success)" -displayTestCode TestCodeFail = "FAIL" +displayTestCode TestCodeOk = "OK" +displayTestCode (TestCodeSkip msg) = "SKIP " ++ msg +displayTestCode (TestCodeKnownFail t) = "OK (known failure, see #" <> show t <> ")" +displayTestCode TestCodeUnexpectedOk = "FAIL (unexpected success)" +displayTestCode TestCodeFail = "FAIL" isTestCodeSkip :: TestCode -> Bool isTestCodeSkip (TestCodeSkip _) = True From f33929bdd278c34b09650f6c97643bebb8b6b445 Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Tue, 9 Jul 2024 01:01:15 +0200 Subject: [PATCH 4/8] Fix some output normalization issues on Windows --- cabal-testsuite/src/Test/Cabal/Monad.hs | 20 +++++++++++++++---- .../src/Test/Cabal/OutputNormalizer.hs | 18 ++++++++++++++--- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/cabal-testsuite/src/Test/Cabal/Monad.hs b/cabal-testsuite/src/Test/Cabal/Monad.hs index 3dd1c747d32..04eb659696c 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 42daa708885..3f4dcf5bc5a 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 " -- Things that look like libraries . resub "libHS[A-Za-z0-9.-]+\\.(so|dll|a|dynlib)" "" -- look for PackageHash directories + . (if buildOS == Windows + then resub "\\\\(([A-Za-z0-9_]+)(-[A-Za-z0-9\\._]+)*)-[0-9a-f]{4,64}\\\\" + "\\\\-\\\\" + else id) . resub "/(([A-Za-z0-9_]+)(-[A-Za-z0-9\\._]+)*)-[0-9a-f]{4,64}/" "/-/" -- 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\\.-]+") "" + -- 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]+") "" else id) . resub (posixRegexEscape "tmp/src-" ++ "[0-9]+") "" . resub (posixRegexEscape (normalizerTmpDir nenv) ++ sameDir) "/" . resub (posixRegexEscape (normalizerCanonicalTmpDir nenv) ++ sameDir) "/" + -- 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.+]+" "/installed-" -- incoming directories in the store + . (if buildOS == Windows then resub "\\\\incoming\\\\new-[0-9]+" + "\\\\incoming\\\\new-" + else id) + -- incoming directories in the store . resub "/incoming/new-[0-9]+" "/incoming/new-" -- Normalize architecture From e2903667ce5355a5607628bc8f0092f90f527008 Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Tue, 9 Jul 2024 01:01:41 +0200 Subject: [PATCH 5/8] Rework how the skipping and expected functions work --- cabal-testsuite/src/Test/Cabal/Prelude.hs | 42 ++++++++++++----------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/cabal-testsuite/src/Test/Cabal/Prelude.hs b/cabal-testsuite/src/Test/Cabal/Prelude.hs index 176b3d994aa..80653c49f3a 100644 --- a/cabal-testsuite/src/Test/Cabal/Prelude.hs +++ b/cabal-testsuite/src/Test/Cabal/Prelude.hs @@ -846,6 +846,9 @@ hasProfiledLibraries = testCompilerWithArgs ["-prof"] hasProfiledSharedLibraries = testCompilerWithArgs ["-prof", "-dynamic"] hasSharedLibraries = testCompilerWithArgs ["-dynamic"] +skipIfNoSharedLibraries :: TestM () +skipIfNoSharedLibraries = skipUnless "no shared libraries" =<< hasSharedLibraries + -- | Check if the GHC that is used for compiling package tests has -- a shared library of the cabal library under test in its database. -- @@ -881,7 +884,6 @@ isCabalVersion decide range = do skipUnlessAnyCabalVersion :: String -> TestM () skipUnlessAnyCabalVersion range = skipUnless ("needs any Cabal " ++ range) =<< anyCabalVersion range - -- | Skip a test if any available Cabal library version matches the predicate. skipIfAnyCabalVersion :: String -> TestM () skipIfAnyCabalVersion range = skipIf ("incompatible with Cabal " ++ range) =<< anyCabalVersion range @@ -912,28 +914,28 @@ skipUnlessGhcVersion range = skipUnless ("needs ghc " ++ range) =<< isGhcVersion skipIfGhcVersion :: String -> TestM () skipIfGhcVersion range = skipIf ("incompatible with ghc " ++ range) =<< isGhcVersion range -skipUnlessJavaScript :: TestM () -skipUnlessJavaScript = skipUnless "needs the JavaScript backend" =<< isJavaScript +skipUnlessJavaScript :: IO () +skipUnlessJavaScript = skipUnlessIO "needs the JavaScript backend" isJavaScript -skipIfJavaScript :: TestM () -skipIfJavaScript = skipIf "incompatible with the JavaScript backend" =<< isJavaScript +skipIfJavaScript :: IO () +skipIfJavaScript = skipIfIO "incompatible with the JavaScript backend" isJavaScript -isWindows :: TestM Bool -isWindows = return (buildOS == Windows) +isWindows :: Bool +isWindows = buildOS == Windows -isOSX :: TestM Bool -isOSX = return (buildOS == OSX) +isOSX :: Bool +isOSX = buildOS == OSX -isLinux :: TestM Bool -isLinux = return (buildOS == Linux) +isLinux :: Bool +isLinux = buildOS == Linux -isJavaScript :: TestM Bool -isJavaScript = return (buildArch == JavaScript) +isJavaScript :: Bool +isJavaScript = buildArch == JavaScript -- should probably be `hostArch` but Cabal doesn't distinguish build platform -- and host platform -skipIfWindows :: TestM () -skipIfWindows = skipIf "Windows" =<< isWindows +skipIfWindows :: String -> IO () +skipIfWindows why = skipIfIO ("Windows " <> why) isWindows getOpenFilesLimit :: TestM (Maybe Integer) #ifdef mingw32_HOST_OS @@ -962,7 +964,7 @@ hasNewBuildCompatBootCabal = isGhcVersion ">= 7.9" ------------------------------------------------------------------------ -- * Broken tests -expectBroken :: Int -> TestM a -> TestM () +expectBroken :: Int -> TestM a -> TestM a expectBroken ticket m = do env <- getTestEnv liftIO . withAsync (runReaderT m env) $ \a -> do @@ -971,15 +973,15 @@ expectBroken ticket m = do Left e -> do putStrLn $ "This test is known broken, see #" ++ show ticket ++ ":" print e - runReaderT expectedBroken env + runReaderT (expectedBroken ticket) env Right _ -> do runReaderT unexpectedSuccess env -expectBrokenIf :: Bool -> Int -> TestM a -> TestM () -expectBrokenIf False _ m = void $ m +expectBrokenIf :: Bool -> Int -> TestM a -> TestM a +expectBrokenIf False _ m = m expectBrokenIf True ticket m = expectBroken ticket m -expectBrokenUnless :: Bool -> Int -> TestM a -> TestM () +expectBrokenUnless :: Bool -> Int -> TestM a -> TestM a expectBrokenUnless b = expectBrokenIf (not b) -- * Programs From 83ec0b9013ae0890efa277cca066c37440501c1a Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Tue, 9 Jul 2024 01:01:52 +0200 Subject: [PATCH 6/8] Un-ignore .bat files --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 957786d7055..3450353924b 100644 --- a/.gitignore +++ b/.gitignore @@ -78,7 +78,6 @@ testdb/intree/store/*/package.db/package.cache.lock # windows test artifacts cabal-testsuite/**/*.exe -cabal-testsuite/**/*.bat cabal-testsuite/**/haddocks # python artifacts from documentation builds From 3ccb534cfe1f26e6c344c3dd80b42e9bc32eb1c9 Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Mon, 15 Jul 2024 17:33:37 +0200 Subject: [PATCH 7/8] Docs: Clarify MSYS2 complications --- doc/how-to-run-in-windows.rst | 67 +++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 15 deletions(-) diff --git a/doc/how-to-run-in-windows.rst b/doc/how-to-run-in-windows.rst index 5c06f62bbb3..53aeb33b849 100644 --- a/doc/how-to-run-in-windows.rst +++ b/doc/how-to-run-in-windows.rst @@ -8,7 +8,7 @@ more explanations. For a TL;DR, jump to the :ref:`Complete configuration`. Install the Haskell environment ------------------------------- -Haskell development on Windows makes use of the `MSYS2 `_ +Haskell development on Windows makes use of the `MSYS2 `_ tools. The recommended way of setting up a Haskell environment in Windows is by using @@ -19,11 +19,43 @@ system in your computer unless told not to do so: refer to `its documentation .. NOTE:: Stack is another tool you can use to set up a Haskell environment on Windows. Stack - can be installed on its own or via GHCup. See - `Stack's webpage `_ and/or + can be installed on its own or via GHCup. See + `Stack's webpage `_ and/or `GHCup's section on Stack integration `_, in particular the `Windows related subsection `_. +MSYS2 environments and packages +------------------------------- + +A particular environment has to be chosen when using MSYS2. By default GHCup will +use ``MINGW64``. You can learn more about the different environments in the `MSYS2 +documentation `_. + +GHCs before 9.4.1 are shipped with a minimal set of packages based on the +``MINGW64`` environment, and GHC 9.4.1 and newer are shipped with a minimal set +of packages based on the ``CLANG64`` environment. It is in general advisable to +work inside the same environment as your GHC uses, but (with some exceptions) +it shouldn't matter whether environments are mixed. Stay warned that it can +sometimes lead to undecipherable errors. + +We will refer to the chosen environment as ```` through this +documentation. + +Third-party libraries and tools can be installed using the ``pacman`` package +manager on the MSYS2 installation +(`see `_). If MSYS2 was +installed via GHCup, check GHCup's documentation on how to call ``pacman``. Note +that installing a package ``mingw-w64--x86_64-`` will install +it in the ``\`` tree of directories, and might not be +visible if working on a different environment than ````. In +general, it is advisable to install only packages for the environment that was +chosen above. + +Apart from these environments, there is the ``msys`` environment which is based +on Cygwin. Some tools only exist for this environment. Tools from this environment +are callable when working in any other environment. It is in general not possible +to link to libraries installed in the ``msys`` environment. + Ensure that Cabal can call the tools it needs --------------------------------------------- @@ -39,11 +71,10 @@ Windows. The directories where those are located need to be made visible in the extra-prog-path: \\bin \usr\bin -Where ```` points to the location of your MSYS2 installation. Refer to -GHCup's documentation on the default location of this directory. -```` has to be one of the environments of MSYS2, which for GHCup is -``mingw64``. You can learn more about the different environments in the `MSYS2 -documentation `_. +Where ```` points to the location of your MSYS2 installation. If MSYS2 +was installed via GHCup, refer to GHCup's documentation on the default location +of this directory. If MSYS2 was installed system-wide this is usually +``C:\msys64``. .. note:: @@ -53,8 +84,7 @@ documentation `_. Ensure that Cabal can use system libraries ------------------------------------------ -Third-party libraries can be installed using the ``pacman`` package manager on -the MSYS2 installation. When installing a third party package its libraries and +When installing a third party package its libraries and header files will (usually) be placed in ``\\{lib,include}`` respectively. These directories need to be specified in the ``extra-lib-dirs`` and ``extra-include-dirs`` @@ -74,11 +104,18 @@ include these options: .. warning:: - Packages in the ``msys/`` repo are not native Windows libraries and will - probably not work when one tries to link to them. Install the packages for - your selected environment, which for GHCup is ``mingw64/``. Refer to `MSYS2's - package management documentation - `_ for more information. + GHCs older than 9.4.1 will crash if a recent + ``mingw-w64--x86_64-crt-git`` is installed for whichever ```` and + these directories are set globally . + + Effectively this means that if you have installed ``mingw-w64--x86_64-crt-git`` + (which you probably have if you are using ``clang`` in the ``CLANG64`` + environment or ``gcc`` in the ``UCRT64`` or ``MINGW64`` environments outside of + Haskell, as this package is part of the ``mingw-w64--x86_64-toolchain`` + meta-packages) and are using a GHC older than 9.4.1, you cannot simply depend on system + libraries by adding these paths to the global config, and instead you will + have to go through some other method to depend on those libraries like + :pkg-field:`pkgconfig-depends`. Ensure that Cabal can call Haskell tools ---------------------------------------- From 4b1d9b904951eb929961f579531115ef45ee764f Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Mon, 15 Jul 2024 17:33:22 +0200 Subject: [PATCH 8/8] Fix a bunch of Windows tests, clarify why others are broken --- .../AutoconfBadPaths/cabal.test.hs | 60 ++++++------ .../Includes2/{Includes2.cabal => I.cabal} | 6 +- .../Includes2.cabal => I.cabal.fail} | 0 .../I.cabal} | 0 .../Includes2/{Includes2.cabal => I.cabal} | 4 +- .../Backpack/Includes2/cabal-external.test.hs | 4 +- .../Includes2/cabal-internal-target.out | 8 +- .../Backpack/Includes2/cabal-internal.out | 66 ++++++------- .../Backpack/Includes2/cabal-internal.test.hs | 5 +- .../PackageTests/Backpack/Includes2/cov.out | 70 +++++++------- .../Backpack/Includes2/cov.test.hs | 1 - .../Includes2/setup-internal.cabal.out | 50 +++++----- .../Backpack/Includes2/setup-internal.out | 50 +++++----- .../Includes2/setup-per-component.out | 92 +++++++++---------- .../Includes2/setup-per-component.test.hs | 2 +- .../Includes3/{Includes3.cabal => I.cabal} | 2 +- .../Backpack/Includes3/cabal-external.test.hs | 4 +- .../Backpack/Includes3/cabal-internal.out | 34 +++---- .../Backpack/Includes3/cabal-internal.test.hs | 5 +- .../Backpack/Includes3/cabal-repo.test.hs | 1 - .../Includes3/setup-internal.cabal.out | 40 ++++---- .../Backpack/Includes3/setup-internal.out | 40 ++++---- .../PackageTests/Backpack/T6385/cabal.test.hs | 3 +- .../bkpcabal01/{bkpcabal01.cabal => b.cabal} | 2 +- .../Backpack/bkpcabal01/cabal.out | 56 +++++------ .../Backpack/bkpcabal01/cabal.test.hs | 4 +- .../PackageTests/BuildTools/Foreign/A.hs | 5 + .../Foreign/my-foreign-preprocessor.bat | 2 + .../Foreign/my-foreign-preprocessor.ps1 | 1 + .../BuildTools/Foreign/setup.test.hs | 2 - .../CCompilerOverride/setup.test.hs | 3 +- .../Paths/InvalidWin/cabal.test.hs | 17 ++-- .../PackageTests/CmmSourcesDyn/cabal.test.hs | 2 +- .../ConditionalAndImport/cabal.test.hs | 49 +++++----- .../PackageTests/CustomSegfault/cabal.test.hs | 3 +- .../PackageTests/ExtraProgPath/setup.test.hs | 10 +- .../PackageTests/ForeignLibs/setup.test.hs | 3 +- .../GHCJS/BuildRunner/cabal.test.hs | 4 +- .../GhcPkgGuess/SameDirectory/setup.test.hs | 17 ++-- .../SameDirectoryGhcVersion/setup.test.hs | 17 ++-- .../SameDirectoryVersion/setup.test.hs | 17 ++-- .../GhcPkgGuess/Symlink/setup.test.hs | 5 +- .../SymlinkGhcVersion/setup.test.hs | 5 +- .../GhcPkgGuess/SymlinkVersion/setup.test.hs | 5 +- .../HaddockKeepsTmps/cabal.test.hs | 21 +++-- .../Executable/setup-static.test.hs | 2 +- .../setup-gen-script.test.hs | 3 +- .../PackageTests/JS/JsSources/js-arch.test.hs | 12 +-- .../JS/JsSources/other-arch.test.hs | 9 +- .../JS/JsSourcesExe/js-arch.test.hs | 12 +-- .../JS/JsSourcesExe/other-arch.test.hs | 9 +- .../NonignoredConfigs/cabal.test.hs | 9 +- .../LinkerOptions/T7339/setup.test.hs | 11 +-- .../MultiRepl/EnabledSucc/cabal.test.hs | 1 - .../NewBuild/CmdRun/Terminate/cabal.test.hs | 54 +++++------ ...ackage-from-repo-with-custom-setup.test.hs | 6 +- .../PackageTests/NewBuild/T3827/cabal.test.hs | 4 +- .../PackageTests/NewFreeze/T9799b/src/None.hs | 5 +- .../OfflineFlag/offlineFlag.test.hs | 1 - .../Executable-Relocatable/setup.test.hs | 9 +- .../PackageTests/PkgConfigParse/setup.test.hs | 4 +- .../PreProcess/Hsc2HsOptionsCC/my.cabal | 1 - .../PreProcess/Hsc2HsOptionsCC/setup.test.hs | 32 ++++--- .../PackageTests/ProfShared/setup.test.hs | 5 +- .../QuasiQuotes/dynamic/setup.test.hs | 2 +- .../Regression/T4025/setup.test.hs | 27 +++--- .../Regression/T4270/setup.test.hs | 5 +- .../Regression/T4291/setup.test.hs | 25 ++--- .../Regression/T5309/cabal.test.hs | 12 ++- .../Regression/T5677/cabal.test.hs | 1 - .../Regression/T6906/cabal.test.hs | 3 +- .../ExeV10/cabal-with-hpc.multitest.hs | 4 +- .../clean-install-by-copy.test.hs | 18 ++-- .../clean-install-by-symlink.test.hs | 12 +-- .../WarnEarlyOverwrite/dirty-install.test.hs | 21 ++--- .../postCheckoutCommand/cabal.test.hs | 5 +- validate.sh | 2 +- 77 files changed, 554 insertions(+), 569 deletions(-) rename cabal-testsuite/PackageTests/Backpack/Includes2/{Includes2.cabal => I.cabal} (92%) rename cabal-testsuite/PackageTests/Backpack/Includes2/{Includes2-fail/Includes2.cabal => I.cabal.fail} (100%) rename cabal-testsuite/PackageTests/Backpack/Includes2/{Includes2.cabal.fail => Includes2-fail/I.cabal} (100%) rename cabal-testsuite/PackageTests/Backpack/Includes2/Includes2/{Includes2.cabal => I.cabal} (93%) rename cabal-testsuite/PackageTests/Backpack/Includes3/{Includes3.cabal => I.cabal} (95%) rename cabal-testsuite/PackageTests/Backpack/bkpcabal01/{bkpcabal01.cabal => b.cabal} (96%) create mode 100644 cabal-testsuite/PackageTests/BuildTools/Foreign/my-foreign-preprocessor.bat create mode 100644 cabal-testsuite/PackageTests/BuildTools/Foreign/my-foreign-preprocessor.ps1 diff --git a/cabal-testsuite/PackageTests/AutoconfBadPaths/cabal.test.hs b/cabal-testsuite/PackageTests/AutoconfBadPaths/cabal.test.hs index 93ce9825a36..544764affcd 100644 --- a/cabal-testsuite/PackageTests/AutoconfBadPaths/cabal.test.hs +++ b/cabal-testsuite/PackageTests/AutoconfBadPaths/cabal.test.hs @@ -2,36 +2,38 @@ import Test.Cabal.Prelude import Data.Foldable (traverse_) import Distribution.Simple.Utils import System.Directory -main = cabalTest $ do - -- Test the forbidden characters except NUL. Reference: - -- https://www.gnu.org/software/autoconf/manual/autoconf.html#File-System-Conventions +main = do -- Most of these are magic on Windows, so don't bother testing there. - -- - -- Note: we bundle the configure script so no need to autoreconf - -- while building - skipIfWindows - traverse_ check - [ "foo bar" - , "foo\tbar" - , "foo\nbar" - , "foo\"bar" - , "foo#bar" - , "foo$bar" - , "foo&bar" - , "foo'bar" - , "foo(bar" - , "foo)bar" - , "foo*bar" - , "foo;bar" - , "foobar" - , "foo?bar" - , "foo[bar" - , "foo\\bar" - , "foo`bar" - , "foo|bar" - ] + skipIfWindows "uninteresting" + cabalTest $ + -- Test the forbidden characters except NUL. Reference: + -- https://www.gnu.org/software/autoconf/manual/autoconf.html#File-System-Conventions + -- + -- Note: we bundle the configure script so no need to autoreconf + -- while building + + traverse_ check + [ "foo bar" + , "foo\tbar" + , "foo\nbar" + , "foo\"bar" + , "foo#bar" + , "foo$bar" + , "foo&bar" + , "foo'bar" + , "foo(bar" + , "foo)bar" + , "foo*bar" + , "foo;bar" + , "foobar" + , "foo?bar" + , "foo[bar" + , "foo\\bar" + , "foo`bar" + , "foo|bar" + ] where setup dir = do env <- getTestEnv diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal b/cabal-testsuite/PackageTests/Backpack/Includes2/I.cabal similarity index 92% rename from cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal rename to cabal-testsuite/PackageTests/Backpack/Includes2/I.cabal index e6aa6169e68..efaa83b4837 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/I.cabal @@ -1,4 +1,4 @@ -name: Includes2 +name: I version: 0.1.0.0 license: BSD3 author: Edward Z. Yang @@ -35,14 +35,14 @@ library default-language: Haskell2010 executable exe - build-depends: base, Includes2 + build-depends: base, I main-is: Main.hs hs-source-dirs: exe default-language: Haskell2010 test-suite includes2-test type: exitcode-stdio-1.0 - build-depends: base, Includes2 + build-depends: base, I main-is: test.hs hs-source-dirs: test default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2-fail/Includes2.cabal b/cabal-testsuite/PackageTests/Backpack/Includes2/I.cabal.fail similarity index 100% rename from cabal-testsuite/PackageTests/Backpack/Includes2/Includes2-fail/Includes2.cabal rename to cabal-testsuite/PackageTests/Backpack/Includes2/I.cabal.fail diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal.fail b/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2-fail/I.cabal similarity index 100% rename from cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal.fail rename to cabal-testsuite/PackageTests/Backpack/Includes2/Includes2-fail/I.cabal diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2/Includes2.cabal b/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2/I.cabal similarity index 93% rename from cabal-testsuite/PackageTests/Backpack/Includes2/Includes2/Includes2.cabal rename to cabal-testsuite/PackageTests/Backpack/Includes2/Includes2/I.cabal index 7a02fcd961c..793f6a31979 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2/Includes2.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2/I.cabal @@ -1,4 +1,4 @@ -name: Includes2 +name: I version: 0.1.0.0 license: BSD3 author: Edward Z. Yang @@ -35,7 +35,7 @@ library default-language: Haskell2010 executable exe - build-depends: base, Includes2 + build-depends: base, I main-is: Main.hs hs-source-dirs: exe default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-external.test.hs b/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-external.test.hs index 7197786ff2a..432911b1714 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-external.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-external.test.hs @@ -1,8 +1,8 @@ import Test.Cabal.Prelude -main = cabalTest $ do +main = do + cabalTest $ do skipUnlessGhcVersion ">= 8.1" - skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 withProjectFile "cabal.external.project" $ do cabal "v2-build" ["exe"] withPlan $ do diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal-target.out b/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal-target.out index 8b63d59d82c..2a91ccc557a 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal-target.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal-target.out @@ -2,8 +2,8 @@ Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: - - Includes2-0.1.0.0 (lib:mylib) (first run) -Configuring library 'mylib' for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... + - I-0.1.0.0 (lib:mylib) (first run) +Configuring library 'mylib' for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with Database = -for Includes2-0.1.0.0... +for I-0.1.0.0... diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal.out b/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal.out index f8dfb64d9e6..42f77888c8c 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal.out @@ -2,42 +2,42 @@ Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: - - Includes2-0.1.0.0 (lib:mylib) (first run) - - Includes2-0.1.0.0 (lib:mysql) (first run) - - Includes2-0.1.0.0 (lib:postgresql) (first run) - - Includes2-0.1.0.0 (lib:mylib with Database=Includes2-0.1.0.0-inplace-mysql:Database.MySQL) (first run) - - Includes2-0.1.0.0 (lib:mylib with Database=Includes2-0.1.0.0-inplace-postgresql:Database.PostgreSQL) (first run) - - Includes2-0.1.0.0 (lib) (first run) - - Includes2-0.1.0.0 (exe:exe) (first run) -Configuring library 'mylib' for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... + - I-0.1.0.0 (lib:mylib) (first run) + - I-0.1.0.0 (lib:mysql) (first run) + - I-0.1.0.0 (lib:postgresql) (first run) + - I-0.1.0.0 (lib:mylib with Database=I-0.1.0.0-inplace-mysql:Database.MySQL) (first run) + - I-0.1.0.0 (lib:mylib with Database=I-0.1.0.0-inplace-postgresql:Database.PostgreSQL) (first run) + - I-0.1.0.0 (lib) (first run) + - I-0.1.0.0 (exe:exe) (first run) +Configuring library 'mylib' for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with Database = -for Includes2-0.1.0.0... -Configuring library 'mysql' for Includes2-0.1.0.0... -Preprocessing library 'mysql' for Includes2-0.1.0.0... -Building library 'mysql' for Includes2-0.1.0.0... -Configuring library 'postgresql' for Includes2-0.1.0.0... -Preprocessing library 'postgresql' for Includes2-0.1.0.0... -Building library 'postgresql' for Includes2-0.1.0.0... +for I-0.1.0.0... +Configuring library 'mysql' for I-0.1.0.0... +Preprocessing library 'mysql' for I-0.1.0.0... +Building library 'mysql' for I-0.1.0.0... +Configuring library 'postgresql' for I-0.1.0.0... +Preprocessing library 'postgresql' for I-0.1.0.0... +Building library 'postgresql' for I-0.1.0.0... Configuring library 'mylib' instantiated with - Database = Includes2-0.1.0.0-inplace-mysql:Database.MySQL -for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... + Database = I-0.1.0.0-inplace-mysql:Database.MySQL +for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with - Database = Includes2-0.1.0.0-inplace-mysql:Database.MySQL -for Includes2-0.1.0.0... + Database = I-0.1.0.0-inplace-mysql:Database.MySQL +for I-0.1.0.0... Configuring library 'mylib' instantiated with - Database = Includes2-0.1.0.0-inplace-postgresql:Database.PostgreSQL -for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... + Database = I-0.1.0.0-inplace-postgresql:Database.PostgreSQL +for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with - Database = Includes2-0.1.0.0-inplace-postgresql:Database.PostgreSQL -for Includes2-0.1.0.0... -Configuring library for Includes2-0.1.0.0... -Preprocessing library for Includes2-0.1.0.0... -Building library for Includes2-0.1.0.0... -Configuring executable 'exe' for Includes2-0.1.0.0... -Preprocessing executable 'exe' for Includes2-0.1.0.0... -Building executable 'exe' for Includes2-0.1.0.0... -# Includes2 exe + Database = I-0.1.0.0-inplace-postgresql:Database.PostgreSQL +for I-0.1.0.0... +Configuring library for I-0.1.0.0... +Preprocessing library for I-0.1.0.0... +Building library for I-0.1.0.0... +Configuring executable 'exe' for I-0.1.0.0... +Preprocessing executable 'exe' for I-0.1.0.0... +Building executable 'exe' for I-0.1.0.0... +# I exe "minemysql minepostgresql" diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal.test.hs b/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal.test.hs index a04fdd4987a..6a05d9f0e96 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal.test.hs @@ -2,9 +2,8 @@ import Test.Cabal.Prelude main = cabalTest $ do skipUnlessGhcVersion ">= 8.1" - skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 - withProjectFile "cabal.internal.project" $ do + expectBrokenIf isWindows 10191 $ withProjectFile "cabal.internal.project" $ do cabal "v2-build" ["exe"] withPlan $ do - r <- runPlanExe' "Includes2" "exe" [] + r <- runPlanExe' "I" "exe" [] assertOutputContains "minemysql minepostgresql" r diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/cov.out b/cabal-testsuite/PackageTests/Backpack/Includes2/cov.out index 784baff09e7..0d1b2c027b5 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/cov.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/cov.out @@ -2,47 +2,47 @@ Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: - - Includes2-0.1.0.0 (lib:mylib) (first run) - - Includes2-0.1.0.0 (lib:mysql) (first run) - - Includes2-0.1.0.0 (lib:postgresql) (first run) - - Includes2-0.1.0.0 (lib:mylib with Database=Includes2-0.1.0.0-inplace-mysql:Database.MySQL) (first run) - - Includes2-0.1.0.0 (lib:mylib with Database=Includes2-0.1.0.0-inplace-postgresql:Database.PostgreSQL) (first run) - - Includes2-0.1.0.0 (lib) (first run) - - Includes2-0.1.0.0 (test:includes2-test) (first run) -Configuring library 'mylib' for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... + - I-0.1.0.0 (lib:mylib) (first run) + - I-0.1.0.0 (lib:mysql) (first run) + - I-0.1.0.0 (lib:postgresql) (first run) + - I-0.1.0.0 (lib:mylib with Database=I-0.1.0.0-inplace-mysql:Database.MySQL) (first run) + - I-0.1.0.0 (lib:mylib with Database=I-0.1.0.0-inplace-postgresql:Database.PostgreSQL) (first run) + - I-0.1.0.0 (lib) (first run) + - I-0.1.0.0 (test:includes2-test) (first run) +Configuring library 'mylib' for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with Database = -for Includes2-0.1.0.0... -Configuring library 'mysql' for Includes2-0.1.0.0... -Preprocessing library 'mysql' for Includes2-0.1.0.0... -Building library 'mysql' for Includes2-0.1.0.0... -Configuring library 'postgresql' for Includes2-0.1.0.0... -Preprocessing library 'postgresql' for Includes2-0.1.0.0... -Building library 'postgresql' for Includes2-0.1.0.0... +for I-0.1.0.0... +Configuring library 'mysql' for I-0.1.0.0... +Preprocessing library 'mysql' for I-0.1.0.0... +Building library 'mysql' for I-0.1.0.0... +Configuring library 'postgresql' for I-0.1.0.0... +Preprocessing library 'postgresql' for I-0.1.0.0... +Building library 'postgresql' for I-0.1.0.0... Configuring library 'mylib' instantiated with - Database = Includes2-0.1.0.0-inplace-mysql:Database.MySQL -for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... + Database = I-0.1.0.0-inplace-mysql:Database.MySQL +for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with - Database = Includes2-0.1.0.0-inplace-mysql:Database.MySQL -for Includes2-0.1.0.0... + Database = I-0.1.0.0-inplace-mysql:Database.MySQL +for I-0.1.0.0... Configuring library 'mylib' instantiated with - Database = Includes2-0.1.0.0-inplace-postgresql:Database.PostgreSQL -for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... + Database = I-0.1.0.0-inplace-postgresql:Database.PostgreSQL +for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with - Database = Includes2-0.1.0.0-inplace-postgresql:Database.PostgreSQL -for Includes2-0.1.0.0... -Configuring library for Includes2-0.1.0.0... -Preprocessing library for Includes2-0.1.0.0... -Building library for Includes2-0.1.0.0... -Configuring test suite 'includes2-test' for Includes2-0.1.0.0... -Preprocessing test suite 'includes2-test' for Includes2-0.1.0.0... -Building test suite 'includes2-test' for Includes2-0.1.0.0... + Database = I-0.1.0.0-inplace-postgresql:Database.PostgreSQL +for I-0.1.0.0... +Configuring library for I-0.1.0.0... +Preprocessing library for I-0.1.0.0... +Building library for I-0.1.0.0... +Configuring test suite 'includes2-test' for I-0.1.0.0... +Preprocessing test suite 'includes2-test' for I-0.1.0.0... +Building test suite 'includes2-test' for I-0.1.0.0... Running 1 test suites... Test suite includes2-test: RUNNING... Test suite includes2-test: PASS -Test suite logged to: /cov.dist/work/./dist/build//ghc-/Includes2-0.1.0.0/t/includes2-test/test/Includes2-0.1.0.0-includes2-test.log -Package coverage report written to /cov.dist/work/./dist/build//ghc-/Includes2-0.1.0.0/t/includes2-test/hpc/vanilla/html/hpc_index.html +Test suite logged to: /cov.dist/work/./dist/build//ghc-/I-0.1.0.0/t/includes2-test/test/I-0.1.0.0-includes2-test.log +Package coverage report written to /cov.dist/work/./dist/build//ghc-/I-0.1.0.0/t/includes2-test/hpc/vanilla/html/hpc_index.html 1 of 1 test suites (1 of 1 test cases) passed. -Package coverage report written to /cov.dist/work/./dist/build//ghc-/Includes2-0.1.0.0/t/includes2-test/hpc/vanilla/html/hpc_index.html +Package coverage report written to /cov.dist/work/./dist/build//ghc-/I-0.1.0.0/t/includes2-test/hpc/vanilla/html/hpc_index.html diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/cov.test.hs b/cabal-testsuite/PackageTests/Backpack/Includes2/cov.test.hs index 24c1662c375..40079c0e787 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/cov.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/cov.test.hs @@ -1,6 +1,5 @@ import Test.Cabal.Prelude main = cabalTest $ do skipUnlessGhcVersion ">= 8.1" - skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 -- #6397 cabal "test" ["--enable-coverage", "includes2-test"] diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-internal.cabal.out b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-internal.cabal.out index 12dc4aecc6c..e8f2fa18d85 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-internal.cabal.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-internal.cabal.out @@ -1,25 +1,25 @@ # Setup configure -Configuring Includes2-0.1.0.0... +Configuring I-0.1.0.0... # Setup build -Preprocessing library 'postgresql' for Includes2-0.1.0.0... -Building library 'postgresql' for Includes2-0.1.0.0... -Preprocessing library 'mysql' for Includes2-0.1.0.0... -Building library 'mysql' for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... +Preprocessing library 'postgresql' for I-0.1.0.0... +Building library 'postgresql' for I-0.1.0.0... +Preprocessing library 'mysql' for I-0.1.0.0... +Building library 'mysql' for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with Database = -for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with - Database = Includes2-0.1.0.0-mysql:Database.MySQL -for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... + Database = I-0.1.0.0-postgresql:Database.PostgreSQL +for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with - Database = Includes2-0.1.0.0-postgresql:Database.PostgreSQL -for Includes2-0.1.0.0... -Preprocessing library for Includes2-0.1.0.0... -Building library for Includes2-0.1.0.0... -Preprocessing executable 'exe' for Includes2-0.1.0.0... -Building executable 'exe' for Includes2-0.1.0.0... + Database = I-0.1.0.0-mysql:Database.MySQL +for I-0.1.0.0... +Preprocessing library for I-0.1.0.0... +Building library for I-0.1.0.0... +Preprocessing executable 'exe' for I-0.1.0.0... +Building executable 'exe' for I-0.1.0.0... # Setup copy Installing internal library postgresql in Installing internal library mysql in @@ -30,16 +30,16 @@ Installing library in Installing executable exe in Warning: The directory /setup-internal.cabal.dist/usr/bin is not in the system search path. # Setup register -Registering library 'postgresql' for Includes2-0.1.0.0... -Registering library 'mysql' for Includes2-0.1.0.0... +Registering library 'postgresql' for I-0.1.0.0... +Registering library 'mysql' for I-0.1.0.0... Registering library 'mylib' instantiated with Database = -for Includes2-0.1.0.0... +for I-0.1.0.0... Registering library 'mylib' instantiated with - Database = Includes2-0.1.0.0-mysql:Database.MySQL -for Includes2-0.1.0.0... + Database = I-0.1.0.0-postgresql:Database.PostgreSQL +for I-0.1.0.0... Registering library 'mylib' instantiated with - Database = Includes2-0.1.0.0-postgresql:Database.PostgreSQL -for Includes2-0.1.0.0... -Registering library for Includes2-0.1.0.0... + Database = I-0.1.0.0-mysql:Database.MySQL +for I-0.1.0.0... +Registering library for I-0.1.0.0... # exe "minemysql minepostgresql" diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-internal.out b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-internal.out index 700f1b2fbfc..0cb3b8768c3 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-internal.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-internal.out @@ -1,25 +1,25 @@ # Setup configure -Configuring Includes2-0.1.0.0... +Configuring I-0.1.0.0... # Setup build -Preprocessing library 'postgresql' for Includes2-0.1.0.0... -Building library 'postgresql' for Includes2-0.1.0.0... -Preprocessing library 'mysql' for Includes2-0.1.0.0... -Building library 'mysql' for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... +Preprocessing library 'postgresql' for I-0.1.0.0... +Building library 'postgresql' for I-0.1.0.0... +Preprocessing library 'mysql' for I-0.1.0.0... +Building library 'mysql' for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with Database = -for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with - Database = Includes2-0.1.0.0-mysql:Database.MySQL -for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... + Database = I-0.1.0.0-postgresql:Database.PostgreSQL +for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with - Database = Includes2-0.1.0.0-postgresql:Database.PostgreSQL -for Includes2-0.1.0.0... -Preprocessing library for Includes2-0.1.0.0... -Building library for Includes2-0.1.0.0... -Preprocessing executable 'exe' for Includes2-0.1.0.0... -Building executable 'exe' for Includes2-0.1.0.0... + Database = I-0.1.0.0-mysql:Database.MySQL +for I-0.1.0.0... +Preprocessing library for I-0.1.0.0... +Building library for I-0.1.0.0... +Preprocessing executable 'exe' for I-0.1.0.0... +Building executable 'exe' for I-0.1.0.0... # Setup copy Installing internal library postgresql in Installing internal library mysql in @@ -30,16 +30,16 @@ Installing library in Installing executable exe in Warning: The directory /setup-internal.dist/usr/bin is not in the system search path. # Setup register -Registering library 'postgresql' for Includes2-0.1.0.0... -Registering library 'mysql' for Includes2-0.1.0.0... +Registering library 'postgresql' for I-0.1.0.0... +Registering library 'mysql' for I-0.1.0.0... Registering library 'mylib' instantiated with Database = -for Includes2-0.1.0.0... +for I-0.1.0.0... Registering library 'mylib' instantiated with - Database = Includes2-0.1.0.0-mysql:Database.MySQL -for Includes2-0.1.0.0... + Database = I-0.1.0.0-postgresql:Database.PostgreSQL +for I-0.1.0.0... Registering library 'mylib' instantiated with - Database = Includes2-0.1.0.0-postgresql:Database.PostgreSQL -for Includes2-0.1.0.0... -Registering library for Includes2-0.1.0.0... + Database = I-0.1.0.0-mysql:Database.MySQL +for I-0.1.0.0... +Registering library for I-0.1.0.0... # exe "minemysql minepostgresql" diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-per-component.out b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-per-component.out index 36c406d8584..5fff9a72819 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-per-component.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-per-component.out @@ -1,107 +1,107 @@ # Setup configure -Configuring library 'mylib' for Includes2-0.1.0.0... +Configuring library 'mylib' for I-0.1.0.0... # Setup build -Preprocessing library 'mylib' for Includes2-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with Database = -for Includes2-0.1.0.0... +for I-0.1.0.0... # Setup haddock -Preprocessing library 'mylib' for Includes2-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Running Haddock on library 'mylib' instantiated with Database = -for Includes2-0.1.0.0... -Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/Includes2/mylib +for I-0.1.0.0... +Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/I/mylib # Setup copy Installing internal library mylib in # Setup register Registering library 'mylib' instantiated with Database = -for Includes2-0.1.0.0... +for I-0.1.0.0... # Setup configure -Configuring library 'mysql' for Includes2-0.1.0.0... +Configuring library 'mysql' for I-0.1.0.0... # Setup build -Preprocessing library 'mysql' for Includes2-0.1.0.0... -Building library 'mysql' for Includes2-0.1.0.0... +Preprocessing library 'mysql' for I-0.1.0.0... +Building library 'mysql' for I-0.1.0.0... # Setup haddock -Preprocessing library 'mysql' for Includes2-0.1.0.0... -Running Haddock on library 'mysql' for Includes2-0.1.0.0... -Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/Includes2/mysql +Preprocessing library 'mysql' for I-0.1.0.0... +Running Haddock on library 'mysql' for I-0.1.0.0... +Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/I/mysql # Setup copy Installing internal library mysql in # Setup register -Registering library 'mysql' for Includes2-0.1.0.0... +Registering library 'mysql' for I-0.1.0.0... # Setup configure -Configuring library 'postgresql' for Includes2-0.1.0.0... +Configuring library 'postgresql' for I-0.1.0.0... # Setup build -Preprocessing library 'postgresql' for Includes2-0.1.0.0... -Building library 'postgresql' for Includes2-0.1.0.0... +Preprocessing library 'postgresql' for I-0.1.0.0... +Building library 'postgresql' for I-0.1.0.0... # Setup haddock -Preprocessing library 'postgresql' for Includes2-0.1.0.0... -Running Haddock on library 'postgresql' for Includes2-0.1.0.0... -Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/Includes2/postgresql +Preprocessing library 'postgresql' for I-0.1.0.0... +Running Haddock on library 'postgresql' for I-0.1.0.0... +Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/I/postgresql # Setup copy Installing internal library postgresql in # Setup register -Registering library 'postgresql' for Includes2-0.1.0.0... +Registering library 'postgresql' for I-0.1.0.0... # Setup configure Configuring library 'mylib' instantiated with Database = mysql-0.1.0.0:Database.MySQL -for Includes2-0.1.0.0... +for I-0.1.0.0... # Setup build -Preprocessing library 'mylib' for Includes2-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with Database = mysql-0.1.0.0:Database.MySQL -for Includes2-0.1.0.0... +for I-0.1.0.0... # Setup haddock -Preprocessing library 'mylib' for Includes2-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Running Haddock on library 'mylib' instantiated with Database = mysql-0.1.0.0:Database.MySQL -for Includes2-0.1.0.0... -Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/Includes2/mylib +for I-0.1.0.0... +Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/I/mylib # Setup copy Installing internal library mylib in # Setup register Registering library 'mylib' instantiated with Database = mysql-0.1.0.0:Database.MySQL -for Includes2-0.1.0.0... +for I-0.1.0.0... # Setup configure Configuring library 'mylib' instantiated with Database = postgresql-0.1.0.0:Database.PostgreSQL -for Includes2-0.1.0.0... +for I-0.1.0.0... # Setup build -Preprocessing library 'mylib' for Includes2-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with Database = postgresql-0.1.0.0:Database.PostgreSQL -for Includes2-0.1.0.0... +for I-0.1.0.0... # Setup haddock -Preprocessing library 'mylib' for Includes2-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Running Haddock on library 'mylib' instantiated with Database = postgresql-0.1.0.0:Database.PostgreSQL -for Includes2-0.1.0.0... -Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/Includes2/mylib +for I-0.1.0.0... +Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/I/mylib # Setup copy Installing internal library mylib in # Setup register Registering library 'mylib' instantiated with Database = postgresql-0.1.0.0:Database.PostgreSQL -for Includes2-0.1.0.0... +for I-0.1.0.0... # Setup configure -Configuring library for Includes2-0.1.0.0... +Configuring library for I-0.1.0.0... # Setup build -Preprocessing library for Includes2-0.1.0.0... -Building library for Includes2-0.1.0.0... +Preprocessing library for I-0.1.0.0... +Building library for I-0.1.0.0... # Setup haddock -Preprocessing library for Includes2-0.1.0.0... -Running Haddock on library for Includes2-0.1.0.0... -Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/Includes2 +Preprocessing library for I-0.1.0.0... +Running Haddock on library for I-0.1.0.0... +Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/I # Setup copy Installing library in # Setup register -Registering library for Includes2-0.1.0.0... +Registering library for I-0.1.0.0... # Setup configure -Configuring executable 'exe' for Includes2-0.1.0.0... +Configuring executable 'exe' for I-0.1.0.0... # Setup build -Preprocessing executable 'exe' for Includes2-0.1.0.0... -Building executable 'exe' for Includes2-0.1.0.0... +Preprocessing executable 'exe' for I-0.1.0.0... +Building executable 'exe' for I-0.1.0.0... # Setup haddock -Preprocessing executable 'exe' for Includes2-0.1.0.0... +Preprocessing executable 'exe' for I-0.1.0.0... # Setup copy Installing executable exe in Warning: The directory /setup-per-component.dist/usr/bin is not in the system search path. diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-per-component.test.hs b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-per-component.test.hs index 5bbb1b02af2..b6034011a14 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-per-component.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-per-component.test.hs @@ -14,6 +14,6 @@ main = setupTest $ do "--instantiate-with", "Database=mysql-0.1.0.0:Database.MySQL"] setup_install' ["mylib", "--cid", "mylib-0.1.0.0", "--instantiate-with", "Database=postgresql-0.1.0.0:Database.PostgreSQL"] - setup_install' ["Includes2"] + setup_install' ["I"] setup_install' ["exe"] runExe' "exe" [] >>= assertOutputContains "minemysql minepostgresql" diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/Includes3.cabal b/cabal-testsuite/PackageTests/Backpack/Includes3/I.cabal similarity index 95% rename from cabal-testsuite/PackageTests/Backpack/Includes3/Includes3.cabal rename to cabal-testsuite/PackageTests/Backpack/Includes3/I.cabal index 7016e221218..ca17845e21d 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/Includes3.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/I.cabal @@ -1,4 +1,4 @@ -name: Includes3 +name: I version: 0.1.0.0 license: BSD3 author: Edward Z. Yang diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-external.test.hs b/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-external.test.hs index 80a4c47d068..6e6f017ee9f 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-external.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-external.test.hs @@ -1,9 +1,9 @@ import Test.Cabal.Prelude main = cabalTest $ do + ghcVer <- isGhcVersion ">= 9.10" skipUnlessGhcVersion ">= 8.1" - skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 - withProjectFile "cabal.external.project" $ do + expectBrokenIf (isWindows && ghcVer) 10191 $ withProjectFile "cabal.external.project" $ do cabal "v2-build" ["exe"] withPlan $ do r <- runPlanExe' "exe" "exe" [] diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-internal.out b/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-internal.out index 88b36e02c50..f7e2f2d75ef 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-internal.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-internal.out @@ -2,27 +2,27 @@ Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: - - Includes3-0.1.0.0 (lib:sigs) (first run) - - Includes3-0.1.0.0 (lib:indef) (first run) - - Includes3-0.1.0.0 (lib:indef with Data.Map=containers-:Data.Map) (first run) - - Includes3-0.1.0.0 (exe:exe) (first run) -Configuring library 'sigs' for Includes3-0.1.0.0... -Preprocessing library 'sigs' for Includes3-0.1.0.0... + - I-0.1.0.0 (lib:sigs) (first run) + - I-0.1.0.0 (lib:indef) (first run) + - I-0.1.0.0 (lib:indef with Data.Map=containers-:Data.Map) (first run) + - I-0.1.0.0 (exe:exe) (first run) +Configuring library 'sigs' for I-0.1.0.0... +Preprocessing library 'sigs' for I-0.1.0.0... Building library 'sigs' instantiated with Data.Map = -for Includes3-0.1.0.0... -Configuring library 'indef' for Includes3-0.1.0.0... -Preprocessing library 'indef' for Includes3-0.1.0.0... +for I-0.1.0.0... +Configuring library 'indef' for I-0.1.0.0... +Preprocessing library 'indef' for I-0.1.0.0... Building library 'indef' instantiated with Data.Map = -for Includes3-0.1.0.0... +for I-0.1.0.0... Configuring library 'indef' instantiated with Data.Map = containers-:Data.Map -for Includes3-0.1.0.0... -Preprocessing library 'indef' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'indef' for I-0.1.0.0... Building library 'indef' instantiated with Data.Map = containers-:Data.Map -for Includes3-0.1.0.0... -Configuring executable 'exe' for Includes3-0.1.0.0... -Preprocessing executable 'exe' for Includes3-0.1.0.0... -Building executable 'exe' for Includes3-0.1.0.0... -# Includes3 exe +for I-0.1.0.0... +Configuring executable 'exe' for I-0.1.0.0... +Preprocessing executable 'exe' for I-0.1.0.0... +Building executable 'exe' for I-0.1.0.0... +# I exe fromList [(0,2),(2,4)] diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-internal.test.hs b/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-internal.test.hs index b247e56259a..cca3ecf2954 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-internal.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-internal.test.hs @@ -2,9 +2,8 @@ import Test.Cabal.Prelude main = cabalTest $ do skipUnlessGhcVersion ">= 8.1" - skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 - withProjectFile "cabal.internal.project" $ do + expectBrokenIf isWindows 10191 $ withProjectFile "cabal.internal.project" $ do cabal "v2-build" ["exe"] withPlan $ do - r <- runPlanExe' "Includes3" "exe" [] + r <- runPlanExe' "I" "exe" [] assertOutputContains "fromList [(0,2),(2,4)]" r diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-repo.test.hs b/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-repo.test.hs index 00e2aff3c84..03b74a01b9a 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-repo.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-repo.test.hs @@ -1,7 +1,6 @@ import Test.Cabal.Prelude main = cabalTest $ withShorterPathForNewBuildStore $ do skipUnlessGhcVersion ">= 8.1" - skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 withProjectFile "cabal.repo.project" $ do withRepo "repo" $ do cabal "v2-build" ["exe"] diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/setup-internal.cabal.out b/cabal-testsuite/PackageTests/Backpack/Includes3/setup-internal.cabal.out index ea300c9286d..9ac4463aa6e 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/setup-internal.cabal.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/setup-internal.cabal.out @@ -1,18 +1,18 @@ # Setup configure -Configuring Includes3-0.1.0.0... +Configuring I-0.1.0.0... # Setup build -Preprocessing library 'sigs' for Includes3-0.1.0.0... +Preprocessing library 'sigs' for I-0.1.0.0... Building library 'sigs' instantiated with Data.Map = -for Includes3-0.1.0.0... -Preprocessing library 'indef' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'indef' for I-0.1.0.0... Building library 'indef' instantiated with Data.Map = -for Includes3-0.1.0.0... -Preprocessing library 'indef' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'indef' for I-0.1.0.0... Building library 'indef' instantiated with Data.Map = containers-:Data.Map -for Includes3-0.1.0.0... -Preprocessing executable 'exe' for Includes3-0.1.0.0... -Building executable 'exe' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing executable 'exe' for I-0.1.0.0... +Building executable 'exe' for I-0.1.0.0... # Setup copy Installing internal library sigs in Installing internal library indef in @@ -21,24 +21,24 @@ Installing executable exe in Warning: The directory /setup-internal.cabal.dist/usr/bin is not in the system search path. # Setup register Registering library 'sigs' instantiated with Data.Map = -for Includes3-0.1.0.0... +for I-0.1.0.0... Registering library 'indef' instantiated with Data.Map = -for Includes3-0.1.0.0... +for I-0.1.0.0... Registering library 'indef' instantiated with Data.Map = containers-:Data.Map -for Includes3-0.1.0.0... +for I-0.1.0.0... # Setup build -Preprocessing library 'sigs' for Includes3-0.1.0.0... +Preprocessing library 'sigs' for I-0.1.0.0... Building library 'sigs' instantiated with Data.Map = -for Includes3-0.1.0.0... -Preprocessing library 'indef' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'indef' for I-0.1.0.0... Building library 'indef' instantiated with Data.Map = -for Includes3-0.1.0.0... -Preprocessing library 'indef' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'indef' for I-0.1.0.0... Building library 'indef' instantiated with Data.Map = containers-:Data.Map -for Includes3-0.1.0.0... -Preprocessing executable 'exe' for Includes3-0.1.0.0... -Building executable 'exe' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing executable 'exe' for I-0.1.0.0... +Building executable 'exe' for I-0.1.0.0... # exe fromList [(0,2),(2,4)] diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/setup-internal.out b/cabal-testsuite/PackageTests/Backpack/Includes3/setup-internal.out index cb9caef57a7..6912ab117cd 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/setup-internal.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/setup-internal.out @@ -1,18 +1,18 @@ # Setup configure -Configuring Includes3-0.1.0.0... +Configuring I-0.1.0.0... # Setup build -Preprocessing library 'sigs' for Includes3-0.1.0.0... +Preprocessing library 'sigs' for I-0.1.0.0... Building library 'sigs' instantiated with Data.Map = -for Includes3-0.1.0.0... -Preprocessing library 'indef' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'indef' for I-0.1.0.0... Building library 'indef' instantiated with Data.Map = -for Includes3-0.1.0.0... -Preprocessing library 'indef' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'indef' for I-0.1.0.0... Building library 'indef' instantiated with Data.Map = containers-:Data.Map -for Includes3-0.1.0.0... -Preprocessing executable 'exe' for Includes3-0.1.0.0... -Building executable 'exe' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing executable 'exe' for I-0.1.0.0... +Building executable 'exe' for I-0.1.0.0... # Setup copy Installing internal library sigs in Installing internal library indef in @@ -21,24 +21,24 @@ Installing executable exe in Warning: The directory /setup-internal.dist/usr/bin is not in the system search path. # Setup register Registering library 'sigs' instantiated with Data.Map = -for Includes3-0.1.0.0... +for I-0.1.0.0... Registering library 'indef' instantiated with Data.Map = -for Includes3-0.1.0.0... +for I-0.1.0.0... Registering library 'indef' instantiated with Data.Map = containers-:Data.Map -for Includes3-0.1.0.0... +for I-0.1.0.0... # Setup build -Preprocessing library 'sigs' for Includes3-0.1.0.0... +Preprocessing library 'sigs' for I-0.1.0.0... Building library 'sigs' instantiated with Data.Map = -for Includes3-0.1.0.0... -Preprocessing library 'indef' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'indef' for I-0.1.0.0... Building library 'indef' instantiated with Data.Map = -for Includes3-0.1.0.0... -Preprocessing library 'indef' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'indef' for I-0.1.0.0... Building library 'indef' instantiated with Data.Map = containers-:Data.Map -for Includes3-0.1.0.0... -Preprocessing executable 'exe' for Includes3-0.1.0.0... -Building executable 'exe' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing executable 'exe' for I-0.1.0.0... +Building executable 'exe' for I-0.1.0.0... # exe fromList [(0,2),(2,4)] diff --git a/cabal-testsuite/PackageTests/Backpack/T6385/cabal.test.hs b/cabal-testsuite/PackageTests/Backpack/T6385/cabal.test.hs index 0a31702615c..930a61bb54e 100644 --- a/cabal-testsuite/PackageTests/Backpack/T6385/cabal.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/T6385/cabal.test.hs @@ -1,7 +1,6 @@ import Test.Cabal.Prelude main = - cabalTest $ withShorterPathForNewBuildStore $ do + cabalTest $ expectBrokenIf isWindows 10191 $ withShorterPathForNewBuildStore $ do skipUnlessGhcVersion ">= 8.1" - skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 withRepo "repo" $ do cabal "v2-build" ["T6385"] diff --git a/cabal-testsuite/PackageTests/Backpack/bkpcabal01/bkpcabal01.cabal b/cabal-testsuite/PackageTests/Backpack/bkpcabal01/b.cabal similarity index 96% rename from cabal-testsuite/PackageTests/Backpack/bkpcabal01/bkpcabal01.cabal rename to cabal-testsuite/PackageTests/Backpack/bkpcabal01/b.cabal index f10d1aad151..f1e92112a1f 100644 --- a/cabal-testsuite/PackageTests/Backpack/bkpcabal01/bkpcabal01.cabal +++ b/cabal-testsuite/PackageTests/Backpack/bkpcabal01/b.cabal @@ -1,5 +1,5 @@ cabal-version: 2.0 -name: bkpcabal01 +name: b version: 0.1.0.0 description: This test also exists in GHC's test-suite under the same name and was ported over to cabal's testsuite as it exposed a diff --git a/cabal-testsuite/PackageTests/Backpack/bkpcabal01/cabal.out b/cabal-testsuite/PackageTests/Backpack/bkpcabal01/cabal.out index 4630087ccc2..3ebec1cc5c1 100644 --- a/cabal-testsuite/PackageTests/Backpack/bkpcabal01/cabal.out +++ b/cabal-testsuite/PackageTests/Backpack/bkpcabal01/cabal.out @@ -2,33 +2,33 @@ Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: - - bkpcabal01-0.1.0.0 (lib:impl) (first run) - - bkpcabal01-0.1.0.0 (lib:p) (first run) - - bkpcabal01-0.1.0.0 (lib:p with H=bkpcabal01-0.1.0.0-inplace-impl:H) (first run) - - bkpcabal01-0.1.0.0 (lib:q) (first run) - - bkpcabal01-0.1.0.0 (lib:q with I=bkpcabal01-0.1.0.0-inplace-impl:I) (first run) - - bkpcabal01-0.1.0.0 (exe:exe) (first run) -Configuring library 'impl' for bkpcabal01-0.1.0.0... -Preprocessing library 'impl' for bkpcabal01-0.1.0.0... -Building library 'impl' for bkpcabal01-0.1.0.0... -Configuring library 'p' for bkpcabal01-0.1.0.0... -Preprocessing library 'p' for bkpcabal01-0.1.0.0... + - b-0.1.0.0 (lib:impl) (first run) + - b-0.1.0.0 (lib:p) (first run) + - b-0.1.0.0 (lib:p with H=b-0.1.0.0-inplace-impl:H) (first run) + - b-0.1.0.0 (lib:q) (first run) + - b-0.1.0.0 (lib:q with I=b-0.1.0.0-inplace-impl:I) (first run) + - b-0.1.0.0 (exe:exe) (first run) +Configuring library 'impl' for b-0.1.0.0... +Preprocessing library 'impl' for b-0.1.0.0... +Building library 'impl' for b-0.1.0.0... +Configuring library 'p' for b-0.1.0.0... +Preprocessing library 'p' for b-0.1.0.0... Building library 'p' instantiated with H = -for bkpcabal01-0.1.0.0... -Configuring library 'p' instantiated with H = bkpcabal01-0.1.0.0-inplace-impl:H -for bkpcabal01-0.1.0.0... -Preprocessing library 'p' for bkpcabal01-0.1.0.0... -Building library 'p' instantiated with H = bkpcabal01-0.1.0.0-inplace-impl:H -for bkpcabal01-0.1.0.0... -Configuring library 'q' for bkpcabal01-0.1.0.0... -Preprocessing library 'q' for bkpcabal01-0.1.0.0... +for b-0.1.0.0... +Configuring library 'p' instantiated with H = b-0.1.0.0-inplace-impl:H +for b-0.1.0.0... +Preprocessing library 'p' for b-0.1.0.0... +Building library 'p' instantiated with H = b-0.1.0.0-inplace-impl:H +for b-0.1.0.0... +Configuring library 'q' for b-0.1.0.0... +Preprocessing library 'q' for b-0.1.0.0... Building library 'q' instantiated with I = -for bkpcabal01-0.1.0.0... -Configuring library 'q' instantiated with I = bkpcabal01-0.1.0.0-inplace-impl:I -for bkpcabal01-0.1.0.0... -Preprocessing library 'q' for bkpcabal01-0.1.0.0... -Building library 'q' instantiated with I = bkpcabal01-0.1.0.0-inplace-impl:I -for bkpcabal01-0.1.0.0... -Configuring executable 'exe' for bkpcabal01-0.1.0.0... -Preprocessing executable 'exe' for bkpcabal01-0.1.0.0... -Building executable 'exe' for bkpcabal01-0.1.0.0... +for b-0.1.0.0... +Configuring library 'q' instantiated with I = b-0.1.0.0-inplace-impl:I +for b-0.1.0.0... +Preprocessing library 'q' for b-0.1.0.0... +Building library 'q' instantiated with I = b-0.1.0.0-inplace-impl:I +for b-0.1.0.0... +Configuring executable 'exe' for b-0.1.0.0... +Preprocessing executable 'exe' for b-0.1.0.0... +Building executable 'exe' for b-0.1.0.0... diff --git a/cabal-testsuite/PackageTests/Backpack/bkpcabal01/cabal.test.hs b/cabal-testsuite/PackageTests/Backpack/bkpcabal01/cabal.test.hs index 5a30f6a867a..0f1b7544e07 100644 --- a/cabal-testsuite/PackageTests/Backpack/bkpcabal01/cabal.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/bkpcabal01/cabal.test.hs @@ -1,6 +1,6 @@ import Test.Cabal.Prelude -main = cabalTest $ do +main = do + cabalTest $ do -- GHC 8.2.2 had a regression ("unknown package: hole"), see also #4908 skipUnlessGhcVersion ">= 8.2 && <8.2.2 || >8.2.2" - skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 cabal "v2-build" ["all"] diff --git a/cabal-testsuite/PackageTests/BuildTools/Foreign/A.hs b/cabal-testsuite/PackageTests/BuildTools/Foreign/A.hs index eae7f4476f3..45fc0ecfe9e 100644 --- a/cabal-testsuite/PackageTests/BuildTools/Foreign/A.hs +++ b/cabal-testsuite/PackageTests/BuildTools/Foreign/A.hs @@ -1,4 +1,9 @@ +{-# LANGUAGE CPP #-} +#if mingw32_HOST_OS +{-# OPTIONS_GHC -F -pgmF my-foreign-preprocessor.bat #-} +#else {-# OPTIONS_GHC -F -pgmF my-foreign-preprocessor #-} +#endif module A where a :: String diff --git a/cabal-testsuite/PackageTests/BuildTools/Foreign/my-foreign-preprocessor.bat b/cabal-testsuite/PackageTests/BuildTools/Foreign/my-foreign-preprocessor.bat new file mode 100644 index 00000000000..51e58f1b40c --- /dev/null +++ b/cabal-testsuite/PackageTests/BuildTools/Foreign/my-foreign-preprocessor.bat @@ -0,0 +1,2 @@ +echo @off +pwsh my-foreign-preprocessor.ps1 %1 %2 %3 diff --git a/cabal-testsuite/PackageTests/BuildTools/Foreign/my-foreign-preprocessor.ps1 b/cabal-testsuite/PackageTests/BuildTools/Foreign/my-foreign-preprocessor.ps1 new file mode 100644 index 00000000000..1bb89bcc1b8 --- /dev/null +++ b/cabal-testsuite/PackageTests/BuildTools/Foreign/my-foreign-preprocessor.ps1 @@ -0,0 +1 @@ +get-content $args[1] | %{$_ -replace "0","1"} > $args[2] diff --git a/cabal-testsuite/PackageTests/BuildTools/Foreign/setup.test.hs b/cabal-testsuite/PackageTests/BuildTools/Foreign/setup.test.hs index 9860683f7b0..b698f579f93 100644 --- a/cabal-testsuite/PackageTests/BuildTools/Foreign/setup.test.hs +++ b/cabal-testsuite/PackageTests/BuildTools/Foreign/setup.test.hs @@ -5,9 +5,7 @@ import Control.Monad.IO.Class import System.Environment -- Test PATH-munging --- TODO: Enable this test on Windows main = setupAndCabalTest $ do - skipIfWindows path <- liftIO $ getEnv "PATH" cwd <- testCurrentDir <$> getTestEnv r <- withEnv [("PATH", Just $ cwd ++ ":" ++ path)] $ setup_build [] diff --git a/cabal-testsuite/PackageTests/CCompilerOverride/setup.test.hs b/cabal-testsuite/PackageTests/CCompilerOverride/setup.test.hs index b4f7f04ddb1..7cdb7c75287 100644 --- a/cabal-testsuite/PackageTests/CCompilerOverride/setup.test.hs +++ b/cabal-testsuite/PackageTests/CCompilerOverride/setup.test.hs @@ -9,13 +9,12 @@ import Test.Cabal.Prelude -- https://gitlab.haskell.org/ghc/ghc/-/commit/8ff3134ed4aa323b0199ad683f72165e51a59ab6 main = setupAndCabalTest $ do skipUnlessGhcVersion ">= 8.8" - isWin <- isWindows ghc94 <- isGhcVersion ">= 9.4.1" env <- getTestEnv let pwd = testCurrentDir env win_suffix = if ghc94 then "-clang.bat" else ".bat" customCC = - pwd ++ "/custom-cc" ++ if isWin then win_suffix else "" + pwd ++ "/custom-cc" ++ if isWindows then win_suffix else "" setup "configure" [ "--ghc-option=-optc=-DNOERROR2" diff --git a/cabal-testsuite/PackageTests/Check/ConfiguredPackage/Paths/InvalidWin/cabal.test.hs b/cabal-testsuite/PackageTests/Check/ConfiguredPackage/Paths/InvalidWin/cabal.test.hs index 2201d7c73dc..12398950ed9 100644 --- a/cabal-testsuite/PackageTests/Check/ConfiguredPackage/Paths/InvalidWin/cabal.test.hs +++ b/cabal-testsuite/PackageTests/Check/ConfiguredPackage/Paths/InvalidWin/cabal.test.hs @@ -3,11 +3,12 @@ import Test.Cabal.Prelude import System.Directory (createDirectoryIfMissing) -- Invalid Windows filepath. -main = cabalTest $ do - skipIfWindows - cwd <- testCurrentDir <$> getTestEnv - liftIO $ createDirectoryIfMissing False $ cwd "n?ul" - liftIO $ writeFile (cwd "n?ul" "test.a") "" - -- A directory named like `n?ul` on Windows will make external - -- tools like git — and hence the whole testsuite — error. - fails $ cabal "check" [] +main = do + -- A directory named like `n?ul` on Windows will make external + -- tools like git — and hence the whole testsuite — error. + skipIfWindows "uninteresting" + cabalTest $ do + cwd <- testCurrentDir <$> getTestEnv + liftIO $ createDirectoryIfMissing False $ cwd "n?ul" + liftIO $ writeFile (cwd "n?ul" "test.a") "" + fails $ cabal "check" [] diff --git a/cabal-testsuite/PackageTests/CmmSourcesDyn/cabal.test.hs b/cabal-testsuite/PackageTests/CmmSourcesDyn/cabal.test.hs index ee8aa155ac2..0e39257c843 100644 --- a/cabal-testsuite/PackageTests/CmmSourcesDyn/cabal.test.hs +++ b/cabal-testsuite/PackageTests/CmmSourcesDyn/cabal.test.hs @@ -1,7 +1,7 @@ import Test.Cabal.Prelude main = cabalTest $ do - skipIfWindows + skipIfNoSharedLibraries res <- cabal' "v2-run" ["demo"] assertOutputContains "= Post common block elimination =" res assertOutputContains "In Box we have 0x" res diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs index f0ba4299c7a..c1aea47ce85 100644 --- a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs @@ -1,5 +1,8 @@ import Test.Cabal.Prelude +normalizeWindowsOutput :: String -> String +normalizeWindowsOutput = if isWindows then map (\x -> case x of '/' -> '\\'; _ -> x) else id + main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do let log = recordHeader . pure @@ -76,7 +79,7 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do -- +-- etc log "checking that cyclical check catches a same file name that imports itself" cyclical4a <- fails $ cabal' "v2-build" [ "--project-file=cyclical-same-filename-out-out-self.project" ] - assertOutputContains "cyclical import of same-filename/cyclical-same-filename-out-out-self.config" cyclical4a + assertOutputContains (normalizeWindowsOutput "cyclical import of same-filename/cyclical-same-filename-out-out-self.config") cyclical4a -- +-- cyclical-same-filename-out-out-backback.project -- +-- cyclical-same-filename-out-out-backback.config @@ -112,31 +115,31 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do assertOutputContains "- hops-0.project" hopping assertOutputContains - "- hops-2.config \ + (normalizeWindowsOutput "- hops-2.config \ \ imported by: hops/hops-1.config \ - \ imported by: hops-0.project" + \ imported by: hops-0.project") hopping assertOutputContains - "- hops-4.config \ + (normalizeWindowsOutput "- hops-4.config \ \ imported by: hops/hops-3.config \ \ imported by: hops-2.config \ \ imported by: hops/hops-1.config \ - \ imported by: hops-0.project" + \ imported by: hops-0.project") hopping assertOutputContains - "- hops-6.config \ + (normalizeWindowsOutput "- hops-6.config \ \ imported by: hops/hops-5.config \ \ imported by: hops-4.config \ \ imported by: hops/hops-3.config \ \ imported by: hops-2.config \ \ imported by: hops/hops-1.config \ - \ imported by: hops-0.project" + \ imported by: hops-0.project") hopping assertOutputContains - "- hops-8.config \ + (normalizeWindowsOutput "- hops-8.config \ \ imported by: hops/hops-7.config \ \ imported by: hops-6.config \ \ imported by: hops/hops-5.config \ @@ -144,43 +147,43 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do \ imported by: hops/hops-3.config \ \ imported by: hops-2.config \ \ imported by: hops/hops-1.config \ - \ imported by: hops-0.project" + \ imported by: hops-0.project") hopping assertOutputContains - "- hops/hops-1.config \ - \ imported by: hops-0.project" + (normalizeWindowsOutput "- hops/hops-1.config \ + \ imported by: hops-0.project") hopping assertOutputContains - "- hops/hops-3.config \ + (normalizeWindowsOutput "- hops/hops-3.config \ \ imported by: hops-2.config \ \ imported by: hops/hops-1.config \ - \ imported by: hops-0.project" + \ imported by: hops-0.project") hopping assertOutputContains - "- hops/hops-5.config \ + (normalizeWindowsOutput "- hops/hops-5.config \ \ imported by: hops-4.config \ \ imported by: hops/hops-3.config \ \ imported by: hops-2.config \ \ imported by: hops/hops-1.config \ - \ imported by: hops-0.project" + \ imported by: hops-0.project") hopping assertOutputContains - "- hops/hops-7.config \ + (normalizeWindowsOutput "- hops/hops-7.config \ \ imported by: hops-6.config \ \ imported by: hops/hops-5.config \ \ imported by: hops-4.config \ \ imported by: hops/hops-3.config \ \ imported by: hops-2.config \ \ imported by: hops/hops-1.config \ - \ imported by: hops-0.project" + \ imported by: hops-0.project") hopping assertOutputContains - "- hops/hops-9.config \ + (normalizeWindowsOutput "- hops/hops-9.config \ \ imported by: hops-8.config \ \ imported by: hops/hops-7.config \ \ imported by: hops-6.config \ @@ -189,7 +192,7 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do \ imported by: hops/hops-3.config \ \ imported by: hops-2.config \ \ imported by: hops/hops-1.config \ - \ imported by: hops-0.project" + \ imported by: hops-0.project") hopping -- The project is named oops as it is like hops but has conflicting constraints. @@ -210,7 +213,7 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do assertOutputContains "(constraint from oops-0.project requires ==1.4.3.0)" oopsing assertOutputContains - " (constraint from oops/oops-9.config requires ==1.4.2.0) \ + (normalizeWindowsOutput " (constraint from oops/oops-9.config requires ==1.4.2.0) \ \ imported by: oops-8.config \ \ imported by: oops/oops-7.config \ \ imported by: oops-6.config \ @@ -219,7 +222,7 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do \ imported by: oops/oops-3.config \ \ imported by: oops-2.config \ \ imported by: oops/oops-1.config \ - \ imported by: oops-0.project" + \ imported by: oops-0.project") oopsing log "checking bad conditional" @@ -229,12 +232,12 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do log "checking that missing package message lists configuration provenance" missing <- fails $ cabal' "v2-build" [ "--project-file=cabal-missing-package.project" ] assertOutputContains - "When using configuration from: \ + (normalizeWindowsOutput "When using configuration from: \ \ - cabal-missing-package.project \ \ - missing/pkgs.config \ \ - missing/pkgs/default.config \ \The following errors occurred: \ - \ - The package location 'pkg-doesnt-exist' does not exist." + \ - The package location 'pkg-doesnt-exist' does not exist.") missing return () diff --git a/cabal-testsuite/PackageTests/CustomSegfault/cabal.test.hs b/cabal-testsuite/PackageTests/CustomSegfault/cabal.test.hs index a6c74dab745..b543cc5de45 100644 --- a/cabal-testsuite/PackageTests/CustomSegfault/cabal.test.hs +++ b/cabal-testsuite/PackageTests/CustomSegfault/cabal.test.hs @@ -1,6 +1,5 @@ import Test.Cabal.Prelude main = cabalTest $ do - -- TODO: this test ought to work on Windows too - skipUnless "not Linux" =<< isLinux + skipUnless "depends on `unix` and needs Linux" isLinux skipUnlessGhcVersion ">= 7.8" fails $ cabal' "v2-build" [] >>= assertOutputContains "SIGSEGV" diff --git a/cabal-testsuite/PackageTests/ExtraProgPath/setup.test.hs b/cabal-testsuite/PackageTests/ExtraProgPath/setup.test.hs index 80ee56f6287..ecc6696c1f2 100644 --- a/cabal-testsuite/PackageTests/ExtraProgPath/setup.test.hs +++ b/cabal-testsuite/PackageTests/ExtraProgPath/setup.test.hs @@ -1,8 +1,8 @@ import Test.Cabal.Prelude -- Test that extra-prog-path overrides the path for pkg-config -main = cabalTest $ do - -- skipped on windows because using a script to dummy up an executable doesn't work the same. - skipIfWindows - cdir <- testCurrentDir `fmap` getTestEnv - fails $ cabal "v2-build" ["--extra-prog-path="++cdir] +main = do + skipIfWindows "useless test (CI has no pkg-config already)" + cabalTest $ do + cdir <- testCurrentDir `fmap` getTestEnv + fails $ cabal "v2-build" ["--extra-prog-path="++cdir] diff --git a/cabal-testsuite/PackageTests/ForeignLibs/setup.test.hs b/cabal-testsuite/PackageTests/ForeignLibs/setup.test.hs index 1dcf918eaed..73d02e90987 100644 --- a/cabal-testsuite/PackageTests/ForeignLibs/setup.test.hs +++ b/cabal-testsuite/PackageTests/ForeignLibs/setup.test.hs @@ -27,9 +27,8 @@ import Test.Cabal.Prelude main = setupAndCabalTest . recordMode DoNotRecord $ do -- Foreign libraries don't work with GHC 7.6 and earlier skipUnlessGhcVersion ">= 7.8" - win <- isWindows ghc94 <- isGhcVersion ">= 9.4.1" - expectBrokenIf (win && ghc94) 8451 $ + expectBrokenIf (isWindows && ghc94) 8451 $ withPackageDb $ do setup_install [] setup "copy" [] -- regression test #4156 diff --git a/cabal-testsuite/PackageTests/GHCJS/BuildRunner/cabal.test.hs b/cabal-testsuite/PackageTests/GHCJS/BuildRunner/cabal.test.hs index fd7328da0c2..18fa0d364fe 100644 --- a/cabal-testsuite/PackageTests/GHCJS/BuildRunner/cabal.test.hs +++ b/cabal-testsuite/PackageTests/GHCJS/BuildRunner/cabal.test.hs @@ -1,7 +1,7 @@ import Test.Cabal.Prelude -main = cabalTest . recordMode DoNotRecord $ do - skipIfWindows -- disabled because (I presume) Windows doesn't have BASH +main = do + cabalTest . expectBrokenIf isWindows 10179 . recordMode DoNotRecord $ do cwd <- fmap testCurrentDir getTestEnv testInvokedWithBuildRunner cwd "test" [] testInvokedWithBuildRunner cwd "run" ["ghcjs-exe"] diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectory/setup.test.hs b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectory/setup.test.hs index 85b30b87523..0f0e86a3c60 100644 --- a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectory/setup.test.hs +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectory/setup.test.hs @@ -1,10 +1,9 @@ import Test.Cabal.Prelude --- TODO: Enable this test on Windows -main = setupAndCabalTest $ do - skipIfWindows - env <- getTestEnv - let cwd = testCurrentDir env - ghc_path <- programPathM ghcProgram - r <- withEnv [("WITH_GHC", Just ghc_path)] - . fails $ setup' "configure" ["-w", cwd "ghc"] - assertOutputContains "is version 9999999" r + +main = setupAndCabalTest $ expectBrokenIf isWindows 10179 $ do + env <- getTestEnv + let cwd = testCurrentDir env + ghc_path <- programPathM ghcProgram + r <- withEnv [("WITH_GHC", Just ghc_path)] + . fails $ setup' "configure" ["-w", cwd "ghc"] + assertOutputContains "is version 9999999" r diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryGhcVersion/setup.test.hs b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryGhcVersion/setup.test.hs index 746c8015fca..20a661437bf 100644 --- a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryGhcVersion/setup.test.hs +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryGhcVersion/setup.test.hs @@ -1,10 +1,9 @@ import Test.Cabal.Prelude --- TODO: Enable this test on Windows -main = setupAndCabalTest $ do - skipIfWindows - env <- getTestEnv - let cwd = testCurrentDir env - ghc_path <- programPathM ghcProgram - r <- withEnv [("WITH_GHC", Just ghc_path)] - . fails $ setup' "configure" ["-w", cwd "ghc-7.10"] - assertOutputContains "is version 9999999" r + +main = setupAndCabalTest $ expectBrokenIf isWindows 10179 $ do + env <- getTestEnv + let cwd = testCurrentDir env + ghc_path <- programPathM ghcProgram + r <- withEnv [("WITH_GHC", Just ghc_path)] + . fails $ setup' "configure" ["-w", cwd "ghc-7.10"] + assertOutputContains "is version 9999999" r diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryVersion/setup.test.hs b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryVersion/setup.test.hs index 746c8015fca..20a661437bf 100644 --- a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryVersion/setup.test.hs +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryVersion/setup.test.hs @@ -1,10 +1,9 @@ import Test.Cabal.Prelude --- TODO: Enable this test on Windows -main = setupAndCabalTest $ do - skipIfWindows - env <- getTestEnv - let cwd = testCurrentDir env - ghc_path <- programPathM ghcProgram - r <- withEnv [("WITH_GHC", Just ghc_path)] - . fails $ setup' "configure" ["-w", cwd "ghc-7.10"] - assertOutputContains "is version 9999999" r + +main = setupAndCabalTest $ expectBrokenIf isWindows 10179 $ do + env <- getTestEnv + let cwd = testCurrentDir env + ghc_path <- programPathM ghcProgram + r <- withEnv [("WITH_GHC", Just ghc_path)] + . fails $ setup' "configure" ["-w", cwd "ghc-7.10"] + assertOutputContains "is version 9999999" r diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/Symlink/setup.test.hs b/cabal-testsuite/PackageTests/GhcPkgGuess/Symlink/setup.test.hs index eab35100802..18cb32829b1 100644 --- a/cabal-testsuite/PackageTests/GhcPkgGuess/Symlink/setup.test.hs +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/Symlink/setup.test.hs @@ -1,7 +1,6 @@ import Test.Cabal.Prelude --- TODO: Enable this test on Windows -main = setupAndCabalTest $ do - skipIfWindows + +main = setupAndCabalTest $ expectBrokenIf isWindows 10179 $ do withSymlink "bin/ghc" "ghc" $ do env <- getTestEnv let cwd = testCurrentDir env diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkGhcVersion/setup.test.hs b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkGhcVersion/setup.test.hs index eb95044b941..7837f5f9f3b 100644 --- a/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkGhcVersion/setup.test.hs +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkGhcVersion/setup.test.hs @@ -1,7 +1,6 @@ import Test.Cabal.Prelude --- TODO: Enable this test on Windows -main = setupAndCabalTest $ do - skipIfWindows + +main = setupAndCabalTest $ expectBrokenIf isWindows 10179 $ do withSymlink "bin/ghc-7.10" "ghc" $ do env <- getTestEnv let cwd = testCurrentDir env diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkVersion/setup.test.hs b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkVersion/setup.test.hs index eb95044b941..7837f5f9f3b 100644 --- a/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkVersion/setup.test.hs +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkVersion/setup.test.hs @@ -1,7 +1,6 @@ import Test.Cabal.Prelude --- TODO: Enable this test on Windows -main = setupAndCabalTest $ do - skipIfWindows + +main = setupAndCabalTest $ expectBrokenIf isWindows 10179 $ do withSymlink "bin/ghc-7.10" "ghc" $ do env <- getTestEnv let cwd = testCurrentDir env diff --git a/cabal-testsuite/PackageTests/HaddockKeepsTmps/cabal.test.hs b/cabal-testsuite/PackageTests/HaddockKeepsTmps/cabal.test.hs index 9a3dfe1777b..a4db6795625 100644 --- a/cabal-testsuite/PackageTests/HaddockKeepsTmps/cabal.test.hs +++ b/cabal-testsuite/PackageTests/HaddockKeepsTmps/cabal.test.hs @@ -1,20 +1,21 @@ {-# LANGUAGE LambdaCase #-} import Test.Cabal.Prelude +import Data.List (sort) import Distribution.Verbosity import Distribution.Simple.Glob import Distribution.Simple.Glob.Internal +import Distribution.Simple.Utils -- Test that "cabal haddock" preserves temporary files -- We use haddock-keep-temp-file: True in the cabal.project. -main = cabalTest $ recordMode DoNotRecord $ do - skipIfWindows +main = cabalTest $ recordMode DoNotRecord $ withProjectFile "cabal.project" $ do + cabal "haddock" [] - cabal "haddock" [] + cwd <- fmap testCurrentDir getTestEnv - cwd <- fmap testCurrentDir getTestEnv - - (globMatches <$> liftIO (runDirFileGlob silent Nothing cwd (GlobDirRecursive [WildCard, Literal "response", WildCard, Literal "txt"]))) >>= \case - [] -> error "Expecting a response file to exist" - (m:_) -> - -- Assert the matched response file is not empty. - assertFileDoesContain (cwd m) "Simple.hs" + -- Windows has multiple response files, and only the last one (alphabetically) is the important one. + (safeLast . sort . globMatches <$> liftIO (runDirFileGlob silent Nothing cwd (GlobDirRecursive [WildCard, Literal "txt"]))) >>= \case + Nothing -> error "Expecting a response file to exist" + Just m -> do + -- Assert the matched response file is not empty, and indeed a haddock rsp + assertFileDoesContain (cwd m) "--package-name" diff --git a/cabal-testsuite/PackageTests/InternalLibraries/Executable/setup-static.test.hs b/cabal-testsuite/PackageTests/InternalLibraries/Executable/setup-static.test.hs index e84be709823..1c12fd03a7a 100644 --- a/cabal-testsuite/PackageTests/InternalLibraries/Executable/setup-static.test.hs +++ b/cabal-testsuite/PackageTests/InternalLibraries/Executable/setup-static.test.hs @@ -24,7 +24,7 @@ import System.Directory -- this does build shared libraries just to make sure they -- don't get installed, so this test doesn't work on Windows.) main = setupAndCabalTest $ do - skipUnless "no shared libs" =<< hasSharedLibraries + skipIfNoSharedLibraries withPackageDb $ do -- MULTI forM_ [False, True] $ \is_dynamic -> do diff --git a/cabal-testsuite/PackageTests/InternalLibraries/setup-gen-script.test.hs b/cabal-testsuite/PackageTests/InternalLibraries/setup-gen-script.test.hs index 644d437b8ab..ada96fc159a 100644 --- a/cabal-testsuite/PackageTests/InternalLibraries/setup-gen-script.test.hs +++ b/cabal-testsuite/PackageTests/InternalLibraries/setup-gen-script.test.hs @@ -1,13 +1,12 @@ import Test.Cabal.Prelude -- Test to see if --gen-script main = setupAndCabalTest $ do - is_windows <- isWindows withPackageDb $ do withDirectory "p" $ do setup_build [] setup "copy" [] setup "register" ["--gen-script"] - _ <- if is_windows + _ <- if isWindows then shell "cmd" ["/C", "register.bat"] else shell "sh" ["register.sh"] return () diff --git a/cabal-testsuite/PackageTests/JS/JsSources/js-arch.test.hs b/cabal-testsuite/PackageTests/JS/JsSources/js-arch.test.hs index 1fed749bdb8..2b318af6670 100644 --- a/cabal-testsuite/PackageTests/JS/JsSources/js-arch.test.hs +++ b/cabal-testsuite/PackageTests/JS/JsSources/js-arch.test.hs @@ -1,9 +1,9 @@ import Test.Cabal.Prelude -main = setupAndCabalTest $ do - skipUnlessGhcVersion ">= 9.6" +main = do skipUnlessJavaScript - skipIfWindows - - res <- cabal' "v2-run" ["demo"] - assertOutputContains "Hello JS!" res + skipIfWindows "" + setupAndCabalTest $ do + skipUnlessGhcVersion ">= 9.6" + res <- cabal' "v2-run" ["demo"] + assertOutputContains "Hello JS!" res diff --git a/cabal-testsuite/PackageTests/JS/JsSources/other-arch.test.hs b/cabal-testsuite/PackageTests/JS/JsSources/other-arch.test.hs index 187a9cf73bd..2e92eb1fcc5 100644 --- a/cabal-testsuite/PackageTests/JS/JsSources/other-arch.test.hs +++ b/cabal-testsuite/PackageTests/JS/JsSources/other-arch.test.hs @@ -1,7 +1,8 @@ import Test.Cabal.Prelude -main = cabalTest $ do +main = do skipIfJavaScript - -- Ensure the field `js-sources` does not raise issues - res <- cabal' "v2-run" ["demo"] - assertOutputContains "Hello Not JS!" res + cabalTest $ do + -- Ensure the field `js-sources` does not raise issues + res <- cabal' "v2-run" ["demo"] + assertOutputContains "Hello Not JS!" res diff --git a/cabal-testsuite/PackageTests/JS/JsSourcesExe/js-arch.test.hs b/cabal-testsuite/PackageTests/JS/JsSourcesExe/js-arch.test.hs index 1fed749bdb8..2b318af6670 100644 --- a/cabal-testsuite/PackageTests/JS/JsSourcesExe/js-arch.test.hs +++ b/cabal-testsuite/PackageTests/JS/JsSourcesExe/js-arch.test.hs @@ -1,9 +1,9 @@ import Test.Cabal.Prelude -main = setupAndCabalTest $ do - skipUnlessGhcVersion ">= 9.6" +main = do skipUnlessJavaScript - skipIfWindows - - res <- cabal' "v2-run" ["demo"] - assertOutputContains "Hello JS!" res + skipIfWindows "" + setupAndCabalTest $ do + skipUnlessGhcVersion ">= 9.6" + res <- cabal' "v2-run" ["demo"] + assertOutputContains "Hello JS!" res diff --git a/cabal-testsuite/PackageTests/JS/JsSourcesExe/other-arch.test.hs b/cabal-testsuite/PackageTests/JS/JsSourcesExe/other-arch.test.hs index 187a9cf73bd..2e92eb1fcc5 100644 --- a/cabal-testsuite/PackageTests/JS/JsSourcesExe/other-arch.test.hs +++ b/cabal-testsuite/PackageTests/JS/JsSourcesExe/other-arch.test.hs @@ -1,7 +1,8 @@ import Test.Cabal.Prelude -main = cabalTest $ do +main = do skipIfJavaScript - -- Ensure the field `js-sources` does not raise issues - res <- cabal' "v2-run" ["demo"] - assertOutputContains "Hello Not JS!" res + cabalTest $ do + -- Ensure the field `js-sources` does not raise issues + res <- cabal' "v2-run" ["demo"] + assertOutputContains "Hello Not JS!" res diff --git a/cabal-testsuite/PackageTests/LinkerOptions/NonignoredConfigs/cabal.test.hs b/cabal-testsuite/PackageTests/LinkerOptions/NonignoredConfigs/cabal.test.hs index 8e7c8a6391d..55ec5ee6144 100644 --- a/cabal-testsuite/PackageTests/LinkerOptions/NonignoredConfigs/cabal.test.hs +++ b/cabal-testsuite/PackageTests/LinkerOptions/NonignoredConfigs/cabal.test.hs @@ -52,14 +52,7 @@ lrun :: [Linking] lrun = [Static, Dynamic, Static, Dynamic] main = cabalTest $ do - -- Skip if on Windows, since my default Chocolatey Windows setup (and the CI - -- server setup at the time, presumably) lacks support for dynamic builds - -- since the base package appears to be static only, lacking e.g. ‘.dyn_o’ - -- files. Normal Windows installations would need support for dynamic - -- builds, or else this test would fail when it tries to build with the - -- dynamic flags. - skipIfWindows - + skipIfNoSharedLibraries env <- getTestEnv withPackageDb $ do -- Phase 1: get 4 hashes according to config flags. diff --git a/cabal-testsuite/PackageTests/LinkerOptions/T7339/setup.test.hs b/cabal-testsuite/PackageTests/LinkerOptions/T7339/setup.test.hs index a46921de895..233d3b20736 100644 --- a/cabal-testsuite/PackageTests/LinkerOptions/T7339/setup.test.hs +++ b/cabal-testsuite/PackageTests/LinkerOptions/T7339/setup.test.hs @@ -18,8 +18,7 @@ import Test.Cabal.Prelude main = setupTest $ do - - skipIfWindows + skipIfNoSharedLibraries skipUnlessGhcVersion ">= 8.4" withPackageDb $ do @@ -59,9 +58,9 @@ main = setupTest $ do pkgDb <- testPackageDbDir <$> getTestEnv ghciScript <- liftIO $ readFile (cwd "T19350.script") _ <- runProgramM ghcProgram - [ "--interactive" - , "-package", "T7339" - , "-package-db", pkgDb - ] (Just ghciScript) + [ "--interactive" + , "-package", "T7339" + , "-package-db", pkgDb + ] (Just ghciScript) return () diff --git a/cabal-testsuite/PackageTests/MultiRepl/EnabledSucc/cabal.test.hs b/cabal-testsuite/PackageTests/MultiRepl/EnabledSucc/cabal.test.hs index 7ea2f71ea49..5a8434c5467 100644 --- a/cabal-testsuite/PackageTests/MultiRepl/EnabledSucc/cabal.test.hs +++ b/cabal-testsuite/PackageTests/MultiRepl/EnabledSucc/cabal.test.hs @@ -3,6 +3,5 @@ import Test.Cabal.Prelude main = do cabalTest $ do skipUnlessGhcVersion ">= 9.4" - skipIfWindows -- heisenbug, see #9103 res <- cabalWithStdin "v2-repl" ["--enable-multi-repl","pkg-b", "pkg-a"] "Bar.bar" assertOutputContains "3735929054" res diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRun/Terminate/cabal.test.hs b/cabal-testsuite/PackageTests/NewBuild/CmdRun/Terminate/cabal.test.hs index 44f88c26656..8c3277174b8 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdRun/Terminate/cabal.test.hs +++ b/cabal-testsuite/PackageTests/NewBuild/CmdRun/Terminate/cabal.test.hs @@ -17,36 +17,36 @@ without forking in the future.) -} main :: IO () -main = cabalTest $ do - skipIfWindows -- test project relies on Posix +main = do + skipIfWindows "depends on `unix`" + cabalTest $ do + -- timestamped logging to aid with #8416 + let logIO msg = do + ts <- Time.getCurrentTime + let tsfmt = Time.formatTime Time.defaultTimeLocale "%H:%M:%S.%q" ts + putStrLn $ tsfmt <> " [cabal.test] " <> msg + log = liftIO . logIO - -- timestamped logging to aid with #8416 - let logIO msg = do - ts <- Time.getCurrentTime - let tsfmt = Time.formatTime Time.defaultTimeLocale "%H:%M:%S.%q" ts - putStrLn $ tsfmt <> " [cabal.test] " <> msg - log = liftIO . logIO + dir <- fmap testCurrentDir getTestEnv + let runFile = dir "exe.run" + liftIO $ removeFile runFile `catchNoExist` return () - dir <- fmap testCurrentDir getTestEnv - let runFile = dir "exe.run" - liftIO $ removeFile runFile `catchNoExist` return () + log "about to v2-build" + cabal_raw_action ["v2-build", "exe"] (\_ -> return ()) + log "about to v2-run" + r <- fails $ cabal_raw_action ["v2-run", "exe"] $ \cabalHandle -> do + -- wait for "cabal run" to have started "exe" + logIO "about to wait for file" + waitFile total runFile + -- then kill "cabal run" + logIO "about to terminate cabal" + Process.terminateProcess cabalHandle + log "v2-run done" - log "about to v2-build" - cabal_raw_action ["v2-build", "exe"] (\_ -> return ()) - log "about to v2-run" - r <- fails $ cabal_raw_action ["v2-run", "exe"] $ \cabalHandle -> do - -- wait for "cabal run" to have started "exe" - logIO "about to wait for file" - waitFile total runFile - -- then kill "cabal run" - logIO "about to terminate cabal" - Process.terminateProcess cabalHandle - log "v2-run done" - - -- "exe" should exit, and should have been interrupted before - -- finishing its sleep - assertOutputContains "exiting" r - assertOutputDoesNotContain "done sleeping" r + -- "exe" should exit, and should have been interrupted before + -- finishing its sleep + assertOutputContains "exiting" r + assertOutputDoesNotContain "done sleeping" r where catchNoExist action handle = diff --git a/cabal-testsuite/PackageTests/NewBuild/CustomSetup/RemotePackageWithCustomSetup/build-package-from-repo-with-custom-setup.test.hs b/cabal-testsuite/PackageTests/NewBuild/CustomSetup/RemotePackageWithCustomSetup/build-package-from-repo-with-custom-setup.test.hs index f3774f78cd7..114d3487e8e 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CustomSetup/RemotePackageWithCustomSetup/build-package-from-repo-with-custom-setup.test.hs +++ b/cabal-testsuite/PackageTests/NewBuild/CustomSetup/RemotePackageWithCustomSetup/build-package-from-repo-with-custom-setup.test.hs @@ -2,11 +2,7 @@ import Test.Cabal.Prelude -- The one local package, pkg, has a dependency on remote-pkg-2.0, which has a -- setup dependency on remote-setup-dep-3.0. -main = - cabalTest $ withShorterPathForNewBuildStore $ do - - -- TODO: Debug this failure on Windows. - skipIfWindows +main = cabalTest $ withShorterPathForNewBuildStore $ do skipUnless "no v2-build compatible boot-Cabal" =<< hasNewBuildCompatBootCabal withRepo "repo" $ do diff --git a/cabal-testsuite/PackageTests/NewBuild/T3827/cabal.test.hs b/cabal-testsuite/PackageTests/NewBuild/T3827/cabal.test.hs index f418538b074..93d28460c83 100644 --- a/cabal-testsuite/PackageTests/NewBuild/T3827/cabal.test.hs +++ b/cabal-testsuite/PackageTests/NewBuild/T3827/cabal.test.hs @@ -1,6 +1,4 @@ import Test.Cabal.Prelude main = cabalTest $ do - linux <- isLinux - osx <- isOSX - skipIf "8032 heisenbug profiling" (linux || osx) + skipIf "8032 heisenbug profiling" (isLinux || isOSX) cabal "v2-build" ["exe:q"] diff --git a/cabal-testsuite/PackageTests/NewFreeze/T9799b/src/None.hs b/cabal-testsuite/PackageTests/NewFreeze/T9799b/src/None.hs index f4c629a9329..e4aa4f2393a 100644 --- a/cabal-testsuite/PackageTests/NewFreeze/T9799b/src/None.hs +++ b/cabal-testsuite/PackageTests/NewFreeze/T9799b/src/None.hs @@ -3,8 +3,11 @@ module None where import MyLib import Language.Haskell.TH +import System.IO $(do - runIO $ putStrLn $ "Building: " ++ renamedVers + runIO $ do + putStrLn $ "Building: " ++ renamedVers + hFlush stdout [d| x = () |] ) diff --git a/cabal-testsuite/PackageTests/OfflineFlag/offlineFlag.test.hs b/cabal-testsuite/PackageTests/OfflineFlag/offlineFlag.test.hs index 7c9617a623c..00dc5c17ba6 100644 --- a/cabal-testsuite/PackageTests/OfflineFlag/offlineFlag.test.hs +++ b/cabal-testsuite/PackageTests/OfflineFlag/offlineFlag.test.hs @@ -3,7 +3,6 @@ import Test.Cabal.Prelude main = cabalTest $ withShorterPathForNewBuildStore $ do skipUnlessGhcVersion ">= 8.1" - skipIfWindows withProjectFile "cabal.repo.project" $ do withRepo "repo" $ do fails $ cabal "v2-build" ["current", "--offline"] diff --git a/cabal-testsuite/PackageTests/PathsModule/Executable-Relocatable/setup.test.hs b/cabal-testsuite/PackageTests/PathsModule/Executable-Relocatable/setup.test.hs index ea88c7f9e41..fab6c7c0a06 100644 --- a/cabal-testsuite/PackageTests/PathsModule/Executable-Relocatable/setup.test.hs +++ b/cabal-testsuite/PackageTests/PathsModule/Executable-Relocatable/setup.test.hs @@ -1,7 +1,8 @@ import Test.Cabal.Prelude -- Test that Paths module is generated and usable when relocatable is turned on. -main = setupAndCabalTest $ do - skipIfWindows - skipUnlessGhcVersion ">= 8.0" - withPackageDb $ setup_build ["--enable-relocatable"] +main = do + skipIfWindows "no relocatable builds" + setupAndCabalTest $ do + skipUnlessGhcVersion ">= 8.0" + withPackageDb $ setup_build ["--enable-relocatable"] diff --git a/cabal-testsuite/PackageTests/PkgConfigParse/setup.test.hs b/cabal-testsuite/PackageTests/PkgConfigParse/setup.test.hs index 0f860ab637a..7ccdfca1655 100644 --- a/cabal-testsuite/PackageTests/PkgConfigParse/setup.test.hs +++ b/cabal-testsuite/PackageTests/PkgConfigParse/setup.test.hs @@ -1,9 +1,7 @@ import Test.Cabal.Prelude -- Test that invalid unicode in pkg-config output doesn't trip up cabal very much -main = cabalTest $ do - -- skipped on windows because using a script to dummy up an executable doesn't work the same. - skipIfWindows +main = cabalTest $ expectBrokenIf isWindows 10179 $ do cdir <- testCurrentDir `fmap` getTestEnv res <- cabal' "v2-build" ["--extra-prog-path="++cdir, "-v2"] assertOutputContains "Some pkg-config packages have names containing invalid unicode: or" res diff --git a/cabal-testsuite/PackageTests/PreProcess/Hsc2HsOptionsCC/my.cabal b/cabal-testsuite/PackageTests/PreProcess/Hsc2HsOptionsCC/my.cabal index 6d195b52b44..a1f30e58d6c 100644 --- a/cabal-testsuite/PackageTests/PreProcess/Hsc2HsOptionsCC/my.cabal +++ b/cabal-testsuite/PackageTests/PreProcess/Hsc2HsOptionsCC/my.cabal @@ -11,4 +11,3 @@ executable my-executable main-is: Main.hs build-depends: base other-modules: Foo - hsc2hs-options: "--cc=g++" diff --git a/cabal-testsuite/PackageTests/PreProcess/Hsc2HsOptionsCC/setup.test.hs b/cabal-testsuite/PackageTests/PreProcess/Hsc2HsOptionsCC/setup.test.hs index 8dfca6d7d52..eb3a5eb255e 100644 --- a/cabal-testsuite/PackageTests/PreProcess/Hsc2HsOptionsCC/setup.test.hs +++ b/cabal-testsuite/PackageTests/PreProcess/Hsc2HsOptionsCC/setup.test.hs @@ -5,24 +5,34 @@ import System.Directory (findExecutable) -- Check that preprocessors (hsc2hs) are run main = setupAndCabalTest $ do - -- we need "g++" - hasGxx <- liftIO $ fmap isJust $ findExecutable "g++" - skipUnless "g++" hasGxx - - -- Figure out how recent GHC we need - -- https://github.com/msys2/MINGW-packages/issues/3531 - skipIfWindows + -- we need "g++" (or "clang++" in newer Windows) + ghcVer <- isGhcVersion ">= 9.4" + cc <- if isWindows + then + -- The mingw tools distributed with GHC are not usually on the + -- path so we specify the path to cc directly. + joinPath + . (++ ["mingw", "bin", if ghcVer then "clang++.exe" else "g++.exe"]) + . init + . splitPath + . resultOutput + <$> runProgramM ghcProgram ["--print-libdir"] Nothing + else do + hasGxx <- liftIO $ fmap isJust $ findExecutable "g++" + skipUnless "g++" hasGxx + pure "g++" -- we need recent enough hsc2hs -- hsc2hs commit 9671202c11f7fe98e5b96d379532b6f691dc46dd -- Fix when using g++ as C compiler. Patch from elaforge. Fixes ghc #7232 + -- We also require 0.68.8 so that last --cc is the one that applies. p <- requireProgramM hsc2hsProgram case programVersion p of - Nothing -> skip "Unknown hsc2hs version" - Just v | v < mkVersion [0,68] -> skip $ "hsc2hs version: " ++ prettyShow v ++ " < 0.68" - _ -> return () + Nothing -> skip "Unknown hsc2hs version" + Just v | v < mkVersion [0,68,8] -> skip $ "hsc2hs version: " ++ prettyShow v ++ " < 0.68.8" + _ -> return () -- Actual test - setup_build [] + setup_build ["--hsc2hs-options=\"--cc=" <> cc <> "\""] r <- runExe' "my-executable" [] assertOutputContains "Is not C, is C++" r diff --git a/cabal-testsuite/PackageTests/ProfShared/setup.test.hs b/cabal-testsuite/PackageTests/ProfShared/setup.test.hs index 754ff7a290d..84fcbd47e57 100644 --- a/cabal-testsuite/PackageTests/ProfShared/setup.test.hs +++ b/cabal-testsuite/PackageTests/ProfShared/setup.test.hs @@ -8,11 +8,9 @@ data BuildWay = StaticWay | DynWay | ProfWay | ProfDynWay -- Test building with profiling shared support main = do setupTest $ recordMode DoNotRecord $ do - has_prof_shared <- hasProfiledSharedLibraries - has_shared <- hasSharedLibraries -- Tests are not robust against missing dynamic libraries yet. Would -- be better to fix this. - skipUnless "Missing shared libraries" has_shared + skipIfNoSharedLibraries let analyse_result expected r = do @@ -142,4 +140,3 @@ main = do run_cabal_test ["--enable-profiling", "--enable-executable-dynamic"] ([ProfDynWay, ProfWay, DynWay, StaticWay], [ProfDynWay]) run_cabal_test ["prof-shared", "--disable-library-profiling", "--enable-profiling", "--enable-executable-dynamic"] ([ProfDynWay, DynWay, StaticWay], []) - diff --git a/cabal-testsuite/PackageTests/QuasiQuotes/dynamic/setup.test.hs b/cabal-testsuite/PackageTests/QuasiQuotes/dynamic/setup.test.hs index 31309a46f0c..bbc850992fa 100644 --- a/cabal-testsuite/PackageTests/QuasiQuotes/dynamic/setup.test.hs +++ b/cabal-testsuite/PackageTests/QuasiQuotes/dynamic/setup.test.hs @@ -1,5 +1,5 @@ import Test.Cabal.Prelude -- Test building a dynamic library/executable which uses QuasiQuotes main = setupAndCabalTest $ do - skipUnless "no shared libs" =<< hasSharedLibraries + skipIfNoSharedLibraries setup_build ["--enable-shared", "--enable-executable-dynamic"] diff --git a/cabal-testsuite/PackageTests/Regression/T4025/setup.test.hs b/cabal-testsuite/PackageTests/Regression/T4025/setup.test.hs index 0ec5d068147..d6034c7c3f2 100644 --- a/cabal-testsuite/PackageTests/Regression/T4025/setup.test.hs +++ b/cabal-testsuite/PackageTests/Regression/T4025/setup.test.hs @@ -1,16 +1,15 @@ import Test.Cabal.Prelude -- Test that we don't accidentally add the inplace directory to --- an executable RPATH. Don't test on Windows, which doesn't --- support RPATH. -main = setupAndCabalTest $ do - skipIfWindows - osx <- isOSX - ghc <- isGhcVersion ">= 8.10.7" - expectBrokenIf (osx && ghc) 7610 $ do -- see also issue #7988 - setup "configure" ["--enable-executable-dynamic"] - setup "build" [] - -- This should fail as it we should NOT be able to find the - -- dynamic library for the internal library (since we didn't - -- install it). If we incorrectly encoded our local dist - -- dir in the RPATH, this will succeed. - recordMode DoNotRecord . fails $ runExe "exe" [] +-- an executable RPATH. +main = do + skipIfWindows "doesn't support RPATH" + setupAndCabalTest $ do + ghc <- isGhcVersion ">= 8.10.7" + expectBrokenIf (isOSX && ghc) 7610 $ do -- see also issue #7988 + setup "configure" ["--enable-executable-dynamic"] + setup "build" [] + -- This should fail as it we should NOT be able to find the + -- dynamic library for the internal library (since we didn't + -- install it). If we incorrectly encoded our local dist + -- dir in the RPATH, this will succeed. + recordMode DoNotRecord . fails $ runExe "exe" [] diff --git a/cabal-testsuite/PackageTests/Regression/T4270/setup.test.hs b/cabal-testsuite/PackageTests/Regression/T4270/setup.test.hs index 258dcc21e16..bd227b75f3e 100644 --- a/cabal-testsuite/PackageTests/Regression/T4270/setup.test.hs +++ b/cabal-testsuite/PackageTests/Regression/T4270/setup.test.hs @@ -4,10 +4,9 @@ import Test.Cabal.Prelude -- See https://github.com/haskell/cabal/issues/4270 main = setupAndCabalTest $ do skipIfAllCabalVersion "< 2.2" - skipUnless "no shared libs" =<< hasSharedLibraries + skipIfNoSharedLibraries skipUnless "no shared Cabal" =<< hasCabalShared ghc <- isGhcVersion "== 8.0.2" - osx <- isOSX - expectBrokenIf (osx && ghc) 8028 $ do + expectBrokenIf (isOSX && ghc) 8028 $ do setup_build ["--enable-tests", "--enable-executable-dynamic"] setup "test" [] diff --git a/cabal-testsuite/PackageTests/Regression/T4291/setup.test.hs b/cabal-testsuite/PackageTests/Regression/T4291/setup.test.hs index a6eb9844785..f5152c93ccb 100644 --- a/cabal-testsuite/PackageTests/Regression/T4291/setup.test.hs +++ b/cabal-testsuite/PackageTests/Regression/T4291/setup.test.hs @@ -3,15 +3,16 @@ import Test.Cabal.Prelude -- Test that checkRelocate doesn't fail when library directory of dependee -- contains '..' -main = setupAndCabalTest $ withPackageDb $ do - skipIfWindows - skipUnlessGhcVersion ">= 7.6" - env <- getTestEnv - let pkgroot = takeDirectory $ testPackageDbDir env - prefix = testTmpDir env "prefix" - assertBool "we need a prefix that is not under pkgroot for this test" $ - not $ pkgroot `isPrefixOf` prefix - withDirectory "dependee" $ - setup_install ["--enable-relocatable", "--prefix", prefix] - withDirectory "depender" $ - setup_install ["--enable-relocatable", "--prefix", prefix] +main = do + skipIfWindows "no relocatable builds" + setupAndCabalTest $ withPackageDb $ do + skipUnlessGhcVersion ">= 7.6" + env <- getTestEnv + let pkgroot = takeDirectory $ testPackageDbDir env + prefix = testTmpDir env "prefix" + assertBool "we need a prefix that is not under pkgroot for this test" $ + not $ pkgroot `isPrefixOf` prefix + withDirectory "dependee" $ + setup_install ["--enable-relocatable", "--prefix", prefix] + withDirectory "depender" $ + setup_install ["--enable-relocatable", "--prefix", prefix] diff --git a/cabal-testsuite/PackageTests/Regression/T5309/cabal.test.hs b/cabal-testsuite/PackageTests/Regression/T5309/cabal.test.hs index a81a75197f3..e64f2e36951 100644 --- a/cabal-testsuite/PackageTests/Regression/T5309/cabal.test.hs +++ b/cabal-testsuite/PackageTests/Regression/T5309/cabal.test.hs @@ -1,6 +1,8 @@ import Test.Cabal.Prelude -main = cabalTest $ do - skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 - cabal "v2-build" ["all"] - cabal "v2-test" ["all"] - cabal "v2-bench" ["all"] +main = do + cabalTest $ do + ghcVer <- isGhcVersion ">= 9.4" + expectBrokenIf (isWindows && ghcVer) 10189 $ do + cabal "v2-build" ["all"] + cabal "v2-test" ["all"] + cabal "v2-bench" ["all"] diff --git a/cabal-testsuite/PackageTests/Regression/T5677/cabal.test.hs b/cabal-testsuite/PackageTests/Regression/T5677/cabal.test.hs index 27edba49486..a8ea261289a 100644 --- a/cabal-testsuite/PackageTests/Regression/T5677/cabal.test.hs +++ b/cabal-testsuite/PackageTests/Regression/T5677/cabal.test.hs @@ -2,5 +2,4 @@ import Test.Cabal.Prelude main = cabalTest $ do -- -Wmissing-export-lists is new in 8.4. skipUnlessGhcVersion ">= 8.3" - skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 cabal "v2-build" ["all"] diff --git a/cabal-testsuite/PackageTests/Regression/T6906/cabal.test.hs b/cabal-testsuite/PackageTests/Regression/T6906/cabal.test.hs index 233f4a2a3d1..fabfcbdbede 100644 --- a/cabal-testsuite/PackageTests/Regression/T6906/cabal.test.hs +++ b/cabal-testsuite/PackageTests/Regression/T6906/cabal.test.hs @@ -1,9 +1,8 @@ import Test.Cabal.Prelude main = cabalTest $ do - win <- isWindows ghcsWithMaxPathIssue <- isGhcVersion "< 8.6.5" - expectBrokenIf (win && ghcsWithMaxPathIssue) 6271 $ do + expectBrokenIf (isWindows && ghcsWithMaxPathIssue) 6271 $ do res <- recordMode DoNotRecord $ cabalG' ["--config=cabal.config"] "v2-install" ["-v3"] assertOutputContains "creating file with the inputs used to compute the package hash:" res assertOutputContains "extra-lib-dirs: bar" res diff --git a/cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/cabal-with-hpc.multitest.hs b/cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/cabal-with-hpc.multitest.hs index 14f12247548..c62f83385a3 100644 --- a/cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/cabal-with-hpc.multitest.hs +++ b/cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/cabal-with-hpc.multitest.hs @@ -9,8 +9,8 @@ import qualified Distribution.Verbosity as Verbosity import Test.Cabal.Prelude main = cabalTest $ do - skipIf "osx" =<< isOSX -- TODO: re-enable this once the macOS CI - -- issues are resolved, see discussion in #4902. + skipIf "osx" isOSX -- TODO: re-enable this once the macOS CI + -- issues are resolved, see discussion in #4902. hasShared <- hasSharedLibraries hasProfiled <- hasProfiledLibraries diff --git a/cabal-testsuite/PackageTests/WarnEarlyOverwrite/clean-install-by-copy.test.hs b/cabal-testsuite/PackageTests/WarnEarlyOverwrite/clean-install-by-copy.test.hs index 710878ce1f0..e05f52953f5 100644 --- a/cabal-testsuite/PackageTests/WarnEarlyOverwrite/clean-install-by-copy.test.hs +++ b/cabal-testsuite/PackageTests/WarnEarlyOverwrite/clean-install-by-copy.test.hs @@ -1,14 +1,8 @@ import Test.Cabal.Prelude -main = cabalTest $ withShorterPathForNewBuildStore $ do - storeDir <- testStoreDir <$> getTestEnv - let options = ["--installdir=" ++ storeDir] - -- Use install method copy that should surely work on Windows too but our - -- path normalization for testing is not good enough yet as can be seen in - -- this CI failure snippet diff: - -- -Warning: The directory /ghc-/incoming/new-/ghc-/-/bin is not in the system search path. - -- -Copying 'warn-early-overwrite' to '/warn-early-overwrite' - -- +Warning: The directory /incoming/new-2448/Users/RUNNER~1/AppData/Local/Temp/cabal-test-store-28260/ghc-/WarnEarlyOver_-0.1.0.0-4c19059e06a32b93b2812983631117e77a2d3833/bin is not in the system search path. - -- +Copying 'warn-early-overwrite' to '' - skipIfWindows - cabalG options "v2-install" ["--install-method=copy"] +main = do + skipIfWindows "#10180" + cabalTest $ withShorterPathForNewBuildStore $ do + storeDir <- testStoreDir <$> getTestEnv + let options = ["--installdir=" ++ storeDir] + cabalG options "v2-install" ["--install-method=copy"] diff --git a/cabal-testsuite/PackageTests/WarnEarlyOverwrite/clean-install-by-symlink.test.hs b/cabal-testsuite/PackageTests/WarnEarlyOverwrite/clean-install-by-symlink.test.hs index f4e6556b167..d25ecb0465e 100644 --- a/cabal-testsuite/PackageTests/WarnEarlyOverwrite/clean-install-by-symlink.test.hs +++ b/cabal-testsuite/PackageTests/WarnEarlyOverwrite/clean-install-by-symlink.test.hs @@ -1,8 +1,8 @@ import Test.Cabal.Prelude -main = cabalTest $ withShorterPathForNewBuildStore $ do - storeDir <- testStoreDir <$> getTestEnv - -- The default install method is symlink that may not work on Windows. - skipIfWindows - let options = ["--installdir=" ++ storeDir] - cabalG options "v2-install" [] +main = do + skipIfWindows "#10180" + cabalTest $ withShorterPathForNewBuildStore $ do + storeDir <- testStoreDir <$> getTestEnv + let options = ["--installdir=" ++ storeDir] + cabalG options "v2-install" [] diff --git a/cabal-testsuite/PackageTests/WarnEarlyOverwrite/dirty-install.test.hs b/cabal-testsuite/PackageTests/WarnEarlyOverwrite/dirty-install.test.hs index 8d2ae8e6cc5..232d526f983 100644 --- a/cabal-testsuite/PackageTests/WarnEarlyOverwrite/dirty-install.test.hs +++ b/cabal-testsuite/PackageTests/WarnEarlyOverwrite/dirty-install.test.hs @@ -2,14 +2,13 @@ import Test.Cabal.Prelude import System.FilePath -main = cabalTest $ withShorterPathForNewBuildStore $ do - - storeDir <- testStoreDir <$> getTestEnv - -- Windows does not natively include a touch command. - -- SEE: https://stackoverflow.com/questions/30011267/create-an-empty-file-on-the-commandline-in-windows-like-the-linux-touch-command - skipIfWindows - let options = ["--installdir=" ++ storeDir] - -- Touch the target to see if the warning is made early before the build. - _ <- runM "touch" [storeDir "warn-early-overwrite"] Nothing - fails $ cabalG options "v2-install" [] - cabalG options "v2-install" ["--overwrite-policy=always"] +main = do + skipIfWindows "#10180" + cabalTest $ withShorterPathForNewBuildStore $ do + storeDir <- testStoreDir <$> getTestEnv + let options = ["--installdir=" ++ storeDir] + -- Touch the target to see if the warning is made early before the build. + _ <- runM "touch" [ (if isWindows then (<.> "exe") else id) + $ storeDir "warn-early-overwrite" ] Nothing + fails $ cabalG options "v2-install" [] + cabalG options "v2-install" ["--overwrite-policy=always"] diff --git a/cabal-testsuite/PackageTests/postCheckoutCommand/cabal.test.hs b/cabal-testsuite/PackageTests/postCheckoutCommand/cabal.test.hs index d4747aceb92..65fddd48be5 100644 --- a/cabal-testsuite/PackageTests/postCheckoutCommand/cabal.test.hs +++ b/cabal-testsuite/PackageTests/postCheckoutCommand/cabal.test.hs @@ -1,7 +1,8 @@ import Test.Cabal.Prelude -main = cabalTest $ do - skipIfWindows +main = do + skipIfWindows "see #10182" + cabalTest $ do withProjectFile "cabal.positive.project" $ do cabal "v2-build" ["-v0"] withProjectFile "cabal.negative.project" $ do diff --git a/validate.sh b/validate.sh index edb1db83277..47705300a2d 100755 --- a/validate.sh +++ b/validate.sh @@ -329,7 +329,7 @@ CABALLISTBIN="${CABAL} list-bin --builddir=$BUILDDIR --project-file=$PROJECTFILE # of validate.sh # https://github.com/haskell/cabal/issues/9571 # https://github.com/haskell/cabal/pull/10114 -RTSOPTS="$([ $ARCH = "x86_64-windows" ] && [ -z "$CI" ] && echo "+RTS --io-manager=native" || echo "")" +RTSOPTS="$([ $ARCH = "x86_64-windows" ] && [ -z "$CI" ] && [ "$($HC --numeric-version)" != "8.10.7" ] && echo "+RTS --io-manager=native" || echo "")" # header #######################################################################