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

feature: add aliases for inline tests #11109

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Alizter
Copy link
Collaborator

@Alizter Alizter commented Nov 10, 2024

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.

  • changelog
  • documentation

@Alizter Alizter requested a review from rgrinberg November 10, 2024 16:20
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]>
@Alizter Alizter force-pushed the ps/rr/feature__add_aliases_for_inline_tests branch from b5d5d4f to 0e1c216 Compare November 10, 2024 16:24
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) ]
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

Copy link
Member

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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.

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.

3 participants