Test the Elf32/64 types sperately

These types have a p_types field, but the resolv.h
header defines p_types __p_types macro that breaks them.
This commit is contained in:
gnzlbg 2019-05-15 07:59:38 +02:00
parent f67f831aad
commit bf76ded067
1 changed files with 34 additions and 0 deletions

View File

@ -2473,6 +2473,10 @@ fn test_linux(target: &str) {
// FIXME: is this necessary?
"sighandler_t" => true,
// These cannot be tested when "resolv.h" is included and are tested
// below.
"Elf64_Phdr" | "Elf32_Phdr" => true,
_ => false,
}
});
@ -2482,6 +2486,10 @@ fn test_linux(target: &str) {
// FIXME: is this necessary?
"sockaddr_nl" if musl => true,
// These cannot be tested when "resolv.h" is included and are tested
// below.
"Elf64_Phdr" | "Elf32_Phdr" => true,
// On Linux, the type of `ut_tv` field of `struct utmpx`
// can be an anonymous struct, so an extra struct,
// which is absent in glibc, has to be defined.
@ -2810,4 +2818,30 @@ fn test_linux(target: &str) {
t => t.to_string(),
});
cfg.generate("../src/lib.rs", "linux_fcntl.rs");
// Test Elf64_Phdr and Elf32_Phdr
// These types have a field called `p_type`, but including
// "resolve.h" defines a `p_type` macro that expands to `__p_type`
// making the tests for these fails when both are included.
let mut cfg = ctest::TestGenerator::new();
cfg.skip_fn(|_| true)
.skip_const(|_| true)
.skip_static(|_| true)
.type_name(move |ty, _is_struct, _is_union| {
ty.to_string()
});
cfg.skip_struct(move |ty| {
match ty {
"Elf64_Phdr" | "Elf32_Phdr" => false,
_ => true,
}
});
cfg.skip_type(move |ty| {
match ty {
"Elf64_Phdr" | "Elf32_Phdr" => false,
_ => true,
}
});
cfg.header("elf.h");
cfg.generate("../src/lib.rs", "linux_elf.rs");
}