Skip to content

Commit e9f3603

Browse files
committed
Only pass debugger-related flags for debuginfo tests
1 parent 2044a5f commit e9f3603

File tree

1 file changed

+35
-29
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+35
-29
lines changed

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,27 +2078,43 @@ Please disable assertions with `rust.debug-assertions = false`.
20782078

20792079
cmd.arg("--python").arg(builder.python());
20802080

2081-
if let Some(ref gdb) = builder.config.gdb {
2082-
cmd.arg("--gdb").arg(gdb);
2083-
}
2084-
2085-
let lldb_exe = builder.config.lldb.clone().unwrap_or_else(|| PathBuf::from("lldb"));
2086-
let lldb_version = command(&lldb_exe)
2087-
.allow_failure()
2088-
.arg("--version")
2089-
.run_capture(builder)
2090-
.stdout_if_ok()
2091-
.and_then(|v| if v.trim().is_empty() { None } else { Some(v) });
2092-
if let Some(ref vers) = lldb_version {
2093-
cmd.arg("--lldb-version").arg(vers);
2094-
let lldb_python_dir = command(&lldb_exe)
2081+
// FIXME(#148099): Currently we set these Android-related flags in all
2082+
// modes, even though they should only be needed in "debuginfo" mode,
2083+
// because the GDB-discovery code in compiletest currently assumes that
2084+
// `--android-cross-path` is always set for Android targets.
2085+
cmd.arg("--adb-path").arg("adb");
2086+
cmd.arg("--adb-test-dir").arg(ADB_TEST_DIR);
2087+
if target.contains("android") && !builder.config.dry_run() {
2088+
// Assume that cc for this target comes from the android sysroot
2089+
cmd.arg("--android-cross-path")
2090+
.arg(builder.cc(target).parent().unwrap().parent().unwrap());
2091+
} else {
2092+
cmd.arg("--android-cross-path").arg("");
2093+
}
2094+
2095+
if mode == "debuginfo" {
2096+
if let Some(ref gdb) = builder.config.gdb {
2097+
cmd.arg("--gdb").arg(gdb);
2098+
}
2099+
2100+
let lldb_exe = builder.config.lldb.clone().unwrap_or_else(|| PathBuf::from("lldb"));
2101+
let lldb_version = command(&lldb_exe)
20952102
.allow_failure()
2096-
.arg("-P")
2097-
.run_capture_stdout(builder)
2103+
.arg("--version")
2104+
.run_capture(builder)
20982105
.stdout_if_ok()
2099-
.map(|p| p.lines().next().expect("lldb Python dir not found").to_string());
2100-
if let Some(ref dir) = lldb_python_dir {
2101-
cmd.arg("--lldb-python-dir").arg(dir);
2106+
.and_then(|v| if v.trim().is_empty() { None } else { Some(v) });
2107+
if let Some(ref vers) = lldb_version {
2108+
cmd.arg("--lldb-version").arg(vers);
2109+
let lldb_python_dir = command(&lldb_exe)
2110+
.allow_failure()
2111+
.arg("-P")
2112+
.run_capture_stdout(builder)
2113+
.stdout_if_ok()
2114+
.map(|p| p.lines().next().expect("lldb Python dir not found").to_string());
2115+
if let Some(ref dir) = lldb_python_dir {
2116+
cmd.arg("--lldb-python-dir").arg(dir);
2117+
}
21022118
}
21032119
}
21042120

@@ -2332,16 +2348,6 @@ Please disable assertions with `rust.debug-assertions = false`.
23322348

23332349
cmd.env("RUST_TEST_TMPDIR", builder.tempdir());
23342350

2335-
cmd.arg("--adb-path").arg("adb");
2336-
cmd.arg("--adb-test-dir").arg(ADB_TEST_DIR);
2337-
if target.contains("android") && !builder.config.dry_run() {
2338-
// Assume that cc for this target comes from the android sysroot
2339-
cmd.arg("--android-cross-path")
2340-
.arg(builder.cc(target).parent().unwrap().parent().unwrap());
2341-
} else {
2342-
cmd.arg("--android-cross-path").arg("");
2343-
}
2344-
23452351
if builder.config.cmd.rustfix_coverage() {
23462352
cmd.arg("--rustfix-coverage");
23472353
}

0 commit comments

Comments
 (0)