Skip to content

Commit da96ee6

Browse files
committed
compiletest: make presence/absence of adb-related options clear
Instead of possibly falling back to "(none)" when they are not specified.
1 parent 5e32540 commit da96ee6

File tree

1 file changed

+10
-5
lines changed
  • src/tools/compiletest/src

1 file changed

+10
-5
lines changed

src/tools/compiletest/src/lib.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,13 @@ fn parse_config(args: Vec<String>) -> Config {
259259
let target = matches.opt_str("target").expect("`--target` must be unconditionally specified");
260260

261261
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") && !adb_test_dir.as_str().is_empty();
268+
262269
// FIXME: `cdb_version` is *derived* from cdb, but it's *not* technically a config!
263270
let cdb = debuggers::discover_cdb(matches.opt_str("cdb"), &target);
264271
let cdb_version = cdb.as_deref().and_then(debuggers::query_cdb_version);
@@ -445,11 +452,9 @@ fn parse_config(args: Vec<String>) -> Config {
445452
llvm_version,
446453
system_llvm: matches.opt_present("system-llvm"),
447454
android_cross_path,
448-
adb_path: Utf8PathBuf::from(opt_str2(matches.opt_str("adb-path"))),
449-
adb_test_dir: Utf8PathBuf::from(opt_str2(matches.opt_str("adb-test-dir"))),
450-
adb_device_status: opt_str2(matches.opt_str("target")).contains("android")
451-
&& "(none)" != opt_str2(matches.opt_str("adb-test-dir"))
452-
&& !opt_str2(matches.opt_str("adb-test-dir")).is_empty(),
455+
adb_path,
456+
adb_test_dir,
457+
adb_device_status,
453458
verbose: matches.opt_present("verbose"),
454459
only_modified: matches.opt_present("only-modified"),
455460
color,

0 commit comments

Comments
 (0)