def processResults(self, moose_dir, retcode, options, output): reason = '' specs = self.specs # 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 == '': output = RunApp.processResults(self, moose_dir, retcode, 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, retcode, options, 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 retcode == RunParallel.TIMEOUT: reason = 'TIMEOUT' elif retcode == 0 and specs['should_crash'] == True: reason = 'NO CRASH' elif retcode != 0 and specs['should_crash'] == False: reason = 'CRASH' # Valgrind runs elif retcode == 0 and self.shouldExecute( ) and options.valgrind_mode != '' and 'ERROR SUMMARY: 0 errors' not in output: reason = 'MEMORY ERROR' # PBS runs elif retcode == 0 and options.pbs and 'command not found' in output: reason = 'QSUB NOT FOUND' # Populate the bucket if reason != '': self.setStatus(reason, self.bucket_fail) else: self.setStatus(self.success_message, self.bucket_success) return output
def testFileOutput(self, moose_dir, retcode, 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 retcode == 0 and specs['should_crash'] == True: reason = 'NO CRASH' elif retcode != 0 and specs['should_crash'] == False: reason = 'CRASH' # Valgrind runs elif retcode == 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, retcode, options, output): reason = '' specs = self.specs if specs.isValid('expect_out'): out_ok = util.checkOutputForPattern(output, specs['expect_out']) if (out_ok and retcode != 0): reason = 'OUT FOUND BUT CRASH' elif (not out_ok): reason = 'NO EXPECTED OUT' if reason == '': if retcode != 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, retcode, options, output): FileTester.processResults(self, moose_dir, retcode, options, output) specs = self.specs if self.getStatus() == self.bucket_fail 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(reason, self.bucket_fail) else: self.setStatus(self.success_message, self.bucket_success) return output
def processResults(self, moose_dir, retcode, options, output): reason = '' specs = self.specs if specs.isValid('expect_out'): out_ok = util.checkOutputForPattern(output, specs['expect_out']) if (out_ok and retcode != 0): reason = 'OUT FOUND BUT CRASH' elif (not out_ok): reason = 'NO EXPECTED OUT' if reason == '': if retcode == RunParallel.TIMEOUT: reason = 'TIMEOUT' elif retcode != 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, retcode, options, output): output = FileTester.processResults(self, moose_dir, retcode, options, output) specs = self.specs if self.getStatus() == self.bucket_fail 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(reason, self.bucket_fail) else: self.setStatus(self.success_message, self.bucket_success) return output