@rfm.simple_test
class my_test(rfm.RunOnlyRegressionTest):
valid_prog_environs = ['*']
valid_systems = ['*']
executable = 'exit 1'
sanity_patterns = sn.assert_true(1)
RFM_TRAP_JOB_ERRORS=y ./bin/reframe -C config/tresa.py -c ../misc/rfm-support/slack/trap_job_errors.py -n 'my_test$' -r
[ PASSED ] Ran 1/1 test case(s) from 1 check(s) (0 failure(s), 0 skipped)
Whereas if you set trap_job_errors in the configuration, it will fail as expected:
* Reason: sanity error: job exited with exit code 1