parser.add_argument("--trace", action="store_true", default=False, help="Trace: enable OpenCV tracing") parser.add_argument( "--trace_dump", metavar="trace_dump", default=-1, help= "Trace: dump highlight calls (specify max entries count, 0 - dump all)" ) args, other_args = parser.parse_known_args() log.setLevel(logging.DEBUG if args.verbose else logging.INFO) test_args = [ a for a in other_args if a.startswith("--perf_") or a.startswith("--gtest_") ] bad_args = [a for a in other_args if a not in test_args] if len(bad_args) > 0: log.error("Error: Bad arguments: %s", bad_args) exit(1) args.mode = "test" if args.accuracy else "perf" android_env = [] if args.android_env: android_env.extend([entry.split("=", 1) for entry in args.android_env])
# Android parser.add_argument("--android", action="store_true", default=False, help="Android: force all tests to run on device") parser.add_argument("--android_sdk", metavar="PATH", help="Android: path to SDK to use adb and aapt tools") parser.add_argument("--android_test_data_path", metavar="PATH", default="/sdcard/opencv_testdata/", help="Android: path to testdata on device") parser.add_argument("--android_env", action='append', help="Android: add environment variable (NAME=VALUE)") parser.add_argument("--android_propagate_opencv_env", action="store_true", default=False, help="Android: propagate OPENCV* environment variables") parser.add_argument("--serial", metavar="serial number", default="", help="Android: directs command to the USB device or emulator with the given serial number") parser.add_argument("--package", metavar="package", default="", help="Android: run jUnit tests for specified package") parser.add_argument("--trace", action="store_true", default=False, help="Trace: enable OpenCV tracing") parser.add_argument("--trace_dump", metavar="trace_dump", default=-1, help="Trace: dump highlight calls (specify max entries count, 0 - dump all)") args, other_args = parser.parse_known_args() log.setLevel(logging.DEBUG if args.verbose else logging.INFO) test_args = [a for a in other_args if a.startswith("--perf_") or a.startswith("--gtest_")] bad_args = [a for a in other_args if a not in test_args] if len(bad_args) > 0: log.error("Error: Bad arguments: %s", bad_args) exit(1) args.mode = "test" if args.accuracy else "perf" android_env = [] if args.android_env: android_env.extend([entry.split("=", 1) for entry in args.android_env]) if args.android_propagate_opencv_env: android_env.extend([entry for entry in os.environ.items() if entry[0].startswith('OPENCV')]) android_env = dict(android_env)