Skip to content

Commit 4f4d620

Browse files
committed
compiletest: Allow using a specific debugger when running debuginfo tests
1 parent 4c40c89 commit 4f4d620

File tree

1 file changed

+23
-6
lines changed
  • src/tools/compiletest/src

1 file changed

+23
-6
lines changed

Diff for: src/tools/compiletest/src/lib.rs

+23-6
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use walkdir::WalkDir;
3737

3838
use self::header::{EarlyProps, make_test_description};
3939
use crate::common::{
40-
CompareMode, Config, Mode, PassMode, TestPaths, UI_EXTENSIONS, expected_output_path,
40+
CompareMode, Config, Debugger, Mode, PassMode, TestPaths, UI_EXTENSIONS, expected_output_path,
4141
output_base_dir, output_relative_path,
4242
};
4343
use crate::header::HeadersCache;
@@ -183,7 +183,13 @@ pub fn parse_config(args: Vec<String>) -> Config {
183183
"What custom diff tool to use for displaying compiletest tests.",
184184
"COMMAND",
185185
)
186-
.reqopt("", "minicore-path", "path to minicore aux library", "PATH");
186+
.reqopt("", "minicore-path", "path to minicore aux library", "PATH")
187+
.optopt(
188+
"",
189+
"debugger",
190+
"only test a specific debugger in debuginfo tests",
191+
"gdb | lldb | cdb",
192+
);
187193

188194
let (argv0, args_) = args.split_first().unwrap();
189195
if args.len() == 1 || args[1] == "-h" || args[1] == "--help" {
@@ -302,7 +308,11 @@ pub fn parse_config(args: Vec<String>) -> Config {
302308
stage_id: matches.opt_str("stage-id").unwrap(),
303309
mode,
304310
suite: matches.opt_str("suite").unwrap(),
305-
debugger: None,
311+
debugger: matches.opt_str("debugger").map(|debugger| {
312+
debugger
313+
.parse::<Debugger>()
314+
.unwrap_or_else(|_| panic!("unknown `--debugger` option `{debugger}` given"))
315+
}),
306316
run_ignored,
307317
with_rustc_debug_assertions,
308318
with_std_debug_assertions,
@@ -475,9 +485,16 @@ pub fn run_tests(config: Arc<Config>) {
475485
if let Mode::DebugInfo = config.mode {
476486
// Debugging emscripten code doesn't make sense today
477487
if !config.target.contains("emscripten") {
478-
configs.extend(debuggers::configure_cdb(&config));
479-
configs.extend(debuggers::configure_gdb(&config));
480-
configs.extend(debuggers::configure_lldb(&config));
488+
match config.debugger {
489+
Some(Debugger::Cdb) => configs.extend(debuggers::configure_cdb(&config)),
490+
Some(Debugger::Gdb) => configs.extend(debuggers::configure_gdb(&config)),
491+
Some(Debugger::Lldb) => configs.extend(debuggers::configure_lldb(&config)),
492+
None => {
493+
configs.extend(debuggers::configure_cdb(&config));
494+
configs.extend(debuggers::configure_gdb(&config));
495+
configs.extend(debuggers::configure_lldb(&config));
496+
}
497+
}
481498
}
482499
} else {
483500
configs.push(config.clone());

0 commit comments

Comments
 (0)