def run(self): import popen # Singlecore run tasks = self.remaining_tasks() commands = [] while len(tasks) > 0: tool = tasks[0] try: commands.append(tool.command()) returncode = tool.execute(timeout=self.timeout, memlimit=self.memlimit, verbose=self.verbose) if returncode != 0 and not self.allow_non_zero_return_values: self.dump_file_contents() raise RuntimeError( 'The execution of tool {} ended with return code {}'. format(tool.name, returncode)) except popen.MemoryExceededError as e: if self.verbose: print('Memory limit exceeded: ' + str(e)) self.cleanup() return None except popen.TimeExceededError as e: if self.verbose: print('Time limit exceeded: ' + str(e)) self.cleanup() return None except popen.StackOverflowError as e: if self.verbose: print( 'Stack overflow detected during execution of the tool ' + tool.name) self.cleanup() return None except (popen.ToolRuntimeError, popen.SegmentationFault) as e: self.dump_file_contents() self.cleanup() raise e tasks = self.remaining_tasks() if not all(tool.executed for tool in self.tools): not_executed = [tool for tool in self.tools if not tool.executed] raise UnusedToolsError(not_executed) else: for node in self.nodes: if not os.path.exists(node.filename()): raise RuntimeError( 'Error in test {}: output file {} is missing!'.format( self.name, node.filename())) write_text('commands', '\n'.join(commands)) result = self.result() if result == False: self.dump_file_contents() for tool in self.tools: if tool.value != {}: print('Output of {} {}: {}'.format( tool.name, ' '.join(tool.args), tool.value)) self.cleanup() return result
def create_inputfiles(self, runpath='.'): filename = '{0}.mcrl2'.format(self.name, self.settings) p = random_process_expression.make_process_specification( self.parallel_operator_generators, self.process_expression_generators, self.actions, self.process_identifiers, self.process_size, self.init, self.generate_process_parameters) write_text(filename, str(p)) self.inputfiles += [filename]
def create_inputfiles(self, runpath='.'): filename = '{0}.txt'.format(self.name) p = make_pbes(self.equation_count, self.atom_count, self.propvar_count, self.use_quantifiers, use_integers=self.use_integers) write_text(filename, str(p)) self.inputfiles += [filename]
def save_counter_example(self): txtfile = '%s_counter_example_%d.txt' % (self.name, self.counter) pbesfile = '%s_counter_example_%d.pbes' % (self.name, self.counter) write_text(txtfile, str(self.pbes)) # run_txt2pbes(txtfile, pbesfile) # text = run_pbespp(pbesfile) # write_text(txtfile, text) print '--- %s counter example ---' % self.name print text self.counter = self.counter + 1
def main(): cmdline_parser = argparse.ArgumentParser() cmdline_parser.add_argument('destination', metavar='DIR', type=str, help='the output directory') cmdline_parser.add_argument('--equation-count', metavar='VALUE', type=int, action='store', help='the number of equations', default=4) cmdline_parser.add_argument('--atom-count', metavar='VALUE', type=int, action='store', help='the number of atoms', default='5') cmdline_parser.add_argument('--propvar-count', metavar='VALUE', type=int, action='store', help='the number of atoms', default='3') cmdline_parser.add_argument("--no-use-quantifiers", help="disable the generation of quantifiers", action="store_true", default=False) cmdline_parser.add_argument("--no-use-integers", help="disable the generation of integers", action="store_true", default=False) cmdline_parser.add_argument('-r', '--repetitions', dest='repetitions', type=int, metavar='N', default=10, help='generate N instances') args = cmdline_parser.parse_args() for i in range(args.repetitions): file = os.path.join(args.destination, '{}.txt'.format(i)) pbes = make_pbes(args.equation_count, args.atom_count, args.propvar_count, not args.no_use_quantifiers, not args.no_use_integers) write_text(file, str(pbes))
def run(self): import popen # Singlecore run tasks = self.remaining_tasks() commands = [] while len(tasks) > 0: tool = tasks[0] try: commands.append(tool.command()) returncode = tool.execute(timeout = self.timeout, memlimit = self.memlimit, verbose = self.verbose) if returncode != 0 and not self.allow_non_zero_return_values: raise RuntimeError('The execution of tool {} ended with return code {}'.format(tool.name, returncode)) except popen.MemoryExceededError as e: if self.verbose: print 'Memory limit exceeded: ' + str(e) self.cleanup() return None except popen.TimeExceededError as e: if self.verbose: print 'Time limit exceeded: ' + str(e) self.cleanup() return None except popen.StackOverflowError as e: if self.verbose: print 'Stack overflow detected during execution of the tool ' + tool.name self.cleanup() return None tasks = self.remaining_tasks() if not all(tool.executed for tool in self.tools): not_executed = [tool for tool in self.tools if not tool.executed] raise UnusedToolsError(not_executed) else: for node in self.nodes: if not os.path.exists(node.filename()): raise RuntimeError('Error in test {}: output file {} is missing!'.format(self.name, node.filename())) write_text('commands', '\n'.join(commands)) result = self.result() self.cleanup() return result
def run_pbes_test(name, testfile, p, settings): filename = '{0}.txt'.format(name) write_text(filename, str(p)) inputfiles = [filename] result = run_yml_test(name, testfile, inputfiles, settings) os.remove(filename)
def create_inputfiles(self, runpath = '.'): filename = '{0}.txt'.format(self.name, self.settings) p = make_bes(self.equation_count, self.term_size) write_text(filename, str(p)) self.inputfiles += [filename]
def create_inputfiles(self, runpath = '.'): super(Pbessolve_counter_exampleTest, self).create_inputfiles(runpath) filename = '{0}.mcf'.format(self.name, self.settings) formula = random_state_formula_generator.make_modal_formula() write_text(filename, str(formula)) self.inputfiles += [filename]