Skip to content

Commit 5a1ae7a

Browse files
committed
test(trim-paths): add test for each split-debuginfo options
1 parent 371c45d commit 5a1ae7a

File tree

1 file changed

+44
-10
lines changed

1 file changed

+44
-10
lines changed

tests/testsuite/profile_trim_paths.rs

+44-10
Original file line numberDiff line numberDiff line change
@@ -453,29 +453,61 @@ fn diagnostics_works() {
453453
}
454454

455455
#[cfg(target_os = "macos")]
456-
#[cargo_test(requires_nm, nightly, reason = "-Zremap-path-scope is unstable")]
457-
fn object_works() {
458-
object_works_helper("off", |path| {
456+
mod object_works {
457+
use super::*;
458+
459+
fn inspect_debuginfo(path: &std::path::Path) -> Vec<u8> {
459460
std::process::Command::new("nm")
460461
.arg("-pa")
461462
.arg(path)
462463
.output()
463464
.expect("nm works")
464465
.stdout
465-
})
466+
}
467+
468+
#[cargo_test(requires_nm, nightly, reason = "-Zremap-path-scope is unstable")]
469+
fn with_split_debuginfo_off() {
470+
object_works_helper("off", inspect_debuginfo);
471+
}
472+
473+
#[cargo_test(requires_nm, nightly, reason = "-Zremap-path-scope is unstable")]
474+
fn with_split_debuginfo_packed() {
475+
object_works_helper("packed", inspect_debuginfo);
476+
}
477+
478+
#[cargo_test(requires_nm, nightly, reason = "-Zremap-path-scope is unstable")]
479+
fn with_split_debuginfo_unpacked() {
480+
object_works_helper("packed", inspect_debuginfo);
481+
}
466482
}
467483

468484
#[cfg(target_os = "linux")]
469-
#[cargo_test(requires_readelf, nightly, reason = "-Zremap-path-scope is unstable")]
470-
fn object_works() {
471-
object_works_helper("off", |path| {
485+
mod object_works {
486+
use super::*;
487+
488+
fn inspect_debuginfo(path: &std::path::Path) -> Vec<u8> {
472489
std::process::Command::new("readelf")
473490
.arg("-wi")
474491
.arg(path)
475492
.output()
476493
.expect("readelf works")
477494
.stdout
478-
})
495+
}
496+
497+
#[cargo_test(requires_readelf, nightly, reason = "-Zremap-path-scope is unstable")]
498+
fn with_split_debuginfo_off() {
499+
object_works_helper("off", inspect_debuginfo);
500+
}
501+
502+
#[cargo_test(requires_readelf, nightly, reason = "-Zremap-path-scope is unstable")]
503+
fn with_split_debuginfo_packed() {
504+
object_works_helper("packed", inspect_debuginfo);
505+
}
506+
507+
#[cargo_test(requires_readelf, nightly, reason = "-Zremap-path-scope is unstable")]
508+
fn with_split_debuginfo_unpacked() {
509+
object_works_helper("packed", inspect_debuginfo);
510+
}
479511
}
480512

481513
#[cfg(unix)]
@@ -495,7 +527,8 @@ fn object_works_helper(split_debuginfo: &str, run: impl Fn(&std::path::Path) ->
495527
let p = project()
496528
.file(
497529
"Cargo.toml",
498-
&format!(r#"
530+
&format!(
531+
r#"
499532
[package]
500533
name = "foo"
501534
version = "0.0.1"
@@ -505,7 +538,8 @@ fn object_works_helper(split_debuginfo: &str, run: impl Fn(&std::path::Path) ->
505538
506539
[profile.dev]
507540
split-debuginfo = "{split_debuginfo}"
508-
"#),
541+
"#
542+
),
509543
)
510544
.file("src/main.rs", "fn main() { bar::f(); }")
511545
.build();

0 commit comments

Comments
 (0)