Skip to content

Commit

Permalink
Merge branch 'main' into sigtrap_si_codes
Browse files Browse the repository at this point in the history
  • Loading branch information
xd009642 authored Feb 6, 2025
2 parents 8897485 + 478f19d commit fdfc705
Show file tree
Hide file tree
Showing 64 changed files with 1,139 additions and 436 deletions.
3 changes: 3 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ task:
env:
HOME: /tmp # cargo cache needs it
TARGET: x86_64-unknown-freebsd
# FIXME(freebsd): FreeBSD has a segfault when `RUST_BACKTRACE` is set
# https://github.com/rust-lang/rust/issues/132185
RUST_BACKTRACE: "0"
matrix:
- name: nightly freebsd-13 i686
# Test i686 FreeBSD in 32-bit emulation on a 64-bit host.
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ jobs:
- i686-unknown-linux-musl
- loongarch64-unknown-linux-gnu
- loongarch64-unknown-linux-musl
- powerpc-unknown-linux-gnu
# FIXME(ppc): SIGILL running tests, see
# https://github.com/rust-lang/libc/pull/4254#issuecomment-2636288713
# - powerpc-unknown-linux-gnu
- powerpc64-unknown-linux-gnu
- powerpc64le-unknown-linux-gnu
- riscv64gc-unknown-linux-gnu
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
target
Cargo.lock
*~
style
3 changes: 2 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ fn main() {
let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
let libc_ci = env::var("LIBC_CI").is_ok();
let libc_check_cfg = env::var("LIBC_CHECK_CFG").is_ok() || rustc_minor_ver >= 80;
let linux_time_bits64 = env::var("RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64").is_ok();

// The ABI of libc used by std is backward compatible with FreeBSD 12.
// The ABI of libc from crates.io is backward compatible with FreeBSD 12.
Expand Down Expand Up @@ -81,6 +80,8 @@ fn main() {
Some(_) | None => (),
}

let linux_time_bits64 = env::var("RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64").is_ok();
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64");
if linux_time_bits64 {
set_cfg("linux_time_bits64");
}
Expand Down
19 changes: 13 additions & 6 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ if [ -n "${QEMU:-}" ]; then
fi

cmd="cargo test --target $target ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}"
test_flags="--skip check_style"

# Run tests in the `libc` crate
case "$target" in
Expand All @@ -101,25 +102,31 @@ if [ "$target" = "s390x-unknown-linux-gnu" ]; then
passed=0
until [ $n -ge $N ]; do
if [ "$passed" = "0" ]; then
if $cmd --no-default-features; then
# shellcheck disable=SC2086
if $cmd --no-default-features -- $test_flags; then
passed=$((passed+1))
continue
fi
elif [ "$passed" = "1" ]; then
if $cmd; then
# shellcheck disable=SC2086
if $cmd -- $test_flags; then
passed=$((passed+1))
continue
fi
elif [ "$passed" = "2" ]; then
if $cmd --features extra_traits; then
# shellcheck disable=SC2086
if $cmd --features extra_traits -- $test_flags; then
break
fi
fi
n=$((n+1))
sleep 1
done
else
$cmd --no-default-features
$cmd
$cmd --features extra_traits
# shellcheck disable=SC2086
$cmd --no-default-features -- $test_flags
# shellcheck disable=SC2086
$cmd -- $test_flags
# shellcheck disable=SC2086
$cmd --features extra_traits -- $test_flags
fi
20 changes: 11 additions & 9 deletions ci/runtest-android.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::env;
use std::process::Command;
use std::path::{Path, PathBuf};
use std::process::Command;

fn main() {
let args = env::args_os()
.skip(1)
.filter(|arg| arg != "--quiet")
.filter(|arg| arg != "--quiet" && arg != "--skip" && arg != "check_style")
.collect::<Vec<_>>();
assert_eq!(args.len(), 1);
let test = PathBuf::from(&args[0]);
Expand Down Expand Up @@ -36,14 +36,16 @@ fn main() {
let stdout = String::from_utf8_lossy(&output.stdout);
let stderr = String::from_utf8_lossy(&output.stderr);

println!("status: {}\nstdout ---\n{}\nstderr ---\n{}",
output.status,
stdout,
stderr);
println!(
"status: {}\nstdout ---\n{}\nstderr ---\n{}",
output.status, stdout, stderr
);

if !stderr.lines().any(|l| (l.starts_with("PASSED ") && l.contains(" tests")) || l.starts_with("test result: ok"))
&& !stdout.lines().any(|l| (l.starts_with("PASSED ") && l.contains(" tests")) || l.starts_with("test result: ok"))
{
if !stderr.lines().any(|l| {
(l.starts_with("PASSED ") && l.contains(" tests")) || l.starts_with("test result: ok")
}) && !stdout.lines().any(|l| {
(l.starts_with("PASSED ") && l.contains(" tests")) || l.starts_with("test result: ok")
}) {
panic!("failed to find successful test run");
};
}
213 changes: 0 additions & 213 deletions ci/style.rs

This file was deleted.

2 changes: 1 addition & 1 deletion ci/style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [ -n "${CI:-}" ]; then
check="--check"
fi

rustc ci/style.rs && ./style src
cargo test --manifest-path libc-test/Cargo.toml --test style -- --nocapture

command -v rustfmt
rustfmt -V
Expand Down
16 changes: 16 additions & 0 deletions libc-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ A test crate for the libc crate.
[dependencies]
libc = { path = "..", version = "1.0.0-alpha.1", default-features = false }

[dev-dependencies]
syn = { version = "2.0.91", features = ["full", "visit"] }
proc-macro2 = { version = "1.0.92", features = ["span-locations"] }
glob = "0.3.2"
annotate-snippets = { version = "0.11.5", features = ["testing-colors"] }

[build-dependencies]
cc = "1.0.83"
# FIXME: Use fork ctest until the maintainer gets back.
Expand Down Expand Up @@ -90,3 +96,13 @@ harness = false
name = "primitive_types"
path = "test/primitive_types.rs"
harness = true

[[test]]
name = "style"
path = "test/check_style.rs"
harness = true

[[test]]
name = "style_tests"
path = "test/style_tests.rs"
harness = true
Loading

0 comments on commit fdfc705

Please sign in to comment.