Skip to content

Commit

Permalink
Make tests for bsd passed
Browse files Browse the repository at this point in the history
* Include some header files
* Ingore tests for p_type field of `Elf*_Phdr` because of
  conflicting with p_type macro from resolve.h
  • Loading branch information
tesuji committed Oct 27, 2020
1 parent 42dce28 commit be37f01
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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");
}

Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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");
}

Expand Down Expand Up @@ -1633,6 +1657,7 @@ fn test_freebsd(target: &str) {
"ctype.h",
"dirent.h",
"dlfcn.h",
"elf.h",
"errno.h",
"fcntl.h",
"glob.h",
Expand All @@ -1641,6 +1666,7 @@ fn test_freebsd(target: &str) {
"langinfo.h",
"libutil.h",
"limits.h",
"link.h",
"locale.h",
"machine/reg.h",
"mqueue.h",
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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,
}
});
Expand Down

0 comments on commit be37f01

Please sign in to comment.