def testFileOutput(self, moose_dir, options, output): """ Set a failure status for expressions found in output """ reason = '' specs = self.specs if specs.isValid('expect_out'): if specs['match_literal']: have_expected_out = util.checkOutputForLiteral(output, specs['expect_out']) else: have_expected_out = util.checkOutputForPattern(output, specs['expect_out']) if (not have_expected_out): reason = 'EXPECTED OUTPUT MISSING' if reason == '' and specs.isValid('absent_out'): have_absent_out = util.checkOutputForPattern(output, specs['absent_out']) if (have_absent_out): reason = 'OUTPUT NOT ABSENT' if reason == '': # We won't pay attention to the ERROR strings if EXPECT_ERR is set (from the derived class) # since a message to standard error might actually be a real error. This case should be handled # in the derived class. if options.valgrind_mode == '' and not specs.isValid('expect_err') and len( filter( lambda x: x in output, specs['errors'] ) ) > 0: reason = 'ERRMSG' elif self.exit_code == 0 and specs['should_crash'] == True: reason = 'NO CRASH' elif self.exit_code != 0 and specs['should_crash'] == False: reason = 'CRASH' # Valgrind runs elif self.exit_code == 0 and self.shouldExecute() and options.valgrind_mode != '' and 'ERROR SUMMARY: 0 errors' not in output: reason = 'MEMORY ERROR' if reason != '': self.setStatus(reason, self.bucket_fail) return reason
def testFileOutput(self, moose_dir, options, output): """ Set a failure status for expressions found in output """ reason = '' errors = '' specs = self.specs params_and_msgs = {'expect_err': {'error_missing': True, 'modes': ['ALL'], 'reason': "EXPECTED ERROR MISSING", 'message': "Unable to match the following {} against the program's output:"}, 'expect_assert': {'error_missing': True, 'modes': ['dbg', 'devel'], 'reason': "EXPECTED ASSERT MISSING", 'message': "Unable to match the following {} against the program's output:"}, 'expect_out': {'error_missing': True, 'modes': ['ALL'], 'reason': "EXPECTED OUTPUT MISSING", 'message': "Unable to match the following {} against the program's output:"}, 'absent_out': {'error_missing': False, 'modes': ['ALL'], 'reason': "OUTPUT NOT ABSENT", 'message': "Matched the following {}, which we did NOT expect:"} } for param,attr in params_and_msgs.items(): if specs.isValid(param) and (options.method in attr['modes'] or attr['modes'] == ['ALL']): match_type = "" if specs['match_literal']: have_expected_out = util.checkOutputForLiteral(output, specs[param]) match_type = 'literal' else: have_expected_out = util.checkOutputForPattern(output, specs[param]) match_type = 'pattern' # Exclusive OR test if attr['error_missing'] ^ have_expected_out: reason = attr['reason'] errors += "#"*80 + "\n\n" + attr['message'].format(match_type) + "\n\n" + specs[param] + "\n" break if reason != '': self.setStatus(self.fail, reason) return errors