Skip to content

Commit 67db2d9

Browse files
committed
Re-enable more tests
1 parent aeadbde commit 67db2d9

File tree

2 files changed

+39
-84
lines changed

2 files changed

+39
-84
lines changed

libc-test/build.rs

+37-82
Original file line numberDiff line numberDiff line change
@@ -1538,12 +1538,16 @@ fn test_freebsd(target: &str) {
15381538
// Just pass all these through, no need for a "struct" prefix
15391539
"FILE" | "fd_set" | "Dl_info" | "DIR" => ty.to_string(),
15401540

1541+
// FIXME: https://github.com/rust-lang/libc/issues/1273
15411542
"sighandler_t" => "sig_t".to_string(),
15421543

15431544
t if is_union => format!("union {}", t),
15441545

15451546
t if t.ends_with("_t") => t.to_string(),
15461547

1548+
// sigval is a struct in Rust, but a union in C:
1549+
"sigval" => format!("union sigval"),
1550+
15471551
// put `struct` in front of all structs:.
15481552
t if is_struct => format!("struct {}", t),
15491553

@@ -1565,52 +1569,27 @@ fn test_freebsd(target: &str) {
15651569
}
15661570
});
15671571

1568-
cfg.skip_struct(move |ty| {
1569-
match ty {
1570-
// This is actually a union, not a struct
1571-
// FIXME: still required?
1572-
"sigval" => true,
1573-
1574-
_ => false,
1575-
}
1576-
});
1577-
1578-
cfg.skip_signededness(move |c| {
1579-
match c {
1580-
// FIXME: still required?
1581-
"LARGE_INTEGER" | "float" | "double" => true,
1582-
// FIXME: still required?
1583-
n if n.starts_with("pthread") => true,
1584-
// sem_t is a struct or pointer
1585-
// FIXME: still required?
1586-
"sem_t" => true,
1587-
// mqd_t is a pointer on FreeBSD
1588-
// FIXME: still required?
1589-
"mqd_t" => true,
1590-
1591-
_ => false,
1592-
}
1593-
});
1594-
15951572
cfg.skip_const(move |name| {
15961573
match name {
1597-
// FIXME: still required?
1598-
"SIG_DFL" | "SIG_ERR" | "SIG_IGN" => true, // sighandler_t weirdness
1599-
16001574
// These constants were introduced in FreeBSD 12:
1601-
"SF_USER_READAHEAD" |
1602-
"EVFILT_EMPTY" |
1603-
"SO_REUSEPORT_LB" |
1604-
"IP_ORIGDSTADDR" |
1605-
"IP_RECVORIGDSTADDR" |
1606-
"IPV6_ORIGDSTADDR" |
1607-
"IPV6_RECVORIGDSTADDR"
1608-
if Some(12) != freebsd_ver => true,
1575+
"SF_USER_READAHEAD"
1576+
| "EVFILT_EMPTY"
1577+
| "SO_REUSEPORT_LB"
1578+
| "IP_ORIGDSTADDR"
1579+
| "IP_RECVORIGDSTADDR"
1580+
| "IPV6_ORIGDSTADDR"
1581+
| "IPV6_RECVORIGDSTADDR"
1582+
if Some(12) != freebsd_ver =>
1583+
{
1584+
true
1585+
}
16091586

1587+
// FIXME: There are deprecated - remove in a couple of releases.
16101588
// These constants were removed in FreeBSD 11 (svn r273250) but will
16111589
// still be accepted and ignored at runtime.
1612-
"MAP_RENAME" | "MAP_NORESERVE" => true,
1590+
"MAP_RENAME" | "MAP_NORESERVE" if Some(10) != freebsd_ver => true,
16131591

1592+
// FIXME: There are deprecated - remove in a couple of releases.
16141593
// These constants were removed in FreeBSD 11 (svn r262489),
16151594
// and they've never had any legitimate use outside of the
16161595
// base system anyway.
@@ -1624,64 +1603,40 @@ fn test_freebsd(target: &str) {
16241603
cfg.skip_fn(move |name| {
16251604
// skip those that are manually verified
16261605
match name {
1627-
// FIXME: still required?
1628-
"execv" | // crazy stuff with const/mut
1629-
"execve" |
1630-
"execvp" |
1631-
"execvpe" |
1632-
"fexecve" => true,
1606+
// FIXME: https://github.com/rust-lang/libc/issues/1272
1607+
"execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true,
16331608

16341609
// The `uname` function in freebsd is now an inline wrapper that
16351610
// delegates to another, but the symbol still exists, so don't check
16361611
// the symbol.
16371612
"uname" => true,
16381613

1639-
// aio_waitcomplete's return type changed between FreeBSD 10 and 11.
1640-
// FIXME: still required?
1641-
"aio_waitcomplete" => true,
1642-
1643-
// lio_listio confuses the checker, probably because one of its
1644-
// arguments is an array
1645-
// FIXME: still required?
1614+
// FIXME: Our API is unsound. The Rust API allows aliasing
1615+
// pointers, but the C API requires pointers not to alias.
1616+
// We should probably be at least using `&`/`&mut` here, see:
1617+
// https://github.com/gnzlbg/ctest/issues/68
16461618
"lio_listio" => true,
16471619

16481620
_ => false,
16491621
}
16501622
});
16511623

1652-
cfg.skip_field_type(move |struct_, field| {
1653-
// This is a weird union, don't check the type.
1654-
// FIXME: still required?
1655-
(struct_ == "ifaddrs" && field == "ifa_ifu") ||
1656-
// FIXME: still required?
1657-
// sighandler_t type is super weird
1658-
(struct_ == "sigaction" && field == "sa_sigaction") ||
1659-
// FIXME: still required?
1660-
// sigval is actually a union, but we pretend it's a struct
1661-
(struct_ == "sigevent" && field == "sigev_value") ||
1662-
// aio_buf is "volatile void*" and Rust doesn't understand volatile
1663-
// FIXME: still required?
1664-
(struct_ == "aiocb" && field == "aio_buf") ||
1665-
// stack_t.ss_sp's type changed from FreeBSD 10 to 11 in svn r294930
1666-
// FIXME: still required?
1667-
(struct_ == "stack_t" && field == "ss_sp")
1624+
cfg.volatile_item(|i| {
1625+
use ctest::VolatileItemKind::*;
1626+
match i {
1627+
// aio_buf is a volatile void** but since we cannot express that in
1628+
// Rust types, we have to explicitly tell the checker about it here:
1629+
StructField(ref n, ref f) if n == "aiocb" && f == "aio_buf" => {
1630+
true
1631+
}
1632+
_ => false,
1633+
}
16681634
});
16691635

16701636
cfg.skip_field(move |struct_, field| {
1671-
// this is actually a union on linux, so we can't represent it well and
1672-
// just insert some padding.
1673-
// FIXME: still required?
1674-
(struct_ == "siginfo_t" && field == "_pad") ||
1675-
// sigev_notify_thread_id is actually part of a sigev_un union
1676-
// FIXME: still required?
1677-
(struct_ == "sigevent" && field == "sigev_notify_thread_id") ||
1678-
// signalfd had SIGSYS fields added in Linux 4.18, but no libc release has them yet.
1679-
// FIXME: still required?
1680-
(struct_ == "signalfd_siginfo" && (field == "ssi_addr_lsb" ||
1681-
field == "_pad2" ||
1682-
field == "ssi_syscall" ||
1683-
field == "ssi_call_addr" ||
1684-
field == "ssi_arch"))
1637+
// FIXME: `sa_sigaction` has type `sighandler_t` but that type is
1638+
// incorrect, see: https://github.com/rust-lang/libc/issues/1359
1639+
(struct_ == "sigaction" && field == "sa_sigaction")
16851640
});
16861641

16871642
cfg.generate("../src/lib.rs", "main.rs");

src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ s! {
2525
pub shm_dtime: ::time_t,
2626
pub shm_ctime: ::time_t,
2727
}
28-
}
2928

30-
s_no_extra_traits! {
3129
pub struct kevent {
3230
pub ident: ::uintptr_t,
3331
pub filter: ::c_short,
@@ -37,7 +35,9 @@ s_no_extra_traits! {
3735
pub udata: *mut ::c_void,
3836
pub ext: [u64; 4],
3937
}
38+
}
4039

40+
s_no_extra_traits! {
4141
pub struct dirent {
4242
pub d_fileno: ::ino_t,
4343
pub d_off: ::off_t,

0 commit comments

Comments
 (0)