Skip to content

Commit

Permalink
Reenable script tests for Windows/ghc-9.4.*
Browse files Browse the repository at this point in the history
  • Loading branch information
bacchanalia committed Apr 9, 2023
1 parent 8df083c commit 79e804b
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 89 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import Test.Cabal.Prelude

main = cabalTest . void $ do
isWin <- isWindows
ghc94 <- isGhcVersion "== 9.4.*"
expectBrokenIf (isWin && ghc94) 8451 $ do
cabal' "v2-build" ["script.hs"]
cabal' "v2-build" ["script.hs"]

env <- getTestEnv
cacheDir <- getScriptCacheDirectory $ testCurrentDir env </> "script.hs"
env <- getTestEnv
cacheDir <- getScriptCacheDirectory $ testCurrentDir env </> "script.hs"

shouldExist $ cacheDir </> "fake-package.cabal"
shouldExist $ cacheDir </> "scriptlocation"
shouldExist $ cacheDir </> "fake-package.cabal"
shouldExist $ cacheDir </> "scriptlocation"
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import Test.Cabal.Prelude

main = cabalTest . void $ do
isWin <- isWindows
ghc94 <- isGhcVersion "== 9.4.*"
expectBrokenIf (isWin && ghc94) 8451 $ do
cabal' "v2-build" ["script.hs"]
cabalWithStdin "v2-repl" ["script.hs"] ""
cabal' "v2-build" ["script.hs"]
cabalWithStdin "v2-repl" ["script.hs"] ""
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import Test.Cabal.Prelude

main = cabalTest . void $ do
isWin <- isWindows
ghc94 <- isGhcVersion "== 9.4.*"
expectBrokenIf (isWin && ghc94) 8451 $ do
cabal' "v2-build" ["script.hs"]
cabal' "v2-run" ["script.hs"]
cabal' "v2-build" ["script.hs"]
cabal' "v2-run" ["script.hs"]
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import Test.Cabal.Prelude

main = cabalTest . void $ do
isWin <- isWindows
ghc94 <- isGhcVersion "== 9.4.*"
expectBrokenIf (isWin && ghc94) 8451 $ do
cabal' "v2-build" ["script.hs"]
cabal' "v2-build" ["script.hs"]
cabal' "v2-build" ["script.hs"]
cabal' "v2-build" ["script.hs"]
25 changes: 11 additions & 14 deletions cabal-testsuite/PackageTests/NewBuild/CmdClean/Keep/cabal.test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@ import Test.Cabal.Prelude
import System.Directory (copyFile, removeFile)

main = cabalTest . void $ do
isWin <- isWindows
ghc94 <- isGhcVersion "== 9.4.*"
expectBrokenIf (isWin && ghc94) 8451 $ do
env <- getTestEnv
let td = testCurrentDir env
env <- getTestEnv
let td = testCurrentDir env

cabal' "v2-build" ["script.hs"]
liftIO $ copyFile (td </> "script.hs") (td </> "script2.hs")
cabal' "v2-build" ["script2.hs"]
liftIO $ removeFile (td </> "script2.hs")
cabal' "v2-clean" []
cabal' "v2-build" ["script.hs"]
liftIO $ copyFile (td </> "script.hs") (td </> "script2.hs")
cabal' "v2-build" ["script2.hs"]
liftIO $ removeFile (td </> "script2.hs")
cabal' "v2-clean" []

cacheDir <- getScriptCacheDirectory (td </> "script.hs")
cacheDir2 <- getScriptCacheDirectory (td </> "script2.hs")
cacheDir <- getScriptCacheDirectory (td </> "script.hs")
cacheDir2 <- getScriptCacheDirectory (td </> "script2.hs")

shouldDirectoryExist cacheDir
shouldDirectoryNotExist cacheDir2
shouldDirectoryExist cacheDir
shouldDirectoryNotExist cacheDir2
25 changes: 11 additions & 14 deletions cabal-testsuite/PackageTests/NewBuild/CmdClean/Orphan/cabal.test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@ import Test.Cabal.Prelude
import System.Directory (copyFile, removeFile)

main = cabalTest . void $ do
isWin <- isWindows
ghc94 <- isGhcVersion "== 9.4.*"
expectBrokenIf (isWin && ghc94) 8451 $ do
env <- getTestEnv
let td = testCurrentDir env
env <- getTestEnv
let td = testCurrentDir env

