Skip to content

Commit

Permalink
chore: add labels to FIXMEs
Browse files Browse the repository at this point in the history
  • Loading branch information
lvllvl committed Feb 6, 2025
1 parent 962dcb3 commit e364761
Show file tree
Hide file tree
Showing 145 changed files with 1,434 additions and 640 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
8 changes: 8 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const ALLOWED_CFGS: &'static [&'static str] = &[
"libc_const_extern_fn",
"libc_deny_warnings",
"libc_ctest",
// Corresponds to `__USE_TIME_BITS64` in UAPI
"linux_time_bits64",
];

// Extra values to allow for check-cfg.
Expand Down Expand Up @@ -78,6 +80,12 @@ 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");
}

// On CI: deny all warnings
if libc_ci {
set_cfg("libc_deny_warnings");
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");
};
}
214 changes: 0 additions & 214 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
5 changes: 5 additions & 0 deletions ci/verify-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ test_target() {
$cmd
$cmd --features extra_traits

if [ "$os" = "linux" ]; then
# Test with the equivalent of __USE_TIME_BITS64
RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64=1 $cmd
fi

# Test again without default features, i.e. without "std"
$cmd --no-default-features
$cmd --no-default-features --features extra_traits
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 e364761

Please sign in to comment.