def processResults(self, moose_dir, options, output): reason = '' specs = self.specs if self.hasRedirectedOutput(options): redirected_output = util.getOutputFromFiles(self, options) output += redirected_output # Expected errors and assertions might do a lot of things including crash so we # will handle them seperately if specs.isValid('expect_err'): if not util.checkOutputForPattern(output, specs['expect_err']): reason = 'EXPECTED ERROR MISSING' elif specs.isValid('expect_assert'): if options.method in ['dbg', 'devel']: # Only check asserts in debug and devel modes if not util.checkOutputForPattern(output, specs['expect_assert']): reason = 'EXPECTED ASSERT MISSING' # If we've set a reason right here, we should report the pattern that we were unable to match. if reason != '': output += "#"*80 + "\n\nUnable to match the following pattern against the program's output:\n\n" + specs['expect_err'] + "\n" if reason == '': reason = RunApp.testFileOutput(self, moose_dir, options, output) if reason != '': self.setStatus(self.fail, reason) return output
def processResults(self, moose_dir, options, output): reason = '' specs = self.specs if self.hasRedirectedOutput(options): redirected_output = util.getOutputFromFiles(self, options) output += redirected_output # Expected errors and assertions might do a lot of things including crash so we # will handle them seperately if specs.isValid('expect_err'): if not util.checkOutputForPattern(output, specs['expect_err']): reason = 'EXPECTED ERROR MISSING' elif specs.isValid('expect_assert'): if options.method in [ 'dbg', 'devel' ]: # Only check asserts in debug and devel modes if not util.checkOutputForPattern(output, specs['expect_assert']): reason = 'EXPECTED ASSERT MISSING' # If we've set a reason right here, we should report the pattern that we were unable to match. if reason != '': output += "#" * 80 + "\n\nUnable to match the following pattern against the program's output:\n\n" + specs[ 'expect_err'] + "\n" if reason == '': RunApp.testFileOutput(self, moose_dir, options, output) if reason != '': self.setStatus(self.fail, reason) return output
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 processResults(self, moose_dir, options, output): reason = '' specs = self.specs if self.hasRedirectedOutput(options): redirected_output = util.getOutputFromFiles(self, options) output += redirected_output # Expected errors and assertions might do a lot of things including crash so we # will handle them seperately if specs.isValid('expect_err'): if not util.checkOutputForPattern(output, specs['expect_err']): reason = 'NO EXPECTED ERR' elif specs.isValid('expect_assert'): if options.method == 'dbg': # Only check asserts in debug mode if not util.checkOutputForPattern(output, specs['expect_assert']): reason = 'NO EXPECTED ASSERT' if reason == '': RunApp.testFileOutput(self, moose_dir, options, output) if reason != '': self.setStatus(reason, self.bucket_fail) else: self.setStatus(self.success_message, self.bucket_success) return output
def processResults(self, moose_dir, options, output): output += FileTester.processResults(self, moose_dir, options, output) specs = self.specs if self.isFail() or specs['skip_checks']: return output else: reason = '' # if still no errors, check other files (just for existence) for file in self.specs['check_files']: if not os.path.isfile(os.path.join(self.specs['test_dir'], file)): reason = 'MISSING FILES' break for file in self.specs['check_not_exists']: if os.path.isfile(os.path.join(self.specs['test_dir'], file)): reason = 'UNEXPECTED FILES' break # if still no errors, check that all the files contain the file_expect_out expression if reason == '': if self.specs.isValid('file_expect_out'): for file in self.specs['check_files']: fid = open(os.path.join(self.specs['test_dir'], file), 'r') contents = fid.read() fid.close() if not util.checkOutputForPattern(contents, self.specs['file_expect_out']): reason = 'NO EXPECTED OUT IN FILE' break # populate status bucket if reason != '': self.setStatus(self.fail, reason) return output
def processResults(self, moose_dir, options, output): FileTester.processResults(self, moose_dir, options, output) specs = self.specs if self.isFail() or specs['skip_checks']: return output else: reason = '' # if still no errors, check other files (just for existence) for file in self.specs['check_files']: if not os.path.isfile(os.path.join(self.specs['test_dir'], file)): reason = 'MISSING FILES' break for file in self.specs['check_not_exists']: if os.path.isfile(os.path.join(self.specs['test_dir'], file)): reason = 'UNEXPECTED FILES' break # if still no errors, check that all the files contain the file_expect_out expression if reason == '': if self.specs.isValid('file_expect_out'): for file in self.specs['check_files']: fid = open(os.path.join(self.specs['test_dir'], file), 'r') contents = fid.read() fid.close() if not util.checkOutputForPattern(contents, self.specs['file_expect_out']): reason = 'NO EXPECTED OUT IN FILE' break # populate status bucket if reason != '': self.setStatus(self.fail, reason) return output
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
def processResults(self, moose_dir, options, output): reason = '' specs = self.specs if specs.isValid('expect_out'): out_ok = util.checkOutputForPattern(output, specs['expect_out']) if (out_ok and self.exit_code != 0): reason = 'OUT FOUND BUT CRASH' elif (not out_ok): reason = 'NO EXPECTED OUT' if reason == '': if self.exit_code != 0: reason = 'CRASH' if reason != '': self.setStatus(self.fail, reason) return output
def processResults(self, moose_dir, options, output): reason = '' specs = self.specs if specs.isValid('expect_out'): out_ok = util.checkOutputForPattern(output, specs['expect_out']) if (out_ok and self.exit_code != 0): reason = 'OUT FOUND BUT CRASH' elif (not out_ok): reason = 'NO EXPECTED OUT' if reason == '': if self.exit_code != 0 : reason = 'CRASH' if reason != '': self.setStatus(self.fail, reason) return output
def processResults(self, moose_dir, options, output): reason = '' specs = self.specs if specs.isValid('expect_out'): out_ok = util.checkOutputForPattern(output, specs['expect_out']) if (out_ok and self.exit_code != 0): reason = 'OUT FOUND BUT CRASH' elif (not out_ok): reason = 'NO EXPECTED OUT' if reason == '': if self.exit_code != 0 : reason = 'CRASH' # populate status bucket if reason != '': self.setStatus(reason, self.bucket_fail) else: self.setStatus(self.success_message, self.bucket_success) return output
def processResults(self, moose_dir, options, output): reason = '' specs = self.specs if specs.isValid('expect_out'): out_ok = util.checkOutputForPattern(output, specs['expect_out']) if (out_ok and self.exit_code != 0): reason = 'OUT FOUND BUT CRASH' elif (not out_ok): reason = 'NO EXPECTED OUT' if reason == '': if self.exit_code != 0: reason = 'CRASH' # populate status bucket if reason != '': self.setStatus(reason, self.bucket_fail) else: self.setStatus(self.success_message, self.bucket_success) return output