Skip to content

Allow new-run to run tests and benchmarks too - #4861

Merged
fgaz merged 8 commits into
haskell:masterfrom
fgaz:new-run/allow-running-tests-benchs
Jan 17, 2018
Merged

fgaz merged 8 commits into
haskell:masterfrom
fgaz:new-run/allow-running-tests-benchs

Conversation

@fgaz

@fgaz fgaz commented Nov 3, 2017 •

Copy link
Copy Markdown
Member

This is especially useful for passing arguments to a single test suite

  • Patches conform to the coding conventions.
  • Any changes that could be relevant to users have been recorded in the changelog.
  • The documentation has been updated, if necessary.
  • Update the error reporting
  • Remove duplication
  • Some refactoring on that ugly lambda
  • Add some comments about why we allow running tests/benchs
  • Check and update the tests
    • Fix the negative test
    • Add a positive test
  • rebase

ping @merijn this is already usable

Closes #4684

@fgaz fgaz added cabal-install: v2-build system Affecting v2-build and related commands that use v2-architecture (aka "nix local builds"). type: enhancement labels Nov 3, 2017
(targetsExesBuildable,
targetsExesBuildable') = selectBuildableTargets'
. filterTargetsKind ExeKind
. (\ts -> concatMap (`filterTargetsKind` ts) [ExeKind, TestKind, BenchKind])

@phadej phadej Nov 3, 2017 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ExeKind was first argument of filterTargetsKind, now it's (ts) is second.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean? The behavior is the same (note the backticks).

Uuh anyway this whole patch is not in a good shape right now. No need to review it until I polish it

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I got confused. Maybe (\kind -> filterTargetsKind kind ts) would be less mind-twisting, or adding filterTargetKinds :: [ComponentKind] -> ...

@fgaz
fgaz force-pushed the new-run/allow-running-tests-benchs branch from 4bea5cf to 40cf289 Compare November 9, 2017 16:19
@fgaz fgaz changed the title Allow new-run to run tests and benchmarks too [WIP] Allow new-run to run tests and benchmarks too Nov 9, 2017
@fgaz

fgaz commented Nov 9, 2017 •

Copy link
Copy Markdown
Member Author

This is now ready for review.

The failing test is obsolete, I'm updatingremoving it right now.

@fgaz
fgaz requested a review from phadej November 9, 2017 17:43
@fgaz
fgaz force-pushed the new-run/allow-running-tests-benchs branch from fc255a3 to 5e92bcf Compare November 10, 2017 10:49
@23Skidoo

Copy link
Copy Markdown
Member

CI failures look legit.

@fgaz

fgaz commented Nov 12, 2017

Copy link
Copy Markdown
Member Author

Yeah, I probably have to update/delete that test too since I changed new-run's behavior

@fgaz
fgaz force-pushed the new-run/allow-running-tests-benchs branch from 828fa50 to eefdbfe Compare November 12, 2017 19:45
@23Skidoo

Copy link
Copy Markdown
Member

CI is still red, there's a failing test.

@fgaz
fgaz force-pushed the new-run/allow-running-tests-benchs branch from eefdbfe to b1a70fe Compare December 19, 2017 11:01
@fgaz

fgaz commented Dec 19, 2017

Copy link
Copy Markdown
Member Author

With this set of changes that test should have that result. I tried to change it to check the new result, but there is little/no documentation about IntegrationTests2. Maybe I should just delete it

@phadej

phadej commented Dec 19, 2017

Copy link
Copy Markdown
Collaborator

travis fails because we need for #4962 to get in.

phadej
phadej previously requested changes Dec 19, 2017

@phadej phadej left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late review. Few nitpicks.

I'd really like to see a positive test.

selectComponentTargetBasic pkgid cname subtarget t
| otherwise
= Left (TargetProblemComponentNotExe pkgid cname)
= case availableTargetComponentName t

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amend the haddock of selectComponentTarget.

We should be precise here when we mean "executable" and when "executable-like" component. This will cause confusion otherwise.

++ "contains just one executable.\n\n"
++ "Any executable/test/benchmark in any package in the project can be "
++ "specified. A package can be specified if contains just one "
++ "executable. The default is to use the package in the current "

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

executable-like component

[ ( CmdRun.TargetProblemNoTargets, mkTargetPackage "p-0.1" )
]

reportSubCase "test-only"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not super happy of simply removing this test.

It's invalid with this change, as https://github.com/haskell/cabal/blob/fcabd87406effc0c265312eb38509804682e4623/cabal-install/tests/IntegrationTests2/targets/test-only/p.cabal has only test-suite stanza, but now has an executable.

Let's change that package to be lib-only (you cannot run that).

What is pity, we don't have any positive tests for CmdRun in IntegrationsTests2.hs. We really should add them, so the things working now continue working in the future.

@fgaz
fgaz force-pushed the new-run/allow-running-tests-benchs branch 2 times, most recently from 9462c25 to e731514 Compare January 9, 2018 14:29
@fgaz
fgaz dismissed phadej’s stale review January 9, 2018 14:35

Done. Except the positive test. I'll do that in another pr

@fgaz

fgaz commented Jan 9, 2018

Copy link
Copy Markdown
Member Author

I'm merging this once it's green, since the 15th is near.

I promise to do that positive test sometime after my next exam (which is also too near)

fgaz added 4 commits January 9, 2018 17:40
This is especially useful for passing arguments to a single test suite

Closes haskell#4684.
Report possible tests and benchmarks too when erroring because of
multiple available targets.
fgaz added 3 commits January 9, 2018 17:40
Since now new-run can run tests too (but obviously not libs)
As it can now mean a proper executable, a test, or a benchmark
The old comment was probably copypasted from CmdBuild. Now it reflects
what new-run actually does.
@fgaz
fgaz force-pushed the new-run/allow-running-tests-benchs branch from e731514 to 0ef5bb0 Compare January 9, 2018 16:40
@fgaz fgaz mentioned this pull request Jan 14, 2018
2 tasks
@fgaz

fgaz commented Jan 17, 2018

Copy link
Copy Markdown
Member Author

Oh well, windows and linux is green and one of the four osx builds is green too (the other 3 keep erroring). I'm merging this.

@fgaz
fgaz merged commit 67276f8 into haskell:master Jan 17, 2018
@phadej

phadej commented Jan 17, 2018

Copy link
Copy Markdown
Collaborator

🎆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cabal-install: v2-build system Affecting v2-build and related commands that use v2-architecture (aka "nix local builds"). type: enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants