def main(): """Checks the interoperability of Python and C++ passes.""" g = graph.PyGraph() config = {} p_manager = stepmanager.StepManager(g, config, provides=provide) p_manager.execute(['Test3Step'])
def main(): g = graph.PyGraph() os_name = sys.argv[1] json_file = sys.argv[2] i_file = sys.argv[3] print("Testing with", i_file, "and json:", json_file, "and os: ", os_name) with open(json_file) as f: warnings = json.load(f) config = {'os': os_name, 'input_files': [i_file]} p_manager = stepmanager.StepManager(g, config) p_manager.execute(['ValidationStep','DisplayResultsStep']) val_step = p_manager.get_step('ValidationStep') side_data = val_step.get_side_data() #TODO ABB3 nicht im kritischen Bereich for tmp in side_data: print('critical side data',tmp['location'].get_name()) assert len(warnings) == len(side_data) for should, have in zip(warnings, side_data): assert should['type'] == have['type'] assert should['location'] == have['location'].get_name()
def main(): g = graph.PyGraph() config = {} p_manager = stepmanager.StepManager(g, config, provides=provide) global shared_state # standard tests p_manager.execute(['Test8Step']) assert(shared_state == tests[0]) shared_state = "" p_manager.execute(['Test9Step']) assert(shared_state == tests[1]) shared_state = "" p_manager.execute(['Test8Step', 'Test9Step']) assert(shared_state == tests[2]) shared_state = "" # conditinal tests config['cond'] = False p_manager.execute(['TestDep1']) assert(shared_state == 'Run: TestDep1\n') shared_state = "" config['cond'] = True p_manager.execute(['TestDep1']) assert(shared_state == 'Run: TestDep0\nRun: TestDep1\n') shared_state = ""
def main(): s_dir = os.path.dirname(os.path.realpath(__file__)) logging.basicConfig(level=logging.DEBUG) for file, oil, validate in TESTS: g = graph.PyGraph() config = {'oilfile': oil, 'os': 'osek', 'input_files': [file]} p_manager = stepmanager.StepManager(g, config) p_manager.execute(['OilStep']) validate(g)
def init_test(): """CLI usage: your_program <os_name> <json_file> <ll_file>""" g = graph.PyGraph() os_name = sys.argv[1] json_file = sys.argv[2] i_file = sys.argv[3] print("Testing with", i_file, "and json:", json_file, "and os: ", os_name) with open(json_file) as f: data = json.load(f) config = {'os': os_name, 'input_files': [i_file]} s_manager = stepmanager.StepManager(g, config) s_manager.execute(['ValidationStep']) return g, data, s_manager
import pyximport pyximport.install() import graph g = graph.PyGraph() n1 = g.add_node(1) n2 = g.add_node(2) n3 = g.add_node(3) n4 = g.add_node(4) g.add_edge(n1, n2) g.add_edge(n2, n3) g.add_edge(n1, n3) g.add_edge(n2, n4) g.add_edge(n4, n3) for n in g.nodes(): print n, "has", n.degree(), "edges" for e in n.edges(): print " ", e
def main(dataLoc, stationName): cc = graph.PyGraph(dataLoc, stationName) routes = cc.routeAtStation() print(routes, sep="\n")
def main(): """Entry point for ARSA.""" parser = argparse.ArgumentParser( prog=sys.argv[0], description=sys.modules[__name__].__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('--verbose', '-v', help="alias for --log-level=info", action="store_true", default=False) parser.add_argument('--log-level', help="choose the log level", choices=['warn', 'info', 'debug'], default='warn') parser.add_argument('--os', '-O', help="specify the operation system", choices=['freertos', 'osek'], default='osek') parser.add_argument('--step', '-s', help="choose steps that will be executed", action='append') parser.add_argument('--list-steps', '-l', action="store_true", default=False, help="list all available steps") parser.add_argument('input_files', help="all LLVM-IR input files", nargs='*') parser.add_argument('--oilfile', help="name of oilfile") args = parser.parse_args() # logging if args.log_level != 'debug' and args.verbose: args.log_level = 'info' log_levels = { 'debug': logging.DEBUG, 'info': logging.INFO, 'warn': logging.WARNING } _format = '%(asctime)s %(levelname)-7s %(name)-12s%(message)s' logging.basicConfig(format=_format, level=log_levels[args.log_level]) g = graph.PyGraph() s_manager = stepmanager.StepManager(g, vars(args)) avail_steps = s_manager.get_steps() if args.list_steps: print(print_avail_steps(avail_steps)) sys.exit(0) elif not args.input_files: parser.error('input_files are required (except -l or -h is set)') elif args.os == 'OSEK' and not args.oilfile: parser.error('when analyzing OSEK and oilfile is required') logging.debug("Processing files: %s", ', '.join(args.input_files)) if args.step is None: args.step = ['DisplayResultsStep'] if len(set(args.step) & set([s.get_name() for s in avail_steps])) == 0: msg = 'Invalid step for --step. {}'.format( print_avail_steps(avail_steps)) parser.error(msg) logging.debug("Executing steps: %s", ', '.join(args.step)) s_manager.execute(args.step)