Skip to content

Commit fdfc705

Browse files
authored
Merge branch 'main' into sigtrap_si_codes
2 parents 8897485 + 478f19d commit fdfc705

File tree

64 files changed

+1139
-436
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1139
-436
lines changed

.cirrus.yml

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ task:
33
env:
44
HOME: /tmp # cargo cache needs it
55
TARGET: x86_64-unknown-freebsd
6+
# FIXME(freebsd): FreeBSD has a segfault when `RUST_BACKTRACE` is set
7+
# https://github.com/rust-lang/rust/issues/132185
8+
RUST_BACKTRACE: "0"
69
matrix:
710
- name: nightly freebsd-13 i686
811
# Test i686 FreeBSD in 32-bit emulation on a 64-bit host.

.github/workflows/ci.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ jobs:
135135
- i686-unknown-linux-musl
136136
- loongarch64-unknown-linux-gnu
137137
- loongarch64-unknown-linux-musl
138-
- powerpc-unknown-linux-gnu
138+
# FIXME(ppc): SIGILL running tests, see
139+
# https://github.com/rust-lang/libc/pull/4254#issuecomment-2636288713
140+
# - powerpc-unknown-linux-gnu
139141
- powerpc64-unknown-linux-gnu
140142
- powerpc64le-unknown-linux-gnu
141143
- riscv64gc-unknown-linux-gnu

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
target
22
Cargo.lock
33
*~
4-
style

build.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ fn main() {
4444
let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
4545
let libc_ci = env::var("LIBC_CI").is_ok();
4646
let libc_check_cfg = env::var("LIBC_CHECK_CFG").is_ok() || rustc_minor_ver >= 80;
47-
let linux_time_bits64 = env::var("RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64").is_ok();
4847

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

83+
let linux_time_bits64 = env::var("RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64").is_ok();
84+
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64");
8485
if linux_time_bits64 {
8586
set_cfg("linux_time_bits64");
8687
}

ci/run.sh

+13-6
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ if [ -n "${QEMU:-}" ]; then
8181
fi
8282

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

8586
# Run tests in the `libc` crate
8687
case "$target" in
@@ -101,25 +102,31 @@ if [ "$target" = "s390x-unknown-linux-gnu" ]; then
101102
passed=0
102103
until [ $n -ge $N ]; do
103104
if [ "$passed" = "0" ]; then
104-
if $cmd --no-default-features; then
105+
# shellcheck disable=SC2086
106+
if $cmd --no-default-features -- $test_flags; then
105107
passed=$((passed+1))
106108
continue
107109
fi
108110
elif [ "$passed" = "1" ]; then
109-
if $cmd; then
111+
# shellcheck disable=SC2086
112+
if $cmd -- $test_flags; then
110113
passed=$((passed+1))
111114
continue
112115
fi
113116
elif [ "$passed" = "2" ]; then
114-
if $cmd --features extra_traits; then
117+
# shellcheck disable=SC2086
118+
if $cmd --features extra_traits -- $test_flags; then
115119
break
116120
fi
117121
fi
118122
n=$((n+1))
119123
sleep 1
120124
done
121125
else
122-
$cmd --no-default-features
123-
$cmd
124-
$cmd --features extra_traits
126+
# shellcheck disable=SC2086
127+
$cmd --no-default-features -- $test_flags
128+
# shellcheck disable=SC2086
129+
$cmd -- $test_flags
130+
# shellcheck disable=SC2086
131+
$cmd --features extra_traits -- $test_flags
125132
fi

ci/runtest-android.rs

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use std::env;
2-
use std::process::Command;
32
use std::path::{Path, PathBuf};
3+
use std::process::Command;
44

55
fn main() {
66
let args = env::args_os()
77
.skip(1)
8-
.filter(|arg| arg != "--quiet")
8+
.filter(|arg| arg != "--quiet" && arg != "--skip" && arg != "check_style")
99
.collect::<Vec<_>>();
1010
assert_eq!(args.len(), 1);
1111
let test = PathBuf::from(&args[0]);
@@ -36,14 +36,16 @@ fn main() {
3636
let stdout = String::from_utf8_lossy(&output.stdout);
3737
let stderr = String::from_utf8_lossy(&output.stderr);
3838

39-
println!("status: {}\nstdout ---\n{}\nstderr ---\n{}",
40-
output.status,
41-
stdout,
42-
stderr);
39+
println!(
40+
"status: {}\nstdout ---\n{}\nstderr ---\n{}",
41+
output.status, stdout, stderr
42+
);
4343

44-
if !stderr.lines().any(|l| (l.starts_with("PASSED ") && l.contains(" tests")) || l.starts_with("test result: ok"))
45-
&& !stdout.lines().any(|l| (l.starts_with("PASSED ") && l.contains(" tests")) || l.starts_with("test result: ok"))
46-
{
44+
if !stderr.lines().any(|l| {
45+
(l.starts_with("PASSED ") && l.contains(" tests")) || l.starts_with("test result: ok")
46+
}) && !stdout.lines().any(|l| {
47+
(l.starts_with("PASSED ") && l.contains(" tests")) || l.starts_with("test result: ok")
48+
}) {
4749
panic!("failed to find successful test run");
4850
};
4951
}

ci/style.rs

-213
This file was deleted.

ci/style.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if [ -n "${CI:-}" ]; then
99
check="--check"
1010
fi
1111

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

1414
command -v rustfmt
1515
rustfmt -V

libc-test/Cargo.toml

+16
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ A test crate for the libc crate.
1515
[dependencies]
1616
libc = { path = "..", version = "1.0.0-alpha.1", default-features = false }
1717

18+
[dev-dependencies]
19+
syn = { version = "2.0.91", features = ["full", "visit"] }
20+
proc-macro2 = { version = "1.0.92", features = ["span-locations"] }
21+
glob = "0.3.2"
22+
annotate-snippets = { version = "0.11.5", features = ["testing-colors"] }
23+
1824
[build-dependencies]
1925
cc = "1.0.83"
2026
# FIXME: Use fork ctest until the maintainer gets back.
@@ -90,3 +96,13 @@ harness = false
9096
name = "primitive_types"
9197
path = "test/primitive_types.rs"
9298
harness = true
99+
100+
[[test]]
101+
name = "style"
102+
path = "test/check_style.rs"
103+
harness = true
104+
105+
[[test]]
106+
name = "style_tests"
107+
path = "test/style_tests.rs"
108+
harness = true

0 commit comments

Comments
 (0)