Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.2] Backports #4187

Merged
merged 13 commits into from
Dec 9, 2024
Merged
18 changes: 18 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,20 @@ jobs:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: ./ci/install-rust.sh

# FIXME(ci): These `du` statements are temporary for debugging cache
- name: Target size before restoring cache
run: du -sh target | sort -k 2 || true
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-${{ matrix.toolchain }}
- name: Target size after restoring cache
run: du -sh target | sort -k 2 || true

- name: Execute build.sh
run: ./ci/verify-build.sh
- name: Target size after job completion
run: du -sh target | sort -k 2

test_tier1:
name: Test tier1
Expand Down Expand Up @@ -82,6 +94,9 @@ jobs:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: ./ci/install-rust.sh
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Run natively
if: "!matrix.docker"
run: ./ci/run.sh ${{ matrix.target }}
Expand Down Expand Up @@ -133,6 +148,9 @@ jobs:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: ./ci/install-rust.sh
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Execute run-docker.sh
run: ./ci/run-docker.sh ${{ matrix.target }}

Expand Down
43 changes: 28 additions & 15 deletions ci/verify-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ if [ "$TOOLCHAIN" = "nightly" ] ; then
rustup component add rust-src
fi

# Print GHA workflow commands
echo_if_ci() {
# Discard stderr so the "set -x" trace doesn't show up
{ [ -n "${CI:-}" ] && echo "$1"; } 2> /dev/null
}

# Run the tests for a specific target
test_target() {
target="${1}"
no_dist="${2:-0}"
target="$1"
no_dist="$2"

RUSTFLAGS="${RUSTFLAGS:-}"

Expand Down Expand Up @@ -269,7 +275,13 @@ case "$rust" in
*) supports_wasi_pn=0 ;;
esac

for target in $targets; do
some_tests_run=0

# Apply the `FILTER` variable, do OS-specific tasks, and run a target
filter_and_run() {
target="$1"
no_dist="${2:-0}"

if echo "$target" | grep -q "$filter"; then
if [ "$os" = "windows" ]; then
TARGET="$target" ./ci/install-rust.sh
Expand All @@ -282,27 +294,28 @@ for target in $targets; do

# `wasm32-wasip2` only exists in recent versions of Rust
if [ "$target" = "wasm32-wasip2" ] && [ "$supports_wasi_pn" = "0" ]; then
continue
return
fi

test_target "$target"
test_run=1
test_target "$target" "$no_dist"
some_tests_run=1
fi
}

for target in $targets; do
echo_if_ci "::group::Target: $target"
filter_and_run "$target"
echo_if_ci "::endgroup::"
done

for target in ${no_dist_targets:-}; do
if echo "$target" | grep -q "$filter"; then
if [ "$os" = "windows" ]; then
TARGET="$target" ./ci/install-rust.sh
fi

test_target "$target" 1
test_run=1
fi
echo_if_ci "::group::Target: $target"
filter_and_run "$target" 1
echo_if_ci "::endgroup::"
done

