Skip to content

Commit 19f0f76

Browse files
authored
Unrolled build for #149754
Rollup merge of #149754 - jieyouxu:compiletest-cli, r=Zalathar Retire `opt_str2` from compiletest cli parsing We have `Option<..>`, we don't need to invent "(none)" as option-at-home. - More specifically, when some test suite expect certain values to be present, they should `.expect(..)` the value, and not potentially receive some "(none)" in some cases. r? Zalathar
2 parents 018d269 + 72541e9 commit 19f0f76

File tree

1 file changed

+14
-14
lines changed
  • src/tools/compiletest/src

1 file changed

+14
-14
lines changed

src/tools/compiletest/src/lib.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,17 @@ fn parse_config(args: Vec<String>) -> Config {
255255
}
256256
}
257257

258-
let target = opt_str2(matches.opt_str("target"));
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+
259261
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+
260269
// FIXME: `cdb_version` is *derived* from cdb, but it's *not* technically a config!
261270
let cdb = debuggers::discover_cdb(matches.opt_str("cdb"), &target);
262271
let cdb_version = cdb.as_deref().and_then(debuggers::query_cdb_version);
@@ -433,7 +442,7 @@ fn parse_config(args: Vec<String>) -> Config {
433442
optimize_tests: matches.opt_present("optimize-tests"),
434443
rust_randomized_layout: matches.opt_present("rust-randomized-layout"),
435444
target,
436-
host: opt_str2(matches.opt_str("host")),
445+
host,
437446
cdb,
438447
cdb_version,
439448
gdb,
@@ -443,11 +452,9 @@ fn parse_config(args: Vec<String>) -> Config {
443452
llvm_version,
444453
system_llvm: matches.opt_present("system-llvm"),
445454
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(),
455+
adb_path,
456+
adb_test_dir,
457+
adb_device_status,
451458
verbose: matches.opt_present("verbose"),
452459
only_modified: matches.opt_present("only-modified"),
453460
color,
@@ -493,13 +500,6 @@ fn parse_config(args: Vec<String>) -> Config {
493500
}
494501
}
495502

496-
fn opt_str2(maybestr: Option<String>) -> String {
497-
match maybestr {
498-
None => "(none)".to_owned(),
499-
Some(s) => s,
500-
}
501-
}
502-
503503
/// Called by `main` after the config has been parsed.
504504
fn run_tests(config: Arc<Config>) {
505505
debug!(?config, "run_tests");

0 commit comments

Comments
 (0)