def build(ns): reporter = reporting.build(sum(ns.reporters, [])) ns.planners = ns.planners or [['Random']] plan = planning.build(sum(ns.planners, [])) stop = halting.build(ns.stop) model, actor = load_model_actor(ns) debugger = ns.debug and ns.debugger exe = execution.Executor(actor, reporter, debugger) context = { 'suite': ns.suite, 'test': ns.test, 'ns': ns, 'model': model, 'actor': actor, 'debugger': debugger, 'executor': exe, 'plan': plan, 'stop': stop, 'reporter': reporter, } context['context'] = context return context
def run(args): sys.path.append('') reporter = reporting.build(args.get('--reporter') or []) suite_name = args.get('--suite-name') or 'graphwalker' test_name = args.get('--test-name') or ( args['<model>'].rsplit('/', 1)[-1].split('.')[0] + '-' + time.strftime('%Y%m%d%H%M%S')) reporter.start_suite(suite_name) plan = planning.build(args.get('--planner') or ['Random']) stop = stopcond.build(args.get('--stopcond') or 'Coverage') model = graph.Graph.read(args['<model>']) actor = args.get('<actor>') or 'graphwalker.dummy.Mute' debugger = args.get('--debug') and args.get('--debugger') exe = executor.Executor(actor, reporter, debugger) context = {'args': args, 'plan': plan, 'stop': stop, 'actor': actor, 'reporter': reporter, 'executor': exe, 'model': model, 'debugger': debugger} stop.start(model, context) path = plan(model, stop, 'Start', context) exe.run(test_name, path, context) reporter.end_suite()
def run(args): sys.path.append('') modact = args['<model/actor>'] assert len(modact) > 1 reporter = reporting.build(args.get('--reporter') or []) suite_name = args.get('--suite-name') or 'graphwalker' test_name = args.get('--test-name') or (modact[0].rsplit( '/', 1)[-1].split('.')[0] + '-' + time.strftime('%Y%m%d%H%M%S')) reporter.start_suite(suite_name) plan = planning.build(args.get('--planner') or ['Random']) stop = stopcond.build(args.get('--stopcond') or 'Coverage') model = graph.Graph.read(modact[0]) for n in modact[1:-1]: model = model.combine(graph.Graph.read(n)) try: model = model.combine(graph.Graph.read(modact[-1])) actor = 'graphwalker.dummy.Mute' except: actor = modact[-1] debugger = args.get('--debug') and args.get('--debugger') exe = executor.Executor(actor, reporter, debugger) context = { 'args': args, 'plan': plan, 'stop': stop, 'actor': actor, 'reporter': reporter, 'executor': exe, 'model': model, 'debugger': debugger } stop.start(model, context) path = plan(model, stop, 'Start', context) exe.run(test_name, path, context) reporter.end_suite()