Rollup merge of #124501 - VladimirMakaev:add-lldb-to-config-toml, r=Mark-Simulacrum

add support to override lldb binary path for ./x test

When running debuginfo tests I couldn't set custom build of lldb. The `src/bootstrap/src/core/build_steps/test.rs` has "lldb" hardcoded. I ended up hacking `src/bootstrap/src/core/build_steps/test.rs` just to get the tests running the way I wanted.

Then I've found out that we can override `gdb` under [build] section. This PR enables the same for `lldb`
This commit is contained in:
Matthias Krüger 2024-05-04 22:27:30 +02:00 committed by GitHub
commit 43a5e3fb95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 3 deletions

View File

@ -254,6 +254,10 @@
# executing the debuginfo test suite.
#gdb = "gdb"
# The path to (or name of) the LLDB executable to use. This is only used for
# executing the debuginfo test suite.
#lldb = "lldb"
# The node.js executable to use. Note that this is only used for the emscripten
# target when running tests, otherwise this can be omitted.
#nodejs = "node"

View File

@ -1892,15 +1892,16 @@ fn run(self, builder: &Builder<'_>) {
.to_string()
})
};
let lldb_exe = "lldb";
let lldb_version = Command::new(lldb_exe)
let lldb_exe = builder.config.lldb.clone().unwrap_or_else(|| PathBuf::from("lldb"));
let lldb_version = Command::new(&lldb_exe)
.arg("--version")
.output()
.map(|output| String::from_utf8_lossy(&output.stdout).to_string())
.ok();
if let Some(ref vers) = lldb_version {
cmd.arg("--lldb-version").arg(vers);
let lldb_python_dir = run(Command::new(lldb_exe).arg("-P")).ok();
let lldb_python_dir = run(Command::new(&lldb_exe).arg("-P")).ok();
if let Some(ref dir) = lldb_python_dir {
cmd.arg("--lldb-python-dir").arg(dir);
}

View File

@ -329,6 +329,7 @@ pub struct Config {
pub nodejs: Option<PathBuf>,
pub npm: Option<PathBuf>,
pub gdb: Option<PathBuf>,
pub lldb: Option<PathBuf>,
pub python: Option<PathBuf>,
pub reuse: Option<PathBuf>,
pub cargo_native_static: bool,
@ -834,6 +835,7 @@ struct Build {
docs_minification: Option<bool> = "docs-minification",
submodules: Option<bool> = "submodules",
gdb: Option<String> = "gdb",
lldb: Option<String> = "lldb",
nodejs: Option<String> = "nodejs",
npm: Option<String> = "npm",
python: Option<String> = "python",
@ -1410,6 +1412,7 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
docs_minification,
submodules,
gdb,
lldb,
nodejs,
npm,
python,
@ -1502,6 +1505,7 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
config.nodejs = nodejs.map(PathBuf::from);
config.npm = npm.map(PathBuf::from);
config.gdb = gdb.map(PathBuf::from);
config.lldb = lldb.map(PathBuf::from);
config.python = python.map(PathBuf::from);
config.reuse = reuse.map(PathBuf::from);
config.submodules = submodules;

View File

@ -175,4 +175,9 @@ pub fn human_readable_changes(changes: &[ChangeInfo]) -> String {
severity: ChangeSeverity::Warning,
summary: "The deprecated field `changelog-seen` has been removed. Using that field in `config.toml` from now on will result in breakage.",
},
ChangeInfo {
change_id: 124501,
severity: ChangeSeverity::Info,
summary: "New option `build.lldb` that will override the default lldb binary path used in debuginfo tests",
},
];