Skip to content

Dependencies on parameterized tests #1618

@jjotero

Description

@jjotero

Say that we have a run-only test that depends on a compile-only test. If one wanted to extend that compile-only test as a parameterized test (e.g. to test multiple compilation options), it would be nice if we could write such scenario as follows:

@rfm.parameterized_test(['P0'], ['P1'])
class A(rfm.CompileOnlyRegressionTest):
    def __init__(self, param):
        ...


@rfm.simple_test
class B(rfm.RunOnlyRegressionTest):
    def __init__(self):
        self.depends_on('A')

This code would register 2 compile-only tests (one for each of the parameters), and a run-only test for each of the compile-only tests.

Actually, using the syntax to be introduced by #1614 (and later changed in #1699), we could go even further and do

@rfm.simple_test
class A(rfm.CompileOnlyRegressionTest):
    def __init__(self):
        param = parameter(['P0', 'P1'])
        ...

@rfm.simple_test
class B(rfm.RunOnlyRegressionTest):
    def __init__(self):
        self.depends_on('A')


@rfm.simple_test
class C(rfm.RunOnlyRegressionTest):
    def __init__(self):
        self.depends_on('A', when={'param': lambda x: x!='P0'})

where C would only depend on A when the lambda associated to param returns true.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions