Skip to content

Commit ea78747

Browse files
authored
Merge pull request #3157 from vkarak/feat/compileonly-implicit-validation
[feat] Do not require a sanity function for compile-only tests
2 parents 91147de + 7272c08 commit ea78747

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

reframe/core/pipeline.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2605,8 +2605,18 @@ class CompileOnlyRegressionTest(RegressionTest, special=True):
26052605
The standard output and standard error of the test will be set to those of
26062606
the compilation stage.
26072607
2608+
Compile-only tests do not need to define a sanity checking function, since
2609+
the compile stage will always fail if the compilation fails.
2610+
However, if a sanity function is defined, it will be used to validate the
2611+
test.
2612+
26082613
This class is also directly available under the top-level :mod:`reframe`
26092614
module.
2615+
2616+
.. versionchanged:: 4.6
2617+
2618+
Compile-only tests do not require an explicit sanity checking function.
2619+
26102620
'''
26112621

26122622
_rfm_regression_class_kind = _RFM_TEST_KIND_COMPILE
@@ -2646,3 +2656,11 @@ def run_wait(self):
26462656
26472657
Implemented as no-op
26482658
'''
2659+
2660+
def check_sanity(self):
2661+
# If no sanity function is defined, then use an identity expression
2662+
if (not hasattr(self, '_rfm_sanity') and
2663+
not hasattr(self, 'sanity_patterns')):
2664+
self.sanity_patterns = sn.assert_true(1)
2665+
2666+
super().check_sanity()

unittests/resources/checks/hellocheck.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ class CompileOnlyHelloTest(rfm.CompileOnlyRegressionTest):
3232
valid_prog_environs = ['*']
3333
sourcepath = 'hello.c'
3434

35-
@sanity_function
36-
def validate(self):
37-
return sn.assert_not_found(r'(?i)error', self.stdout)
38-
3935

4036
@rfm.simple_test
4137
class SkipTest(rfm.RunOnlyRegressionTest):

0 commit comments

Comments
 (0)