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
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)