Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/tools/compiletest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,17 @@ fn parse_config(args: Vec<String>) -> Config {
}
}

let target = opt_str2(matches.opt_str("target"));
let host = matches.opt_str("host").expect("`--host` must be unconditionally specified");
let target = matches.opt_str("target").expect("`--target` must be unconditionally specified");

let android_cross_path = matches.opt_str("android-cross-path").map(Utf8PathBuf::from);

// FIXME: `adb_path` should be an `Option<Utf8PathBuf>`...
let adb_path = matches.opt_str("adb-path").map(Utf8PathBuf::from).unwrap_or_default();
// FIXME: `adb_test_dir` should be an `Option<Utf8PathBuf>`...
let adb_test_dir = matches.opt_str("adb-test-dir").map(Utf8PathBuf::from).unwrap_or_default();
let adb_device_status = target.contains("android") && !adb_test_dir.as_str().is_empty();
Copy link
Member Author

@jieyouxu jieyouxu Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remark: now that I think about it, this should just give up if the test suite is expecting adb && adb_test_dir but said device isn't available...? I can see the only place using this is in run(), this is some funky logic...


// FIXME: `cdb_version` is *derived* from cdb, but it's *not* technically a config!
let cdb = debuggers::discover_cdb(matches.opt_str("cdb"), &target);
let cdb_version = cdb.as_deref().and_then(debuggers::query_cdb_version);
Expand Down Expand Up @@ -433,7 +442,7 @@ fn parse_config(args: Vec<String>) -> Config {
optimize_tests: matches.opt_present("optimize-tests"),
rust_randomized_layout: matches.opt_present("rust-randomized-layout"),
target,
host: opt_str2(matches.opt_str("host")),
host,
cdb,
cdb_version,
gdb,
Expand All @@ -443,11 +452,9 @@ fn parse_config(args: Vec<String>) -> Config {
llvm_version,
system_llvm: matches.opt_present("system-llvm"),
android_cross_path,
adb_path: Utf8PathBuf::from(opt_str2(matches.opt_str("adb-path"))),
adb_test_dir: Utf8PathBuf::from(opt_str2(matches.opt_str("adb-test-dir"))),
adb_device_status: opt_str2(matches.opt_str("target")).contains("android")
&& "(none)" != opt_str2(matches.opt_str("adb-test-dir"))
&& !opt_str2(matches.opt_str("adb-test-dir")).is_empty(),
adb_path,
adb_test_dir,
adb_device_status,
verbose: matches.opt_present("verbose"),
only_modified: matches.opt_present("only-modified"),
color,
Expand Down Expand Up @@ -493,13 +500,6 @@ fn parse_config(args: Vec<String>) -> Config {
}
}

fn opt_str2(maybestr: Option<String>) -> String {
match maybestr {
None => "(none)".to_owned(),
Some(s) => s,
}
}

/// Called by `main` after the config has been parsed.
fn run_tests(config: Arc<Config>) {
debug!(?config, "run_tests");
Expand Down
Loading