Make tests for bsd passed

* Include some header files
* Ingore tests for p_type field of `Elf*_Phdr` because of
  conflicting with p_type macro from resolve.h
This commit is contained in:
Lzu Tao 2020-10-25 16:12:04 +07:00
parent 42dce281b2
commit be37f011e6
1 changed files with 33 additions and 2 deletions

View File

@ -287,9 +287,11 @@ fn test_openbsd(target: &str) {
cfg.flag("-Wno-deprecated-declarations");
headers! { cfg:
"elf.h",
"errno.h",
"fcntl.h",
"limits.h",
"link.h",
"locale.h",
"stddef.h",
"stdint.h",
@ -387,7 +389,9 @@ fn test_openbsd(target: &str) {
cfg.type_name(move |ty, is_struct, is_union| {
match ty {
// Just pass all these through, no need for a "struct" prefix
"FILE" | "DIR" | "Dl_info" => ty.to_string(),
"FILE" | "DIR" | "Dl_info" | "Elf32_Phdr" | "Elf64_Phdr" => {
ty.to_string()
}
// OSX calls this something else
"sighandler_t" => "sig_t".to_string(),
@ -418,6 +422,15 @@ fn test_openbsd(target: &str) {
struct_ == "siginfo_t" && field == "si_addr"
});
cfg.skip_field(|struct_, field| {
match (struct_, field) {
// conflicting with `p_type` macro from <resolve.h>.
("Elf32_Phdr", "p_type") => true,
("Elf64_Phdr", "p_type") => true,
_ => false,
}
});
cfg.generate("../src/lib.rs", "main.rs");
}
@ -870,9 +883,11 @@ fn test_netbsd(target: &str) {
headers! {
cfg:
"elf.h",
"errno.h",
"fcntl.h",
"limits.h",
"link.h",
"locale.h",
"stddef.h",
"stdint.h",
@ -1061,6 +1076,15 @@ fn test_netbsd(target: &str) {
(struct_ == "aiocb" && field == "aio_buf")
});
cfg.skip_field(|struct_, field| {
match (struct_, field) {
// conflicting with `p_type` macro from <resolve.h>.
("Elf32_Phdr", "p_type") => true,
("Elf64_Phdr", "p_type") => true,
_ => false,
}
});
cfg.generate("../src/lib.rs", "main.rs");
}
@ -1633,6 +1657,7 @@ fn test_freebsd(target: &str) {
"ctype.h",
"dirent.h",
"dlfcn.h",
"elf.h",
"errno.h",
"fcntl.h",
"glob.h",
@ -1641,6 +1666,7 @@ fn test_freebsd(target: &str) {
"langinfo.h",
"libutil.h",
"limits.h",
"link.h",
"locale.h",
"machine/reg.h",
"mqueue.h",
@ -1709,7 +1735,8 @@ fn test_freebsd(target: &str) {
cfg.type_name(move |ty, is_struct, is_union| {
match ty {
// Just pass all these through, no need for a "struct" prefix
"FILE" | "fd_set" | "Dl_info" | "DIR" => ty.to_string(),
"FILE" | "fd_set" | "Dl_info" | "DIR" | "Elf32_Phdr"
| "Elf64_Phdr" => ty.to_string(),
// FIXME: https://github.com/rust-lang/libc/issues/1273
"sighandler_t" => "sig_t".to_string(),
@ -1909,6 +1936,10 @@ fn test_freebsd(target: &str) {
// `void*`:
("stack_t", "ss_sp") if Some(10) == freebsd_ver => true,
// conflicting with `p_type` macro from <resolve.h>.
("Elf32_Phdr", "p_type") => true,
("Elf64_Phdr", "p_type") => true,
_ => false,
}
});