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

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

Merged
merged 9 commits into from
Apr 22, 2024

Conversation

ttytm
Copy link
Member

@ttytm ttytm commented Apr 21, 2024

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.

@spytheman
Copy link
Member

spytheman commented Apr 22, 2024

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

ttytm commented Apr 22, 2024

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!

Copy link
Member

@spytheman spytheman left a comment

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
51 checks passed
@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.

None yet

2 participants