@@ -255,13 +255,23 @@ fn parse_config(args: Vec<String>) -> Config {
255255 }
256256 }
257257
258- let target = opt_str2 ( matches. opt_str ( "target" ) ) ;
259- let android_cross_path = opt_path ( matches, "android-cross-path" ) ;
258+ let host = matches. opt_str ( "host" ) . expect ( "`--host` must be unconditionally specified" ) ;
259+ let target = matches. opt_str ( "target" ) . expect ( "`--target` must be unconditionally specified" ) ;
260+
261+ let android_cross_path = matches. opt_str ( "android-cross-path" ) . map ( Utf8PathBuf :: from) ;
262+
263+ // FIXME: `adb_path` should be an `Option<Utf8PathBuf>`...
264+ let adb_path = matches. opt_str ( "adb-path" ) . map ( Utf8PathBuf :: from) . unwrap_or_default ( ) ;
265+ // FIXME: `adb_test_dir` should be an `Option<Utf8PathBuf>`...
266+ let adb_test_dir = matches. opt_str ( "adb-test-dir" ) . map ( Utf8PathBuf :: from) . unwrap_or_default ( ) ;
267+ let adb_device_status = target. contains ( "android" )
268+ && matches. opt_str ( "adb-test-dir" ) . is_some_and ( |p| !p. is_empty ( ) ) ;
269+
260270 // FIXME: `cdb_version` is *derived* from cdb, but it's *not* technically a config!
261271 let cdb = debuggers:: discover_cdb ( matches. opt_str ( "cdb" ) , & target) ;
262272 let cdb_version = cdb. as_deref ( ) . and_then ( debuggers:: query_cdb_version) ;
263273 // FIXME: `gdb_version` is *derived* from gdb, but it's *not* technically a config!
264- let gdb = debuggers :: discover_gdb ( matches. opt_str ( "gdb" ) , & target , & android_cross_path ) ;
274+ let gdb = matches. opt_str ( "gdb" ) . map ( Utf8PathBuf :: from ) ;
265275 let gdb_version = gdb. as_deref ( ) . and_then ( debuggers:: query_gdb_version) ;
266276 // FIXME: `lldb_version` is *derived* from lldb, but it's *not* technically a config!
267277 let lldb = matches. opt_str ( "lldb" ) . map ( Utf8PathBuf :: from) ;
@@ -433,7 +443,7 @@ fn parse_config(args: Vec<String>) -> Config {
433443 optimize_tests : matches. opt_present ( "optimize-tests" ) ,
434444 rust_randomized_layout : matches. opt_present ( "rust-randomized-layout" ) ,
435445 target,
436- host : opt_str2 ( matches . opt_str ( "host" ) ) ,
446+ host,
437447 cdb,
438448 cdb_version,
439449 gdb,
@@ -443,11 +453,9 @@ fn parse_config(args: Vec<String>) -> Config {
443453 llvm_version,
444454 system_llvm : matches. opt_present ( "system-llvm" ) ,
445455 android_cross_path,
446- adb_path : Utf8PathBuf :: from ( opt_str2 ( matches. opt_str ( "adb-path" ) ) ) ,
447- adb_test_dir : Utf8PathBuf :: from ( opt_str2 ( matches. opt_str ( "adb-test-dir" ) ) ) ,
448- adb_device_status : opt_str2 ( matches. opt_str ( "target" ) ) . contains ( "android" )
449- && "(none)" != opt_str2 ( matches. opt_str ( "adb-test-dir" ) )
450- && !opt_str2 ( matches. opt_str ( "adb-test-dir" ) ) . is_empty ( ) ,
456+ adb_path,
457+ adb_test_dir,
458+ adb_device_status,
451459 verbose : matches. opt_present ( "verbose" ) ,
452460 only_modified : matches. opt_present ( "only-modified" ) ,
453461 color,
@@ -493,13 +501,6 @@ fn parse_config(args: Vec<String>) -> Config {
493501 }
494502}
495503
496- fn opt_str2 ( maybestr : Option < String > ) -> String {
497- match maybestr {
498- None => "(none)" . to_owned ( ) ,
499- Some ( s) => s,
500- }
501- }
502-
503504/// Called by `main` after the config has been parsed.
504505fn run_tests ( config : Arc < Config > ) {
505506 debug ! ( ?config, "run_tests" ) ;
0 commit comments