-
Notifications
You must be signed in to change notification settings - Fork 414
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
feature: add aliases for inline tests #11109
base: main
Are you sure you want to change the base?
feature: add aliases for inline tests #11109
Conversation
For a given library with inlines tests, we add an alias with the name of the library for running those tests. Further work on separating out the partition actions would allow us to have an alias for each partition. For now, this allows us to run inline tests with the runtest command. Signed-off-by: Ali Caglayan <[email protected]> <!-- ps-id: 8fef343c-46e6-4486-aa50-d31b6cfe1d46 --> Signed-off-by: Ali Caglayan <[email protected]>
b5d5d4f
to
0e1c216
Compare
in | ||
Action.Full.make ~sandbox @@ Action.progn [ run_tests; diffs ])) | ||
Memo.parallel_iter | ||
[ runtest_alias; Alias.Name.of_string (Lib_name.Local.to_string lib_name) ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make runtest depend on the <lib_name> alias instead? Aren't we running the tests twice if building both @runtest and @<lib_name> aliases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is how aliases work. But maybe @rgrinberg can confirm. IIUC the aliases should point to the same target, so if they are both requested in the engine, only that target would end up getting built, and nothing will be run twice. But it's possible I have misunderstood the situation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hugo's right, we are going to run the tests twice this way. You should create the alias and then add it as a dependency to runtest. A test to demonstrate this would be valuable as well btw.
IIUC the aliases should point to the same target, so if they are both requested in the engine, only that target would end up getting built, and nothing will be run twice
What I think you you forgot is that the anonymous action we attach to the aliases will have a different digest. The digest of the anonymous action here will include the alias name, and therefore the action will be re-executed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK that makes sense now. Thanks for pointing this out @hhugo. I'll see about adding a test and fixing the code here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we are doing something similar in Cram_rules.test_rule
. There we iterate over all the aliases and do Super_context.add_alias_action
like I do here. I don't ever recall @runtest
and @mycramtest
building things twice.
For a given library with inlines tests, we add an alias with the name of the library for running those tests.
Further work on separating out the partition actions would allow us to have an alias for each partition.
For now, this will allow us to run inline tests with the runtest command. Further work on that will follow this PR.
This addresses part of #10239 the remaining part would be to add an alias to the
(test)
stanza.