Skip to content

Commit a1d8331

Browse files
committed
Add unittest for failing perf test
1 parent 3b1c362 commit a1d8331

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

unittests/test_policies.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,24 @@ def perf1(self):
989989
return _MyTest()
990990

991991

992+
@pytest.fixture
993+
def failing_perf_test():
994+
class _MyFailingTest(rfm.RunOnlyRegressionTest):
995+
valid_systems = ['*']
996+
valid_prog_environs = ['*']
997+
executable = 'echo perf0=100'
998+
999+
@sanity_function
1000+
def validate(self):
1001+
return False
1002+
1003+
@performance_function('unit0')
1004+
def perf0(self):
1005+
return sn.extractsingle(r'perf0=(\S+)', self.stdout, 1, float)
1006+
1007+
return _MyFailingTest()
1008+
1009+
9921010
@pytest.fixture
9931011
def simple_test():
9941012
class _MySimpleTest(rfm.RunOnlyRegressionTest):
@@ -1192,7 +1210,8 @@ def test_perf_logging_no_perfvars(make_runner, make_exec_ctx, perf_test,
11921210

11931211

11941212
def test_perf_logging_multiline(make_runner, make_exec_ctx, perf_test,
1195-
simple_test, config_perflog, tmp_path):
1213+
simple_test, failing_perf_test, config_perflog,
1214+
tmp_path):
11961215
make_exec_ctx(
11971216
config_perflog(
11981217
fmt=(
@@ -1207,7 +1226,7 @@ def test_perf_logging_multiline(make_runner, make_exec_ctx, perf_test,
12071226
)
12081227
logging.configure_logging(rt.runtime().site_config)
12091228
runner = make_runner()
1210-
testcases = executors.generate_testcases([perf_test, simple_test])
1229+
testcases = executors.generate_testcases([perf_test, simple_test, failing_perf_test])
12111230
runner.runall(testcases)
12121231

12131232
logfile = tmp_path / 'perflogs' / 'generic' / 'default' / '_MyTest.log'

0 commit comments

Comments
 (0)