Skip to content
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

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

Merged
merged 8 commits into from
Jan 17, 2018

Conversation

fgaz
Copy link
Member

@fgaz fgaz commented Nov 3, 2017

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

@@ -309,11 +311,11 @@ selectPackageTargets targetSelector targets
where
(targetsExesBuildable,
targetsExesBuildable') = selectBuildableTargets'
. filterTargetsKind ExeKind
. (\ts -> concatMap (`filterTargetsKind` ts) [ExeKind, TestKind, BenchKind])
Copy link
Collaborator

@phadej phadej Nov 3, 2017

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
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
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
Copy link
Member Author

fgaz commented Nov 9, 2017

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
Member

CI failures look legit.

@fgaz
Copy link
Member Author

fgaz commented Nov 12, 2017

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
Member

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

@fgaz
Copy link
Member Author

fgaz commented Dec 19, 2017

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
Copy link
Collaborator

phadej commented Dec 19, 2017

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

phadej
phadej previously requested changes Dec 19, 2017
Copy link
Collaborator

@phadej phadej left a comment

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
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
Collaborator

Choose a reason for hiding this comment

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

executable-like component

@@ -869,15 +869,6 @@ testTargetProblemsRun config reportSubCase = do
[ ( CmdRun.TargetProblemNoTargets, mkTargetPackage "p-0.1" )
]

reportSubCase "test-only"
Copy link
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
Copy link
Member Author

fgaz commented Jan 9, 2018

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)

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.
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
Copy link
Member Author

fgaz commented Jan 17, 2018

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
Copy link
Collaborator

phadej commented Jan 17, 2018

🎆

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

Successfully merging this pull request may close these issues.

3 participants