Skip to content

Disable benchmarks and tests for tools #1044

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

Merged
merged 1 commit into from
Feb 16, 2021

Conversation

hamishmack
Copy link
Collaborator

By default haskell.nix cabalProject functions run cabal
configure with --enable-tests and --enable-benchmarks.
This is good when you are working on a project as
it means your tests and benchmarks are in the
package components.

The tools functions (and shellFor tools arg)
return components.exes.${toolName} and while
it is possible to access the other components
via the project and package properties of
tool component.

In some cases the benchmarks and tests can
have problematic constraints that cause
problems building other components.

Disabling the tests and benchmarks by default
when building tools should reduce the these
issues.

By default haskell.nix cabalProject functions run cabal
configure with --enable-tests and --enable-benchmarks.
This is good when you are working on a project as
it means your tests and benchmarks are in the
package `components`.

The `tools` functions (and `shellFor` `tools` arg)
return `components.exes.${toolName}` and while
it is possible to access the other components
via the `project` and `package` properties of
tool component.

In some cases the benchmarks and tests can
have problematic constraints that cause
problems building other components.

Disabling the tests and benchmarks by default
when building `tools` should reduce the these
issues.
@michaelpj
Copy link
Collaborator

Makes sense to me.

A possible heuristic that occurs to me: what happens if you do cabal install foo to tell cabal to install an executable? Does it build it with benchmarks and tests enabled? Could we have the property that tool does ~= what cabal install does?

@hamishmack
Copy link
Collaborator Author

bors try

iohk-bors bot added a commit that referenced this pull request Feb 16, 2021
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Feb 16, 2021

@hamishmack
Copy link
Collaborator Author

cabal configure defaults to tests and benchmarks disabled. Having configureArgs default to "--enable-tests --enable-benchmarks" is something cabalProject does.

Switching from running cabal install and cabal test causes a new plan.json to be created (with or without the tests). If you try to cabal install a test you get an error like this:

[nix-shell:~/iohk/haskell-language-server]$ cabal install test:func-test
cabal: Cannot build the test suite 'func-test' because building test suites
has been explicitly disabled in the configuration. You can adjust this
configuration in the cabal.project{.local} file either for all packages in the
project or on a per-package basis. Note that if you do not explicitly disable
test suites then the solver will merely try to make a plan with them
available, so you may wish to explicitly enable them which will require the
solver to find a plan with them available or to fail with an explanation.

@hamishmack hamishmack merged commit 5d3975e into master Feb 16, 2021
@iohk-bors iohk-bors bot deleted the hkm/disable-tests-for-tools branch February 16, 2021 12:27
booniepepper pushed a commit to booniepepper/haskell.nix that referenced this pull request Feb 4, 2022
By default haskell.nix cabalProject functions run cabal
configure with --enable-tests and --enable-benchmarks.
This is good when you are working on a project as
it means your tests and benchmarks are in the
package `components`.

The `tools` functions (and `shellFor` `tools` arg)
return `components.exes.${toolName}` and while
it is possible to access the other components
via the `project` and `package` properties of
tool component.

In some cases the benchmarks and tests can
have problematic constraints that cause
problems building other components.

Disabling the tests and benchmarks by default
when building `tools` should reduce the these
issues.
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

Successfully merging this pull request may close these issues.

2 participants