def main(): SetupDefaultLoggingConfig() arg_parser = argparse.ArgumentParser() command_line.AddLauncherArguments(arg_parser) arg_parser.add_argument( "-t", "--target_name", required=True, help="Name of executable target.") launcher_params = command_line.CreateLauncherParams(arg_parser) launcher = abstract_launcher.LauncherFactory( launcher_params.platform, launcher_params.target_name, launcher_params.config, device_id=launcher_params.device_id, target_params=launcher_params.target_params, out_directory=launcher_params.out_directory, loader_platform=launcher_params.loader_platform, loader_config=launcher_params.loader_config, loader_out_directory=launcher_params.loader_out_directory) def Abort(signum, frame): del signum, frame # Unused. sys.stderr.write("Killing thread\n") launcher.Kill() sys.exit(1) signal.signal(signal.SIGINT, Abort) return launcher.Run()
def main(): SetupDefaultLoggingConfig() parser = command_line.CreateParser() parser.add_argument("-t", "--target_name", required=True, help="Name of executable target.") args = parser.parse_args() target_params = [] if args.target_params: target_params = args.target_params.split(" ") launcher = abstract_launcher.LauncherFactory( args.platform, args.target_name, args.config, device_id=args.device_id, target_params=target_params, out_directory=args.out_directory) def Abort(signum, frame): del signum, frame # Unused. sys.stderr.write("Killing thread\n") launcher.Kill() sys.exit(1) signal.signal(signal.SIGINT, Abort) return launcher.Run()
def main(): SetupDefaultLoggingConfig() parser = _CreateArgumentParser() args, unknown_args = parser.parse_known_args() if unknown_args: logging.warning('Unknown (ignored) args: %s', unknown_args) if args.create: _MakeCobaltPlatformArchive( platform=args.platform, config=args.config, output_zip=os.path.normpath(args.out_path), include_black_box_tests=args.include_black_box_tests) sys.exit(0) elif args.extract: ok = _DecompressArchive(args.in_path, args.out_path) rc = 0 if ok else 1 sys.exit(rc) else: parser.print_help()
def main(): SetupDefaultLoggingConfig() arg_parser = command_line.CreateParser() arg_parser.add_argument( "-b", "--build", action="store_true", help="Specifies whether to build the tests.") arg_parser.add_argument( "-r", "--run", action="store_true", help="Specifies whether to run the tests." " If both the \"--build\" and \"--run\" flags are not" " provided, this is the default.") arg_parser.add_argument( "-n", "--dry_run", action="store_true", help="Specifies to show what would be done without actually doing it.") arg_parser.add_argument( "-t", "--target_name", action="append", help="Name of executable target. Repeatable for multiple targets.") arg_parser.add_argument( "--platform_tests_only", action="store_true", help="Runs only a small set of tests involved testing the platform.") arg_parser.add_argument( "-a", "--application_name", default="cobalt", # TODO: Pass this in explicitly. help="Name of the application to run tests under, e.g. 'cobalt'.") arg_parser.add_argument( "--ninja_flags", help="Flags to pass to the ninja build system. Provide them exactly" " as you would on the command line between a set of double quotation" " marks.") arg_parser.add_argument( "-x", "--xml_output_dir", help="If defined, results will be saved as xml files in given directory." " Output for each test suite will be in it's own subdirectory and file:" " <xml_output_dir>/<test_suite_name>/sponge_log.xml") arg_parser.add_argument( "-l", "--log_xml_results", action="store_true", help="If set, results will be logged in xml format after all tests are" " complete. --xml_output_dir will be ignored.") args = arg_parser.parse_args() # Extra arguments for the test target target_params = [] if args.target_params: target_params = args.target_params.split(" ") runner = TestRunner(args.platform, args.config, args.device_id, args.target_name, target_params, args.out_directory, args.platform_tests_only, args.application_name, args.dry_run, args.xml_output_dir, args.log_xml_results) def Abort(signum, frame): del signum, frame # Unused. sys.stderr.write("Killing threads\n") for active_thread in runner.threads: active_thread.Kill() sys.exit(1) signal.signal(signal.SIGINT, Abort) # If neither build nor run has been specified, assume the client # just wants to run. if not args.build and not args.run: args.run = True build_success = True run_success = True if args.dry_run: sys.stderr.write("=== Dry run ===\n") if args.build: build_success = runner.BuildAllTests(args.ninja_flags) # If the build fails, don't try to run the tests. if not build_success: return 1 if args.run: run_success = runner.RunAllTests() # If either step has failed, count the whole test run as failed. if not build_success or not run_success: return 1 else: return 0