Skip to content

v2-run needs a way to use package directory #6178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
symbiont-sam-halliday opened this issue Aug 6, 2019 · 3 comments
Closed

v2-run needs a way to use package directory #6178

symbiont-sam-halliday opened this issue Aug 6, 2019 · 3 comments

Comments

@symbiont-sam-halliday
Copy link

symbiont-sam-halliday commented Aug 6, 2019

Describe the bug

v2-run tasty uses the current working directory when invoking the tasty binary, but this breaks multi-package builds (i.e. projects with a cabal.project) that have test data in a specific location relative to the .cabal file.

For example, aeson-golden tests will fail because they expect to be run from the package directory, not the location of the cabal.project file.

To Reproduce
Steps to reproduce the behavior:

$ cd foo
$ cabal v2-run tasty

vs

$ cd ..
$ cabal v2-run foo:tasty

Expected behavior

The tests should run with the CWD set to the directory containing the .cabal file.

System information

  • Operating system: N/A
  • cabal, ghc versions: all released versions

** Other Context

Not only does this mean that running tests from the root dir vs the package dir produce different results, but stack uses the convention of always running tests from the dir containing the .cabal file and therefore this subtle change in behaviour makes it difficult to migrate from stack to cabal or for developers to have a choice of build tool on their project.

@phadej
Copy link
Collaborator

phadej commented Aug 6, 2019 via email

@symbiont-sam-halliday
Copy link
Author

symbiont-sam-halliday commented Aug 7, 2019

@phadej apologies, you're right... my reproduction is broken. This is actually a problem with using cabal v2-run foo:tasty to run tests, which is currently required because it is not possible to pass parameters such as -p Pattern to v2-test. I will update the description. (I wrote this bug report from some old notes, I got lazy and should have confirmed!)

An alternative solution to the core problem would be if something like cabal v2-test -O0 -- -p Pattern worked as expected.

@symbiont-sam-halliday symbiont-sam-halliday changed the title v2-test needs a way to use package directory v2-run needs a way to use package directory Aug 7, 2019
@symbiont-sam-halliday
Copy link
Author

Closing because I think this is more fundamentally dealt with by fixing #6114 which would allow v2-test to be used to run tests for this usecase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants