From be37f011e698457058a882d29c34640bbc73653d Mon Sep 17 00:00:00 2001 From: Lzu Tao <taolzu@gmail.com> Date: Sun, 25 Oct 2020 16:12:04 +0700 Subject: [PATCH] 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 --- libc-test/build.rs | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 552642fe..35a04200 100755 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -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, } }); -- GitLab