cabal' "v2-build" ["script.hs"]
liftIO $ copyFile (td </> "script.hs") (td </> "script2.hs")
cabal' "v2-build" ["script2.hs"]
liftIO $ removeFile (td </> "script2.hs")
cabal' "v2-clean" ["script.hs"]
cabal' "v2-build" ["script.hs"]
liftIO $ copyFile (td </> "script.hs") (td </> "script2.hs")
cabal' "v2-build" ["script2.hs"]
liftIO $ removeFile (td </> "script2.hs")
cabal' "v2-clean" ["script.hs"]

cacheDir <- getScriptCacheDirectory (td </> "script.hs")
cacheDir2 <- getScriptCacheDirectory (td </> "script2.hs")
cacheDir <- getScriptCacheDirectory (td </> "script.hs")
cacheDir2 <- getScriptCacheDirectory (td </> "script2.hs")

shouldDirectoryNotExist cacheDir
shouldDirectoryNotExist cacheDir2
shouldDirectoryNotExist cacheDir
shouldDirectoryNotExist cacheDir2
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import Test.Cabal.Prelude

main = cabalTest . void $ do
isWin <- isWindows
ghc94 <- isGhcVersion "== 9.4.*"
expectBrokenIf (isWin && ghc94) 8451 $ do
cabal' "v2-build" ["script.hs"]
cabal' "v2-clean" ["script.hs"]
cabal' "v2-build" ["script.hs"]
cabal' "v2-clean" ["script.hs"]

env <- getTestEnv
cacheDir <- getScriptCacheDirectory (testCurrentDir env </> "script.hs")
env <- getTestEnv
cacheDir <- getScriptCacheDirectory (testCurrentDir env </> "script.hs")

shouldDirectoryNotExist cacheDir
shouldDirectoryNotExist (testDistDir env)
shouldDirectoryNotExist cacheDir
shouldDirectoryNotExist (testDistDir env)
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import Test.Cabal.Prelude

main = cabalTest $ do
isWin <- isWindows
ghc94 <- isGhcVersion "== 9.4.*"
expectBrokenIf (isWin && ghc94) 8451 $ do
res <- cabal' "v2-run" ["script.hs"]
assertOutputContains "Hello World" res
res <- cabal' "v2-run" ["script.hs"]
assertOutputContains "Hello World" res

env <- getTestEnv
cacheDir <- getScriptCacheDirectory (testCurrentDir env </> "script.hs")
env <- getTestEnv
cacheDir <- getScriptCacheDirectory (testCurrentDir env </> "script.hs")

shouldExist $ cacheDir </> "fake-package.cabal"
shouldExist $ cacheDir </> "scriptlocation"
shouldExist $ cacheDir </> "fake-package.cabal"
shouldExist $ cacheDir </> "scriptlocation"
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import Test.Cabal.Prelude

main = cabalTest $ do
isWin <- isWindows
ghc94 <- isGhcVersion "== 9.4.*"
expectBrokenIf (isWin && ghc94) 8451 $ do
res <- cabal' "v2-run" ["script.lhs"]
assertOutputContains "Hello World" res
res <- cabal' "v2-run" ["script.lhs"]
assertOutputContains "Hello World" res
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import Test.Cabal.Prelude

main = cabalTest . void $ do
isWin <- isWindows
ghc94 <- isGhcVersion "== 9.4.*"
expectBrokenIf (isWin && ghc94) 8451 $ do
cabal' "v2-run" ["with sp"] >>= assertOutputContains "Hello World"
cabal' "v2-run" ["with sp"] >>= assertOutputContains "Hello World"
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import Test.Cabal.Prelude

main = cabalTest . void $ do
isWin <- isWindows
ghc94 <- isGhcVersion "== 9.4.*"
expectBrokenIf (isWin && ghc94) 8451 $ do
cabal' "v2-run" ["script.hs"]
cabal' "v2-run" ["script.hs"]
cabal' "v2-run" ["script.hs"]
cabal' "v2-run" ["script.hs"]
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import Test.Cabal.Prelude

main = cabalTest $ do
isWin <- isWindows
ghc94 <- isGhcVersion "== 9.4.*"
expectBrokenIf (isWin && ghc94) 8451 $ do
-- script is called "s.hs" to avoid Windows long path issue in CI
res <- cabal' "v2-run" ["s.hs"]
assertOutputContains "Hello World" res
-- script is called "s.hs" to avoid Windows long path issue in CI
res <- cabal' "v2-run" ["s.hs"]
assertOutputContains "Hello World" res

0 comments on commit 79e804b

Please sign in to comment.