Skip to content

Commit 3e869ee

Browse files
committed
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
1 parent dbf50c9 commit 3e869ee

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

libc-test/build.rs

+33-2
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,11 @@ fn test_openbsd(target: &str) {
287287
cfg.flag("-Wno-deprecated-declarations");
288288

289289
headers! { cfg:
290+
"elf.h",
290291
"errno.h",
291292
"fcntl.h",
292293
"limits.h",
294+
"link.h",
293295
"locale.h",
294296
"stddef.h",
295297
"stdint.h",
@@ -387,7 +389,9 @@ fn test_openbsd(target: &str) {
387389
cfg.type_name(move |ty, is_struct, is_union| {
388390
match ty {
389391
// Just pass all these through, no need for a "struct" prefix
390-
"FILE" | "DIR" | "Dl_info" => ty.to_string(),
392+
"FILE" | "DIR" | "Dl_info" | "Elf32_Phdr" | "Elf64_Phdr" => {
393+
ty.to_string()
394+
}
391395

392396
// OSX calls this something else
393397
"sighandler_t" => "sig_t".to_string(),
@@ -418,6 +422,15 @@ fn test_openbsd(target: &str) {
418422
struct_ == "siginfo_t" && field == "si_addr"
419423
});
420424

425+
cfg.skip_field(|struct_, field| {
426+
match (struct_, field) {
427+
// There "p_type" macro defined in `resolv.h`.
428+
("Elf32_Phdr", "p_type") => true,
429+
("Elf64_Phdr", "p_type") => true,
430+
_ => false,
431+
}
432+
});
433+
421434
cfg.generate("../src/lib.rs", "main.rs");
422435
}
423436

@@ -870,9 +883,11 @@ fn test_netbsd(target: &str) {
870883

871884
headers! {
872885
cfg:
886+
"elf.h",
873887
"errno.h",
874888
"fcntl.h",
875889
"limits.h",
890+
"link.h",
876891
"locale.h",
877892
"stddef.h",
878893
"stdint.h",
@@ -1061,6 +1076,15 @@ fn test_netbsd(target: &str) {
10611076
(struct_ == "aiocb" && field == "aio_buf")
10621077
});
10631078

1079+
cfg.skip_field(|struct_, field| {
1080+
match (struct_, field) {
1081+
// There "p_type" macro defined in `resolv.h`.
1082+
("Elf32_Phdr", "p_type") => true,
1083+
("Elf64_Phdr", "p_type") => true,
1084+
_ => false,
1085+
}
1086+
});
1087+
10641088
cfg.generate("../src/lib.rs", "main.rs");
10651089
}
10661090

@@ -1633,6 +1657,7 @@ fn test_freebsd(target: &str) {
16331657
"ctype.h",
16341658
"dirent.h",
16351659
"dlfcn.h",
1660+
"elf.h",
16361661
"errno.h",
16371662
"fcntl.h",
16381663
"glob.h",
@@ -1641,6 +1666,7 @@ fn test_freebsd(target: &str) {
16411666
"langinfo.h",
16421667
"libutil.h",
16431668
"limits.h",
1669+
"link.h",
16441670
"locale.h",
16451671
"machine/reg.h",
16461672
"mqueue.h",
@@ -1709,7 +1735,8 @@ fn test_freebsd(target: &str) {
17091735
cfg.type_name(move |ty, is_struct, is_union| {
17101736
match ty {
17111737
// Just pass all these through, no need for a "struct" prefix
1712-
"FILE" | "fd_set" | "Dl_info" | "DIR" => ty.to_string(),
1738+
"FILE" | "fd_set" | "Dl_info" | "DIR" | "Elf32_Phdr"
1739+
| "Elf64_Phdr" => ty.to_string(),
17131740

17141741
// FIXME: https://github.com/rust-lang/libc/issues/1273
17151742
"sighandler_t" => "sig_t".to_string(),
@@ -1909,6 +1936,10 @@ fn test_freebsd(target: &str) {
19091936
// `void*`:
19101937
("stack_t", "ss_sp") if Some(10) == freebsd_ver => true,
19111938

1939+
// There "p_type" macro defined in `resolv.h`.
1940+
("Elf32_Phdr", "p_type") => true,
1941+
("Elf64_Phdr", "p_type") => true,
1942+
19121943
_ => false,
19131944
}
19141945
});

0 commit comments

Comments
 (0)