Skip to content

Commit 183fe15

Browse files
committed
Fix HaddockKeepTmpsCustom test for merge skew
The `HaddockKeepTmpsCustom` test added in #10392 skewed against #10366, which changes where temporary files are written. We can work around this by setting `$TMPDIR` and `$TEMP` while running tests, so that temporary files are written to the test's temporary directory rather than the system one.
1 parent ad439ea commit 183fe15

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/cabal.test.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ main = cabalTest $ recordMode DoNotRecord $ withProjectFile "cabal.project" $ do
1111
-- "foobar.ext" will be "fooXXX.ext".
1212
let glob =
1313
if isWindows
14-
then "**/had*.txt"
15-
else "**/haddock-response*.txt"
14+
then "had*.txt"
15+
else "haddock-response*.txt"
1616

1717
-- Check that there is a response file.
18-
responseFiles <- assertGlobMatchesTestDir testDistDir glob
18+
responseFiles <- assertGlobMatchesTestDir testTmpDir glob
1919

2020
-- Check that the matched response file is not empty, and is indeed a Haddock
2121
-- response file.

cabal-testsuite/src/Test/Cabal/Monad.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,10 @@ runTestM mode m =
410410
-- effect on Windows.
411411
, ("CABAL_DIR", Just (testCabalDir env))
412412
, ("CABAL_CONFIG", Just (testUserCabalConfigFile env))
413+
-- Set `TMPDIR` so that temporary files aren't created in the global `TMPDIR`.
414+
, ("TMPDIR", Just tmp_dir)
415+
-- Windows uses `TEMP` for the `TMPDIR`.
416+
, ("TEMP", Just tmp_dir)
413417
],
414418
testShouldFail = False,
415419
testRelativeCurrentDir = ".",

0 commit comments

Comments
 (0)