def create_comparisons(self): comparisons = ComparisonMultiThread(self.case.fs.ndiff_log) comparisons.thread_name_property = True for check_rule in self.case.check_rules: method = str(check_rule.keys()[0]) module = self.get_module(method) comp_data = check_rule[method] if not module: Printer.all.err( 'Warning! No module for check_rule method "{}"', method) continue pairs = self._get_ref_output_files(comp_data) if pairs: for pair in pairs: # load module and determine whether we are dealing with # exec comparison or inplace comparison if issubclass(module.__class__, modules.ExecComparison): command = module.get_command(*pair, **comp_data) pm = PyPy(BinExecutor(command), progress=True) pm.executor.output = OutputMode.variable_output() else: module = self.get_module(method) module.prepare(*pair, **comp_data) pm = PyPy(module, progress=True) pm.executor.output = OutputMode.dummy_output() pm.error_monitor.deactivate() # if we fail, set error to 13 pm.custom_error = 13 pm.start_monitor.deactivate() pm.end_monitor.deactivate() pm.progress_monitor.deactivate() pm.limit_monitor.deactivate( ) # TODO: maybe some time limit would be useful pm.output_monitor.policy = pm.output_monitor.POLICY_ERROR_ONLY pm.error_monitor.message = 'Comparison using method {} failed!'.format( method) pm.error_monitor.indent = 1 pm.full_output = self.case.fs.ndiff_log path = Paths.path_end_until(pair[0], REF_OUTPUT_DIR) test_name = Paths.basename( Paths.dirname(Paths.dirname(self.case.fs.ref_output))) size = Paths.filesize(pair[0], True) pm.name = '{}: {} ({})'.format(test_name, path, size) comparisons.add(pm) return comparisons
def create_comparisons(self): comparisons = ComparisonMultiThread( self.case.fs.ndiff_log, progress=printf.verbosity() is printf.OutputVerbosity.FULL) for check_rule in self.case.check_rules: method = str(list(check_rule.keys())[0]) module = self.get_module(method) comp_data = check_rule[method] if not module: printf.error('Warning! No module for check_rule method "{}"', method) continue pairs = self._get_ref_output_files(comp_data) if pairs: for pair in pairs: # load module and determine whether we are dealing with # exec comparison or inplace comparison if issubclass(module.__class__, modules.ExecComparison): command = module.get_command(*pair, **comp_data) pm = PyPy(BinExecutor(command)) pm.executor.output = OutputMode.variable_output() else: module = self.get_module(method) module.prepare(*pair, **comp_data) pm = PyPy(module) pm.executor.output = OutputMode.dummy_output() # pm.error_monitor.deactivate() # if we fail, set error to 13 pm.custom_error = 13 # TODO: maybe some time limit would be useful pm.full_output = self.case.fs.ndiff_log path = Paths.path_end_until(pair[0], REF_OUTPUT_DIR) test_name = Paths.basename( Paths.dirname(Paths.dirname(self.case.fs.ref_output))) size = Paths.filesize(pair[0], True) pm.name = '{}: {} ({})'.format(test_name, path, size) if printf.verbosity() is printf.OutputVerbosity.FULL: pm.monitor.color_complete_format = '{}: {} ({})'.format( test_name, path, size) else: pm.monitor.error_complete_format = '{}: {} ({})'.format( test_name, path, size) comparisons.add(pm) return comparisons
def create_comparisons(self): comparisons = ComparisonMultiThread(self.case.fs.ndiff_log) comparisons.thread_name_property = True for check_rule in self.case.check_rules: method = str(check_rule.keys()[0]) module = getattr(file_comparison, 'Compare{}'.format(method.capitalize()), None) comp_data = check_rule[method] if not module: Printer.all.err('Warning! No module for check_rule method "{}"', method) continue pairs = self._get_ref_output_files(comp_data) if pairs: for pair in pairs: command = module.get_command(*pair, **comp_data) pm = PyPy(BinExecutor(command), progress=True) # if we fail, set error to 13 pm.custom_error = 13 pm.start_monitor.deactivate() pm.end_monitor.deactivate() pm.progress_monitor.deactivate() pm.limit_monitor.deactivate() # TODO: maybe some time limit would be useful pm.output_monitor.policy = pm.output_monitor.POLICY_ERROR_ONLY pm.error_monitor.message = 'Comparison using method {} failed!'.format(method) pm.error_monitor.indent = 1 # catch output pm.executor.output = OutputMode.variable_output() pm.full_output = self.case.fs.ndiff_log path = Paths.path_end_until(pair[0], REF_OUTPUT_DIR) test_name = Paths.basename(Paths.dirname(Paths.dirname(self.case.fs.ref_output))) size = Paths.filesize(pair[0], True) pm.name = '{}: {} ({})'.format(test_name, path, size) comparisons.add(pm) return comparisons