本文整理汇总了Python中RunApp.RunApp类的典型用法代码示例。如果您正苦于以下问题:Python RunApp类的具体用法?Python RunApp怎么用?Python RunApp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RunApp类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: processResults
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(reason, self.bucket_fail)
else:
self.setStatus(self.success_message, self.bucket_success)
return output
示例2: processResults
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
示例3: processResults
def processResults(self, moose_dir, options, output):
RunApp.testFileOutput(self, moose_dir, options, output)
# Skip
specs = self.specs
if self.getStatus() == self.bucket_fail or specs['skip_checks']:
return output
# Don't Run VTKDiff on Scaled Tests
if options.scaling and specs['scale_refine']:
return output
# Loop over every file
for file in specs['vtkdiff']:
# Error if gold file does not exist
if not os.path.exists(os.path.join(specs['test_dir'], specs['gold_dir'], file)):
output += "File Not Found: " + os.path.join(specs['test_dir'], specs['gold_dir'], file)
self.setStatus('MISSING GOLD FILE', self.bucket_fail)
break
# Perform diff
else:
for file in self.specs['vtkdiff']:
gold = os.path.join(specs['test_dir'], specs['gold_dir'], file)
test = os.path.join(specs['test_dir'], file)
# We always ignore the header_type attribute, since it was
# introduced in VTK 7 and doesn't seem to be important as
# far as Paraview is concerned.
specs['ignored_attributes'].append('header_type')
differ = XMLDiffer(gold, test, abs_zero=specs['abs_zero'], rel_tol=specs['rel_err'], ignored_attributes=specs['ignored_attributes'])
# Print the results of the VTKDiff whether it passed or failed.
output += differ.message() + '\n'
if differ.fail():
self.addCaveats('VTKDIFF')
self.setStatus(self.bucket_skip.status, self.bucket_skip)
break
# If status is still pending, then it is a passing test
if self.getStatus() == self.bucket_pending:
self.setStatus(self.success_message, self.bucket_success)
return output
示例4: processResults
def processResults(self, moose_dir, retcode, options, output):
(reason, output) = RunApp.processResults(self, moose_dir, retcode, options, output)
specs = self.specs
if reason != '' or specs['skip_checks']:
return (reason, output)
if 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 self.checkOutputForPattern(contents, self.specs['file_expect_out']):
reason = 'NO EXPECTED OUT IN FILE'
break
return (reason, output)
示例5: getValidParams
def getValidParams():
params = RunApp.getValidParams()
params.addParam('check_files', [], "A list of files that MUST exist.")
params.addParam('check_not_exists', [], "A list of files that must NOT exist.")
params.addParam('delete_output_before_running', True, "Delete pre-existing output files before running test. Only set to False if you know what you're doing!")
params.addParam('file_expect_out', "A regular expression that must occur in all of the check files in order for the test to be considered passing.")
return params
示例6: processResults
def processResults(self, moose_dir, retcode, options, output):
(reason, output) = RunApp.processResults(self, moose_dir, retcode, options, output)
if reason != '' or self.specs['skip_checks']:
return (reason, output)
# Don't Run Exodiff on Scaled Tests
if options.scaling and self.specs['scale_refine']:
return (reason, output)
# Make sure that all of the Exodiff files are actually available
for file in self.specs['txtdiff']:
if not os.path.exists(os.path.join(self.specs['test_dir'], self.specs['gold_dir'], file)):
output += "File Not Found: " + os.path.join(self.specs['test_dir'], self.specs['gold_dir'], file)
reason = 'MISSING GOLD FILE'
break
# Run the txtdiff
if reason == '':
output += 'Running txtdiff'
with open(os.path.join(self.specs['test_dir'], file), 'r') as f:
first_line = f.readline()
with open(os.path.join(self.specs['test_dir'], self.specs['gold_dir'], file), 'r') as f:
first_line_gold = f.readline()
if first_line != first_line_gold:
reason = 'TXTDIFF'
return (reason, output)
示例7: validParams
def validParams():
params = RunApp.validParams()
params.addRequiredParam('txtdiff', [], "A list of files to txtdiff.")
params.addParam('gold_dir', 'gold', "The directory where the \"golden standard\" files reside relative to the TEST_DIR: (default: ./gold/)")
params.addParam('delete_output_before_running', True, "Delete pre-existing output files before running test. Only set to False if you know what you're doing!")
return params
示例8: processResults
def processResults(self, moose_dir, retcode, options, output):
if self.httpServer.getNumberOfPosts() != int(self.nPosts):
return ("ICEUpdater FAILED: DID NOT GET CORRECT NUMBER OF POSTS",
"Number of Posts was " + str(self.httpServer.getNumberOfPosts()) +
", but should have been " + str(self.nPosts))
else:
return RunApp.processResults(self, moose_dir, retcode, options, output)
示例9: processResults
def processResults(self, moose_dir, retcode, options, output):
(reason, output) = RunApp.processResults(self, moose_dir, retcode, options, output)
if reason != '' or self.specs['skip_checks']:
return (reason, output)
# Don't Run Exodiff on Scaled Tests
if options.scaling and self.specs['scale_refine']:
return (reason, output)
# Make sure that all of the Exodiff files are actually available
for file in self.specs['exodiff']:
if not os.path.exists(os.path.join(self.specs['test_dir'], self.specs['gold_dir'], file)):
output += "File Not Found: " + os.path.join(self.specs['test_dir'], self.specs['gold_dir'], file)
reason = 'MISSING GOLD FILE'
break
if reason == '':
# Retrieve the commands
commands = self.processResultsCommand(moose_dir, options)
for command in commands:
exo_output = runCommand(command)
output += 'Running exodiff: ' + command + '\n' + exo_output + ' ' + ' '.join(self.specs['exodiff_opts'])
if ('different' in exo_output or 'ERROR' in exo_output) and not "Files are the same" in exo_output:
reason = 'EXODIFF'
break
return (reason, output)
示例10: processResults
def processResults(self, moose_dir, retcode, options, output):
(reason, output) = RunApp.processResults(self, moose_dir, retcode, options, output)
specs = self.specs
if reason != '' or specs['skip_checks']:
return (reason, output)
# Don't Run Exodiff on Scaled Tests
if options.scaling and specs['scale_refine']:
return (reason, output)
for file in specs['exodiff']:
custom_cmp = ''
old_floor = ''
if specs.isValid('custom_cmp'):
custom_cmp = ' -f ' + os.path.join(specs['test_dir'], specs['custom_cmp'])
if specs['use_old_floor']:
old_floor = ' -use_old_floor'
if not os.path.exists(os.path.join(specs['test_dir'], specs['gold_dir'], file)):
output += "File Not Found: " + os.path.join(specs['test_dir'], specs['gold_dir'], file)
reason = 'MISSING GOLD FILE'
break
else:
command = os.path.join(moose_dir, 'framework', 'contrib', 'exodiff', 'exodiff') + ' -m' + custom_cmp + ' -F' + ' ' + str(specs['abs_zero']) + old_floor + ' -t ' + str(specs['rel_err']) \
+ ' ' + ' '.join(specs['exodiff_opts']) + ' ' + os.path.join(specs['test_dir'], specs['gold_dir'], file) + ' ' + os.path.join(specs['test_dir'], file)
exo_output = runCommand(command)
output += 'Running exodiff: ' + command + '\n' + exo_output + ' ' + ' '.join(specs['exodiff_opts'])
if ('different' in exo_output or 'ERROR' in exo_output) and not "Files are the same" in exo_output:
reason = 'EXODIFF'
break
return (reason, output)
示例11: processResults
def processResults(self, moose_dir, retcode, options, output):
(reason, output) = RunApp.processResults(self, moose_dir, retcode, options, output)
specs = self.specs
if reason != "" or specs["skip_checks"]:
return (reason, output)
if 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 self.checkOutputForPattern(contents, self.specs["file_expect_out"]):
reason = "NO EXPECTED OUT IN FILE"
break
return (reason, output)
示例12: validParams
def validParams():
params = RunApp.validParams()
params.addParam('ratio_tol', 1e-8, "Relative tolerance to compare the ration against.")
params.addParam('difference_tol', 1e-8, "Relative tolerance to compare the difference against.")
params.addParam('state', 'user', "The state for which we want to compare against the "
"finite-differenced Jacobian ('user', 'const_positive', or "
"'const_negative'.")
return params
示例13: validParams
def validParams():
params = RunApp.validParams()
params.addParam('expect_err', "A regular expression that must occur in the ouput. (Test may terminiate unexpectedly and be considered passing)")
params.addParam('expect_assert', "DEBUG MODE ONLY: A regular expression that must occur in the ouput. (Test may terminiate unexpectedly and be considered passing)")
params.addParam('should_crash', True, "Inidicates that the test is expected to crash or otherwise terminate early")
return params
示例14: validParams
def validParams():
params = RunApp.validParams()
params.addRequiredParam('vtkdiff', [], "A list of files to exodiff.")
params.addParam('gold_dir', 'gold', "The directory where the \"golden standard\" files reside relative to the TEST_DIR: (default: ./gold/)")
params.addParam('abs_zero', 1e-10, "Absolute zero cutoff used in exodiff comparisons.")
params.addParam('rel_err', 5.5e-6, "Relative error value used in exodiff comparisons.")
params.addParam('ignored_attributes', [], "Ignore e.g. type and/or version in sample XML block <VTKFile type=\"Foo\" version=\"0.1\">")
return params
示例15: getValidParams
def getValidParams():
params = RunApp.getValidParams()
params.addRequiredParam('vtkdiff', [], "A list of files to exodiff.")
params.addParam('gold_dir', 'gold', "The directory where the \"golden standard\" files reside relative to the TEST_DIR: (default: ./gold/)")
params.addParam('abs_zero', 1e-10, "Absolute zero cutoff used in exodiff comparisons.")
params.addParam('rel_err', 5.5e-6, "Relative error value used in exodiff comparisons.")
params.addParam('delete_output_before_running', True, "Delete pre-existing output files before running test. Only set to False if you know what you're doing!")
return params