# Make sure we didn't accidentally filter everything
if [ "${test_run:-}" != 1 ]; then
if [ "$some_tests_run" != 1 ]; then
echo "No tests were run"
exit 1
fi
17 changes: 15 additions & 2 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ fn do_cc() {
|| target.contains("l4re")
|| target.contains("android")
|| target.contains("emscripten")
|| target.contains("solaris")
|| target.contains("illumos")
{
cc::Build::new().file("src/sigrt.c").compile("sigrt");
}
Expand Down Expand Up @@ -2060,9 +2062,9 @@ fn test_android(target: &str) {
| "PF_IO_WORKER"
| "PF_WQ_WORKER"
| "PF_FORKNOEXEC"
| "PF_MCE_PROCESS"
| "PF_SUPERPRIV"
| "PF_DUMPCORE"
| "PF_MCE_PROCESS"
| "PF_SIGNALED"
| "PF_MEMALLOC"
| "PF_NPROC_EXCEEDED"
Expand All @@ -2078,6 +2080,7 @@ fn test_android(target: &str) {
| "PF_NO_SETAFFINITY"
| "PF_MCE_EARLY"
| "PF_MEMALLOC_PIN"
| "PF_BLOCK_TS"
| "PF_SUSPEND_TASK" => true,

_ => false,
Expand Down Expand Up @@ -2649,6 +2652,11 @@ fn test_freebsd(target: &str) {
// Added in FreeBSD 14.0
"TCP_FUNCTION_ALIAS" if Some(14) > freebsd_ver => true,

// These constants may change or disappear in future OS releases, and they probably
// have no legitimate use in applications anyway.
"CAP_UNUSED0_44" | "CAP_UNUSED0_57" | "CAP_UNUSED1_22" | "CAP_UNUSED1_57" |
"CAP_ALL0" | "CAP_ALL1" => true,

_ => false,
}
});
Expand Down Expand Up @@ -4308,12 +4316,17 @@ fn test_linux(target: &str) {
| "PF_RANDOMIZE"
| "PF_NO_SETAFFINITY"
| "PF_MCE_EARLY"
| "PF_MEMALLOC_PIN" => true,
| "PF_MEMALLOC_PIN"
| "PF_BLOCK_TS"
| "PF_SUSPEND_TASK" => true,

// FIXME: Requires >= 6.9 kernel headers.
"EPIOCSPARAMS"
| "EPIOCGPARAMS" => true,

// FIXME: Requires >= 6.11 kernel headers.
"MAP_DROPPABLE" => true,

_ => false,
}
});
Expand Down
7 changes: 1 addition & 6 deletions libc-test/semver/linux-gnu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@ HUGETLB_FLAG_ENCODE_64KB
HUGETLB_FLAG_ENCODE_8MB
HUGETLB_FLAG_ENCODE_MASK
HUGETLB_FLAG_ENCODE_SHIFT
IFA_FLAGS
IFA_F_MANAGETEMPADDR
IFA_F_MCAUTOJOIN
IFA_F_NODAD
IFA_F_NOPREFIXROUTE
IFA_F_STABLE_PRIVACY
INIT_PROCESS
ISOFS_SUPER_MAGIC
JFFS2_SUPER_MAGIC
Expand Down Expand Up @@ -656,6 +650,7 @@ malloc_stats
malloc_trim
malloc_usable_size
mallopt
mempcpy
mq_notify
nl_mmap_hdr
nl_mmap_req
Expand Down
34 changes: 34 additions & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -923,12 +923,18 @@ IFA_ADDRESS
IFA_ANYCAST
IFA_BROADCAST
IFA_CACHEINFO
IFA_FLAGS
IFA_F_DADFAILED
IFA_F_DEPRECATED
IFA_F_HOMEADDRESS
IFA_F_MANAGETEMPADDR
IFA_F_MCAUTOJOIN
IFA_F_NODAD
IFA_F_NOPREFIXROUTE
IFA_F_OPTIMISTIC
IFA_F_PERMANENT
IFA_F_SECONDARY
IFA_F_STABLE_PRIVACY
IFA_F_TEMPORARY
IFA_F_TENTATIVE
IFA_LABEL
Expand Down Expand Up @@ -1586,6 +1592,7 @@ MADV_UNMERGEABLE
MADV_WILLNEED
MADV_WIPEONFORK
MAP_DENYWRITE
MAP_DROPPABLE
MAP_EXECUTABLE
MAP_FILE
MAP_FIXED_NOREPLACE
Expand Down Expand Up @@ -2084,40 +2091,67 @@ PF_ASH
PF_ATMPVC
PF_ATMSVC
PF_AX25
PF_BLOCK_TS
PF_BLUETOOTH
PF_BRIDGE
PF_CAIF
PF_CAN
PF_DECnet
PF_DUMPCORE
PF_ECONET
PF_EXITING
PF_FORKNOEXEC
PF_IDLE
PF_IEEE802154
PF_IO_WORKER
PF_IPX
PF_IRDA
PF_ISDN
PF_IUCV
PF_KEY
PF_KSWAPD
PF_KTHREAD
PF_LLC
PF_LOCAL
PF_LOCAL_THROTTLE
PF_MASKOS
PF_MASKPROC
PF_MCE_EARLY
PF_MCE_PROCESS
PF_MEMALLOC
PF_MEMALLOC_NOFS
PF_MEMALLOC_NOIO
PF_MEMALLOC_PIN
PF_NETBEUI
PF_NETLINK
PF_NETROM
PF_NFC
PF_NOFREEZE
PF_NO_SETAFFINITY
PF_NPROC_EXCEEDED
PF_PACKET
PF_PHONET
PF_POSTCOREDUMP
PF_PPPOX
PF_R
PF_RANDOMIZE
PF_RDS
PF_ROSE
PF_ROUTE
PF_RXRPC
PF_SECURITY
PF_SIGNALED
PF_SNA
PF_SUPERPRIV
PF_SUSPEND_TASK
PF_TIPC
PF_USED_MATH
PF_USER_WORKER
PF_VCPU
PF_VSOCK
PF_W
PF_WANPIPE
PF_WQ_WORKER
PF_X
PF_X25
PIPE_BUF
Expand Down
2 changes: 2 additions & 0 deletions libc-test/semver/solarish.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ LIO_WAIT
LIO_WRITE
PIPE_BUF
SIGEV_PORT
SIGRTMAX
SIGRTMIN
_POSIX_VDISABLE
_ST_FSTYPSZ
aio_cancel
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/unix.txt
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ localtime_r
lseek
lstat
malloc
memccpy
memchr
memcmp
memcpy
Expand Down
4 changes: 3 additions & 1 deletion libc-test/test/sigrt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
target_os = "linux",
target_os = "l4re",
target_os = "android",
target_os = "emscripten"
target_os = "emscripten",
target_os = "solaris",
target_os = "illumos",
))]
mod t {
use libc;
Expand Down
2 changes: 2 additions & 0 deletions src/fuchsia/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,8 @@ cfg_if! {
}
}

