diff --git a/cabal-testsuite/PackageTests/CustomDep/cabal.test.hs b/cabal-testsuite/PackageTests/CustomDep/cabal.test.hs index e676f0145fb..addfe1f520c 100644 --- a/cabal-testsuite/PackageTests/CustomDep/cabal.test.hs +++ b/cabal-testsuite/PackageTests/CustomDep/cabal.test.hs @@ -8,5 +8,5 @@ main = cabalTest $ do -- database, don't record the output recordMode DoNotRecord $ do -- TODO: Hack, delete me - withEnvFilter (/= "HOME") $ do + withEnvFilter (`notElem` ["HOME", "CABAL_DIR"]) $ do cabal "new-build" ["all"] diff --git a/cabal-testsuite/PackageTests/CustomPlain/cabal.test.hs b/cabal-testsuite/PackageTests/CustomPlain/cabal.test.hs index 47e8a154a99..899f09cde9d 100644 --- a/cabal-testsuite/PackageTests/CustomPlain/cabal.test.hs +++ b/cabal-testsuite/PackageTests/CustomPlain/cabal.test.hs @@ -5,7 +5,7 @@ main = cabalTest $ do -- Regression test for #4393 recordMode DoNotRecord $ do -- TODO: Hack; see also CustomDep/cabal.test.hs - withEnvFilter (/= "HOME") $ do + withEnvFilter (`notElem` ["HOME", "CABAL_DIR"]) $ do -- On -v2, we don't have vQuiet set, which suppressed -- the error cabal "new-build" ["-v1"] diff --git a/cabal-testsuite/PackageTests/Regression/T4154/install-time-with-constraint.test.hs b/cabal-testsuite/PackageTests/Regression/T4154/install-time-with-constraint.test.hs index 47fcca9db36..12aa85c883a 100644 --- a/cabal-testsuite/PackageTests/Regression/T4154/install-time-with-constraint.test.hs +++ b/cabal-testsuite/PackageTests/Regression/T4154/install-time-with-constraint.test.hs @@ -5,9 +5,6 @@ import Test.Cabal.Prelude -- building its setup script with the installed Cabal, which depends on the -- installed time, even though the installed time doesn't fit the constraint. main = cabalTest $ do - -- TODO: Run this test on Windows once #5187 is resolved. - skipIf =<< isWindows - cabal "new-build" ["time", "--constraint=time==99999", "--dry-run"] -- Temporarily disabled recording here because output is not stable diff --git a/cabal-testsuite/Test/Cabal/Monad.hs b/cabal-testsuite/Test/Cabal/Monad.hs index 377e8795264..f8091b02fef 100644 --- a/cabal-testsuite/Test/Cabal/Monad.hs +++ b/cabal-testsuite/Test/Cabal/Monad.hs @@ -31,12 +31,12 @@ module Test.Cabal.Monad ( testPrefixDir, testDistDir, testPackageDbDir, - testHomeDir, testSandboxDir, testSandboxConfigFile, testRepoDir, testKeysDir, testSourceCopyDir, + testCabalDir, testUserCabalConfigFile, testActualFile, -- * Skipping tests @@ -316,7 +316,10 @@ runTestM mode m = do -- Try to avoid Unicode output [ ("LC_ALL", Just "C") -- Hermetic builds (knot-tied) - , ("HOME", Just (testHomeDir env))], + , ("HOME", Just (testHomeDir env)) + -- Set CABAL_DIR in addition to HOME, since HOME has no + -- effect on Windows. + , ("CABAL_DIR", Just (testCabalDir env))], testShouldFail = False, testRelativeCurrentDir = ".", testHavePackageDb = False, @@ -343,7 +346,7 @@ runTestM mode m = do -- the default configuration hardcodes Hackage, which we do -- NOT want to assume for these tests (no test should -- hit Hackage.) - liftIO $ createDirectoryIfMissing True (testHomeDir env ".cabal") + liftIO $ createDirectoryIfMissing True (testCabalDir env) ghc_path <- programPathM ghcProgram liftIO $ writeFile (testUserCabalConfigFile env) $ unlines [ "with-compiler: " ++ ghc_path ] @@ -637,10 +640,13 @@ testKeysDir env = testWorkDir env "keys" testSourceCopyDir :: TestEnv -> FilePath testSourceCopyDir env = testWorkDir env "source" +-- | The user cabal directory +testCabalDir :: TestEnv -> FilePath +testCabalDir env = testHomeDir env ".cabal" + -- | The user cabal config file --- TODO: Not obviously working on Windows testUserCabalConfigFile :: TestEnv -> FilePath -testUserCabalConfigFile env = testHomeDir env ".cabal" "config" +testUserCabalConfigFile env = testCabalDir env "config" -- | The file where the expected output of the test lives testExpectFile :: TestEnv -> FilePath diff --git a/cabal-testsuite/Test/Cabal/Prelude.hs b/cabal-testsuite/Test/Cabal/Prelude.hs index 9224da92c7c..950ae2c17c7 100644 --- a/cabal-testsuite/Test/Cabal/Prelude.hs +++ b/cabal-testsuite/Test/Cabal/Prelude.hs @@ -512,7 +512,7 @@ withRepo repo_dir m = do hackageRepoTool "bootstrap" ["--keys", testKeysDir env, "--repo", testRepoDir env] -- 5. Wire it up in .cabal/config -- TODO: libify this - let package_cache = testHomeDir env ".cabal" "packages" + let package_cache = testCabalDir env "packages" liftIO $ appendFile (testUserCabalConfigFile env) $ unlines [ "repository test-local-repo" , " url: file:" ++ testRepoDir env