Skip to content

Commit 16e1968

Browse files
committed
WIP: re-enable tests for Elf64_Phdr
1 parent 424987f commit 16e1968

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

libc-test/build.rs

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,8 +2473,8 @@ fn test_linux(target: &str) {
24732473
// FIXME: is this necessary?
24742474
"sighandler_t" => true,
24752475

2476-
// FIXME: these types have a p_type member but some header
2477-
// has a define p_type __p_type macro that breaks their tests:
2476+
// These cannot be tested when "resolv.h" is included and are tested
2477+
// below.
24782478
"Elf64_Phdr" | "Elf32_Phdr" => true,
24792479

24802480
_ => false,
@@ -2486,8 +2486,8 @@ fn test_linux(target: &str) {
24862486
// FIXME: is this necessary?
24872487
"sockaddr_nl" if musl => true,
24882488

2489-
// FIXME: these types have a p_type member but some header
2490-
// has a define p_type __p_type macro that breaks their tests:
2489+
// These cannot be tested when "resolv.h" is included and are tested
2490+
// below.
24912491
"Elf64_Phdr" | "Elf32_Phdr" => true,
24922492

24932493
// On Linux, the type of `ut_tv` field of `struct utmpx`
@@ -2818,4 +2818,27 @@ fn test_linux(target: &str) {
28182818
t => t.to_string(),
28192819
});
28202820
cfg.generate("../src/lib.rs", "linux_fcntl.rs");
2821+
2822+
// Test Elf64_Phdr and Elf32_Phdr
2823+
// These types have a field called `p_type`, but including
2824+
// "resolve.h" defines a `p_type` macro that expands to `__p_type`
2825+
// making the tests for these fails when both are included.
2826+
let mut cfg = ctest::TestGenerator::new();
2827+
cfg.skip_fn(|_| true)
2828+
.skip_const(|_| true)
2829+
.skip_static(|_| true);
2830+
cfg.skip_struct(move |ty| {
2831+
match ty {
2832+
"Elf64_Phdr" | "Elf32_Phdr" => false,
2833+
_ => true,
2834+
}
2835+
});
2836+
cfg.skip_type(move |ty| {
2837+
match ty {
2838+
"Elf64_Phdr" | "Elf32_Phdr" => false,
2839+
_ => true,
2840+
}
2841+
});
2842+
cfg.header("linux/elf.h");
2843+
cfg.generate("../src/lib.rs", "linux_elf.rs");
28212844
}

0 commit comments

Comments
 (0)