Skip to content

Conversation

tjfulle
Copy link
Collaborator

@tjfulle tjfulle commented Sep 9, 2025

@mdmosby and @davi0011 - this is an alternative method of specifying CDash subproject labels. It adds two plugin hooks:

canary_cdash_labels_for_subproject() -> list[str]
define subproject labels for the whole project. This is analogous to CTEST_LABELS_FOR_SUBPROJECTS
canary_cdash_subproject_label(case: TestCase) -> str
(as suggested by @mdmosby) a test can define its own subproject label. If a test's subproject label is not included in the global list of subproject labels, it is added.

For Sierra to use the plugin hook, simply add the following:

@hookimpl
def canary_cdash_subproject_label(case: TestCase) -> str | None:
    if isinstance(case, SierraTestCase):
        return case.product
    return None

Copy link
Contributor

@mdmosby mdmosby left a comment

Choose a reason for hiding this comment

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

Does this supersede #20?


class CDashHooks:
@hookspec(firstresult=True)
def canary_cdash_subproject_label(self, case: "TestCase") -> str | None: ...
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this return list[str] | None and be plural, i.e., ..._labels?

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 had intended to return a single subproject label for each test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

but if that is not idiomatic or expected (ie, a test belongs to several subprojects) it can be changed

@davi0011
Copy link

davi0011 commented Sep 9, 2025

This change seems like it would be either Subprojects enabled if your plugin declares the hooks or specifies a list of labels on the command line but no way to enable/disable from the command line. It also implies not to support Subprojects without plugin implementation which I think would be beneficial. Is there an opposition to combining a bit of both the CLI changes form #20 and this change? I think Canary should be able to generate Subproject labels from the default implementation of a Testcase or from a given build file as well.

@@ -131,6 +132,7 @@ def __call__(self, *args_in: str, fail_on_error: bool = True) -> int:
config.plugin_manager.hook.canary_addoption(parser=parser)
args = parser.parse_args(argv)
config.set_main_options(args)
config.plugin_manager.hook.canary_addhooks(pluginmanager=config.plugin_manager)
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 am not sure I follow?

@tjfulle
Copy link
Collaborator Author

tjfulle commented Sep 9, 2025

@mdmosby said:

Does this supersede #20?

I'd say augments, since we may still want to adopt the idea of a test case's labels all being subprojects (per #39 (comment))

@tjfulle
Copy link
Collaborator Author

tjfulle commented Sep 9, 2025

@davi0011 said in #39 (comment)

... Is there an opposition to combining a bit of both the CLI changes form #20 and this change? I think Canary should be able to generate Subproject labels from the default implementation of a Testcase or from a given build file as well.

When I think of subproject labels, I imagine a test belonging to a single subproject. If all the test keywords become CDash subproject labels, then that test would belong to many subprojects. If that is idiomatic CDash, then I like the option of a command line flag to enable that.

@davi0011
Copy link

davi0011 commented Sep 9, 2025

#39 (comment)

My understanding is that CTest uses the test labels to generate the list of Subprojects labels. Hence, I think it would be fine to leave that as a default way of getting the labels with the plugin method if you wish for a more specific method.

@tjfulle
Copy link
Collaborator Author

tjfulle commented Sep 9, 2025

My understanding is that you must set the variable CTEST_LABELS_FOR_SUBPROJECT to a list of labels that CTest identifies as subprojects. If a test has one of the labels in CTEST_LABELS_FOR_SUBPROJECT, it is put into the subproject.

@tjfulle tjfulle merged commit 0643e02 into main Sep 9, 2025
10 checks passed
@tjfulle tjfulle deleted the tjfulle/cdash-subproject-labels branch September 9, 2025 19:35
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