-
Notifications
You must be signed in to change notification settings - Fork 701
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testsuite: Refactor withShorterPathForNewBuildStore
This makes `withShorterPathForNewBuildStore` fit more nicely into the rest of the testing infrastructure. * Move `withShorterPathForNewBuildStore` to `TestM` monad * Move responsibility for passing `--store-dir` to `cabalGArgs` function * Move `findDependencyInStore` into `TestM`, and remove requirement to pass path to store directory. * Introduce `testStoreDir` function which returns the store location (and honours `withShorterPathForNewBuildStore`) * Migrate tests which use `withShorterPathForNewBuildStore`.
- Loading branch information
1 parent
3d881ac
commit 555e791
Showing
23 changed files
with
121 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Cabal-tests/tests/UnitTests/Distribution/PackageDescription/Check.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
cabal-testsuite/PackageTests/Backpack/Includes3/cabal-repo.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
import Test.Cabal.Prelude | ||
main = withShorterPathForNewBuildStore $ \storeDir -> | ||
cabalTest $ do | ||
main = cabalTest $ withShorterPathForNewBuildStore $ do | ||
skipUnlessGhcVersion ">= 8.1" | ||
skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 | ||
withProjectFile "cabal.repo.project" $ do | ||
withRepo "repo" $ do | ||
cabalG ["--store-dir=" ++ storeDir] "v2-build" ["exe"] | ||
cabal "v2-build" ["exe"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import Test.Cabal.Prelude | ||
main = withShorterPathForNewBuildStore $ \storeDir -> | ||
cabalTest $ do | ||
main = | ||
cabalTest $ withShorterPathForNewBuildStore $ do | ||
skipUnlessGhcVersion ">= 8.1" | ||
skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 | ||
withRepo "repo" $ do | ||
cabalG ["--store-dir=" ++ storeDir] "v2-build" ["T6385"] | ||
cabal "v2-build" ["T6385"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
import Test.Cabal.Prelude | ||
|
||
main = withShorterPathForNewBuildStore $ \storeDir -> cabalTest $ withRepo "repo" $ do | ||
main = cabalTest $ withShorterPathForNewBuildStore $ withRepo "repo" $ do | ||
skipUnlessGhcVersion ">= 8.8" | ||
cabalG ["--store-dir=" ++ storeDir] "v2-build" ["hie"] | ||
liftIO $ do | ||
installedDependencyLibDir <- findDependencyInStore storeDir "hie-dependency" | ||
shouldExist $ installedDependencyLibDir </> "lib" </> "extra-compilation-artifacts" </> "hie" </> "HieDependency.hie" | ||
cabal "v2-build" ["hie"] | ||
installedDependencyLibDir <- findDependencyInStore "hie-dependency" | ||
shouldExist $ installedDependencyLibDir </> "lib" </> "extra-compilation-artifacts" </> "hie" </> "HieDependency.hie" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
cabal-testsuite/PackageTests/NewConfigure/ConfigFile/cabal.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import Test.Cabal.Prelude | ||
|
||
-- Test that 'cabal v2-configure' generates the config file appropriately | ||
main = withShorterPathForNewBuildStore $ \storeDir -> | ||
cabalTest $ do | ||
main = | ||
cabalTest . withShorterPathForNewBuildStore $ do | ||
cwd <- fmap testCurrentDir getTestEnv | ||
let configFile = cwd </> "cabal.project.local" | ||
|
||
shouldNotExist configFile | ||
|
||
-- should not create config file with --dry-run or --only-download | ||
cabalG ["--store-dir=" ++ storeDir] "v2-configure" ["--dry-run"] | ||
cabalG ["--store-dir=" ++ storeDir] "v2-configure" ["--only-download"] | ||
cabal "v2-configure" ["--dry-run"] | ||
cabal "v2-configure" ["--only-download"] | ||
shouldNotExist configFile | ||
|
||
-- should create the config file | ||
cabalG ["--store-dir=" ++ storeDir] "v2-configure" [] | ||
cabal "v2-configure" [] | ||
shouldExist configFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
cabal-testsuite/PackageTests/OfflineFlag/offlineFlag.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import Test.Cabal.Prelude | ||
|
||
main = withShorterPathForNewBuildStore $ \storeDir -> | ||
cabalTest $ do | ||
main = | ||
cabalTest $ withShorterPathForNewBuildStore $ do | ||
skipUnlessGhcVersion ">= 8.1" | ||
skipIfWindows | ||
withProjectFile "cabal.repo.project" $ do | ||
withRepo "repo" $ do | ||
fails $ cabalG ["--store-dir=" ++ storeDir] "v2-build" ["current", "--offline"] | ||
cabalG ["--store-dir=" ++ storeDir] "v2-build" ["current"] | ||
cabalG ["--store-dir=" ++ storeDir] "v2-build" ["current", "--offline"] | ||
fails $ cabal "v2-build" ["current", "--offline"] | ||
cabal "v2-build" ["current"] | ||
cabal "v2-build" ["current", "--offline"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
cabal-testsuite/PackageTests/WarnEarlyOverwrite/clean-install-by-copy.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
cabal-testsuite/PackageTests/WarnEarlyOverwrite/clean-install-by-symlink.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import Test.Cabal.Prelude | ||
|
||
main = withShorterPathForNewBuildStore $ \storeDir -> cabalTest $ do | ||
main = cabalTest $ withShorterPathForNewBuildStore $ do | ||
storeDir <- testStoreDir <$> getTestEnv | ||
-- The default install method is symlink that may not work on Windows. | ||
skipIfWindows | ||
let options = ["--store-dir=" ++ storeDir, "--installdir=" ++ storeDir] | ||
cabalG options "v2-install" [] | ||
let options = ["--installdir=" ++ storeDir] | ||
cabalG options "v2-install" [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.