// FIXME(msrv): suggested method was added in 1.85
#[allow(unpredictable_function_pointer_comparisons)]
impl PartialEq for sigevent {
fn eq(&self, other: &sigevent) -> bool {
self.sigev_value == other.sigev_value
Expand Down
7 changes: 7 additions & 0 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@ macro_rules! s_no_extra_traits {
$(#[$attr])*
pub union $i { $($field)* }
}

#[cfg(feature = "extra_traits")]
impl ::core::fmt::Debug for $i {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct(::core::stringify!($i)).finish_non_exhaustive()
}
}
);

(it: $(#[$attr:meta])* pub struct $i:ident { $($field:tt)* }) => (
Expand Down
17 changes: 0 additions & 17 deletions src/unix/aix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,14 +575,6 @@ cfg_if! {
}
}
impl Eq for __sigaction_sa_union {}
impl fmt::Debug for __sigaction_sa_union {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("__sigaction_sa_union")
.field("__su_handler", unsafe { &self.__su_handler })
.field("__su_sigaction", unsafe { &self.__su_sigaction })
.finish()
}
}
impl hash::Hash for __sigaction_sa_union {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
unsafe {
Expand Down Expand Up @@ -627,15 +619,6 @@ cfg_if! {
}
}
impl Eq for __poll_ctl_ext_u {}
impl fmt::Debug for __poll_ctl_ext_u {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("__poll_ctl_ext_u")
.field("addr", unsafe { &self.addr })
.field("data32", unsafe { &self.data32 })
.field("data", unsafe { &self.data })
.finish()
}
}
impl hash::Hash for __poll_ctl_ext_u {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
unsafe {
Expand Down
Loading
Loading