def GenerateDebugOutput(sim_name): Print.new_step("Generate debug output") # generates cmake_output.log and / or make_output.log (depends if cmake # ran sucessfully or not) if BuildCommand(debug=True): # generates runtime_output.log RunCommand(debug=True) # generates root dictionary log(s) CopyRootDictionaries() # generates system_info.log GenerateSystemInfoLog()
def RunCommand(args, debug=False): sim_name = GetBinaryName() args_str = ' '.join(args) cmd = "./build/" + sim_name try: BuildCommand() Print.new_step("Run " + sim_name + ' ' + args_str) if debug: sp.check_output([cmd, "&>", "debug/runtime_output.log"]) else: print( sp.check_output([cmd, args_str], stderr=sp.STDOUT).decode('utf-8')) Print.success("Finished successfully") except sp.CalledProcessError as err: print(err.output.decode("utf-8")) Print.error("Error during execution of {0}".format(cmd))
def RunCommand(args, debug=False): sim_name = GetBinaryName() args_str = " ".join(args) cmd = "./build/" + sim_name if platform.system() == "Darwin": launcher = os.environ["BDMSYS"] + "/bin/launcher.sh" else: launcher = "" try: BuildCommand() Print.new_step("Run " + sim_name + " " + args_str) if debug: sp.check_output( [launcher + " " + cmd, "&>", "debug/runtime_output.log"]) else: print( sp.check_output([launcher + " " + cmd, args_str], stderr=sp.STDOUT, shell=True).decode("utf-8")) Print.success("Finished successfully") except sp.CalledProcessError as err: print(err.output.decode("utf-8")) Print.error("Error during execution of {0}".format(cmd))
help='Create a Github repository.') run_sp = sp.add_parser('run', help='Executes the simulation') args, unknown = parser.parse_known_args() if args.cmd == 'new': if len(unknown) != 0: new_sp.print_help() sys.exit() NewCommand(args.SIMULATION_NAME, args.github) elif args.cmd == 'build': if len(unknown) != 0: build_sp.print_help() sys.exit() BuildCommand() elif args.cmd == 'clean': if len(unknown) != 0: clean_sp.print_help() sys.exit() BuildCommand(clean=True, build=False) elif args.cmd == 'demo': demo_name = None destination = None if len(unknown) >= 1: demo_name = unknown[0] if len(unknown) >= 2: destination = unknown[1] DemoCommand(demo_name, destination) elif args.cmd == 'run': RunCommand(args=unknown)