Skip to content

tools: update test-self to allow to choose running tests for cmd and vlib - #21326

Merged
spytheman merged 9 commits into
vlang:masterfrom
ttytm:tools/vtest-self-choice
Apr 22, 2024
Merged

spytheman merged 9 commits into
vlang:masterfrom
ttytm:tools/vtest-self-choice

Conversation

@ttytm

@ttytm ttytm commented Apr 21, 2024 •

Copy link
Copy Markdown
Member

With the changes, it will be possible to choose to run v test-self for project parts in cmd and vlib. By default - as it already is - both will be included, the same when passing both flags v test-self --vlib --cmd.

This can also help with local development but is mainly motivated to further improve our current CI - running parts when and where required.

As far as I can see, when changes are made just to a cmd tool, it should usually not require to run tests for the whole vlib. While changes to the vlib should include running tests for cmd tools. On the CI part, this can skyrocket tool development and reduce stress on vlib development. As PRs including updates just made to a tool without changes on the vlib can skip the most heavy part of CI.

Workflow update suggestions would happen in a follow-up.

@ttytm
ttytm force-pushed the tools/vtest-self-choice branch from 2e3b26a to 490ac08 Compare April 21, 2024 07:57
@spytheman

spytheman commented Apr 22, 2024 •

Copy link
Copy Markdown
Contributor

v test cmd/ is almost the same as v test-self --cmd , except for the builtin skipping that v test-self does in certain conditions.

What do you think of modifying v test-self so that it supports passing folders (relative to vroot), instead of flags (since each flag needs special edge case handling in the source)?

Then v test-self --vlib could become v test-self vlib/ and v test-self --cmd can be v test-self cmd/.
i.e. passing a folder (or several), can just modify the existing tsession.files lists, filtering only what is in the passed folders, so that tsession.test() will only process what is left.

It will be also a bit more flexible, since in some cases, you may want to do:
v test-self vlib/db/ or v test-self vlib/context/, which will run all tests, for which v test-self does not have explicit skips, similar to v test folder/ .

@ttytm

ttytm commented Apr 22, 2024

Copy link
Copy Markdown
Member Author

v test cmd/ is almost the same as v test-self --cmd , except for the builtin skipping that v test-self does in certain conditions.

What do you think of modifying v test-self so that it supports passing folders (relative to vroot), instead of flags (since each flag needs special edge case handling in the source)?

Then v test-self --vlib could become v test-self vlib/ and v test-self --cmd can be v test-self cmd/. i.e. passing a folder (or several), can just modify the existing tsession.files lists, filtering only what is in the passed folders, so that tsession.test() will only process what is left.

It will be also a bit more flexible, since in some cases, you may want to do: v test-self vlib/db/ or v test-self vlib/context/, which will run all tests, for which v test-self does not have explicit skips, similar to v test folder/ .

Awesome idea. Thank you for the input!

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Excellent work πŸ₯³ πŸš€ !

@spytheman
spytheman merged commit 3b0c620 into vlang:master Apr 22, 2024
@ttytm
ttytm deleted the tools/vtest-self-choice branch April 23, 2024 15:34
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