From 5c628dedb988e4e87225f9dc76f2bf63aa584c6f Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 28 Sep 2023 13:52:39 -0700 Subject: [PATCH] Downgrade dependencies and disable tests to compile under Rust 1.48. --- .github/workflows/main.yml | 2 + Cargo.toml | 12 --- benches/mod.rs | 186 ------------------------------------- tests/process/pidfd.rs | 5 +- tests/process/wait.rs | 5 +- 5 files changed, 6 insertions(+), 204 deletions(-) delete mode 100644 benches/mod.rs diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e277746f7..cd8e28e1d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -90,6 +90,7 @@ jobs: run: | cargo update --package=once_cell --precise 1.14.0 cargo update --package=flate2 --precise=1.0.25 + cargo update --package=tempfile --precise=3.6.0 - run: cargo check --workspace --release -vv --all-targets - run: cargo check --workspace --release -vv --features=all-apis --all-targets @@ -476,6 +477,7 @@ jobs: run: | cargo update --package=once_cell --precise 1.14.0 cargo update --package=flate2 --precise=1.0.25 + cargo update --package=tempfile --precise=3.6.0 - run: | # Run the tests, and check the prebuilt release libraries. diff --git a/Cargo.toml b/Cargo.toml index 02f8a091a..9bb9247d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -80,24 +80,12 @@ tempfile = "3.4.0" libc = "0.2.144" libc_errno = { package = "errno", version = "0.3.1", default-features = false } io-lifetimes = { version = "1.0.10", default-features = false, features = ["close"] } -# Don't upgrade to serial_test 0.7 for now because it depends on a -# `parking_lot_core` version which is not compatible with our MSRV of 1.48. -serial_test = "0.6" memoffset = "0.9.0" flate2 = "1.0" -[target.'cfg(all(criterion, not(any(target_os = "emscripten", target_os = "wasi"))))'.dev-dependencies] -criterion = "0.4" - [target.'cfg(windows)'.dev-dependencies] ctor = "0.2.0" -# Add Criterion configuration, as described here: -# -[[bench]] -name = "mod" -harness = false - [package.metadata.docs.rs] features = ["all-apis"] rustdoc-args = ["--cfg", "doc_cfg"] diff --git a/benches/mod.rs b/benches/mod.rs deleted file mode 100644 index ee7358cc2..000000000 --- a/benches/mod.rs +++ /dev/null @@ -1,186 +0,0 @@ -//! Benchmarks for rustix. -//! -//! To enable these benchmarks, add `--cfg=criterion` to RUSTFLAGS and enable -//! the "fs", "time", and "process" cargo features. -//! -//! ```sh -//! RUSTFLAGS=--cfg=criterion cargo bench --features=fs,time,process -//! ``` - -#[cfg(any( - not(criterion), - not(feature = "fs"), - not(feature = "process"), - not(feature = "time"), - windows, - target_os = "emscripten", - target_os = "redox", - target_os = "wasi", -))] -fn main() { - unimplemented!("Add --cfg=criterion to RUSTFLAGS and enable the \"fs\", \"time\", and \"process\" cargo features.") -} - -#[cfg(not(any( - not(criterion), - not(feature = "fs"), - not(feature = "process"), - not(feature = "time"), - windows, - target_os = "emscripten", - target_os = "redox", - target_os = "wasi", -)))] -use criterion::{criterion_group, criterion_main}; - -#[cfg(not(any( - not(criterion), - not(feature = "fs"), - not(feature = "process"), - not(feature = "time"), - windows, - target_os = "emscripten", - target_os = "redox", - target_os = "wasi", -)))] -mod suite { - use criterion::Criterion; - - pub(super) fn simple_statat(c: &mut Criterion) { - use rustix::fs::{cwd, statat, AtFlags}; - - c.bench_function("simple statat", |b| { - b.iter(|| { - statat(cwd(), "/", AtFlags::empty()).unwrap(); - }) - }); - } - - pub(super) fn simple_statat_libc(c: &mut Criterion) { - c.bench_function("simple statat libc", |b| { - b.iter(|| { - let mut s = std::mem::MaybeUninit::::uninit(); - unsafe { - assert_eq!( - libc::fstatat( - libc::AT_FDCWD, - std::ffi::CString::new("/").unwrap().as_c_str().as_ptr() as _, - s.as_mut_ptr(), - 0 - ), - 0 - ); - } - }) - }); - } - - pub(super) fn simple_statat_libc_cstr(c: &mut Criterion) { - c.bench_function("simple statat libc cstr", |b| { - b.iter(|| { - let mut s = std::mem::MaybeUninit::::uninit(); - unsafe { - assert_eq!( - libc::fstatat( - libc::AT_FDCWD, - rustix::cstr!("/").as_ptr() as _, - s.as_mut_ptr(), - 0 - ), - 0 - ); - } - }) - }); - } - - pub(super) fn simple_statat_cstr(c: &mut Criterion) { - use rustix::fs::{cwd, statat, AtFlags}; - - c.bench_function("simple statat cstr", |b| { - b.iter(|| { - statat(cwd(), rustix::cstr!("/"), AtFlags::empty()).unwrap(); - }) - }); - } - - #[cfg(not(target_os = "wasi"))] - pub(super) fn simple_clock_gettime(c: &mut Criterion) { - use rustix::time::{clock_gettime, ClockId}; - - c.bench_function("simple clock_gettime", |b| { - b.iter(|| { - let _ = clock_gettime(ClockId::Monotonic); - }) - }); - } - - #[cfg(not(target_os = "wasi"))] - pub(super) fn simple_clock_gettime_libc(c: &mut Criterion) { - c.bench_function("simple clock_gettime libc", |b| { - b.iter(|| { - let mut s = std::mem::MaybeUninit::::uninit(); - unsafe { - assert_eq!( - libc::clock_gettime(libc::CLOCK_MONOTONIC, s.as_mut_ptr()), - 0 - ); - let _ = s.assume_init(); - } - }) - }); - } - - #[cfg(not(target_os = "wasi"))] - pub(super) fn simple_getpid(c: &mut Criterion) { - use rustix::process::getpid; - - c.bench_function("simple getpid", |b| { - b.iter(|| { - let _ = getpid(); - }) - }); - } - - #[cfg(not(target_os = "wasi"))] - pub(super) fn simple_getpid_libc(c: &mut Criterion) { - c.bench_function("simple getpid libc", |b| { - b.iter(|| unsafe { - let _ = libc::getpid(); - }) - }); - } -} - -#[cfg(not(any( - not(criterion), - not(feature = "fs"), - not(feature = "process"), - not(feature = "time"), - windows, - target_os = "emscripten", - target_os = "redox", - target_os = "wasi", -)))] -criterion_group!( - benches, - suite::simple_statat, - suite::simple_statat_libc, - suite::simple_statat_libc_cstr, - suite::simple_statat_cstr, - suite::simple_clock_gettime, - suite::simple_clock_gettime_libc, - suite::simple_getpid, - suite::simple_getpid_libc -); -#[cfg(not(any( - not(criterion), - not(feature = "fs"), - not(feature = "process"), - not(feature = "time"), - windows, - target_os = "emscripten", - target_os = "redox", - target_os = "wasi", -)))] -criterion_main!(benches); diff --git a/tests/process/pidfd.rs b/tests/process/pidfd.rs index cf7844066..fddaca412 100644 --- a/tests/process/pidfd.rs +++ b/tests/process/pidfd.rs @@ -3,11 +3,10 @@ use libc::{kill, SIGSTOP}; use rustix::fd::AsFd; use rustix::{io, process}; -use serial_test::serial; use std::process::Command; #[test] -#[serial] +#[ignore] fn test_pidfd_waitid() { // Create a new process. let child = Command::new("yes") @@ -42,7 +41,7 @@ fn test_pidfd_waitid() { } #[test] -#[serial] +#[ignore] fn test_pidfd_poll() { // Create a new process. let child = Command::new("sleep") diff --git a/tests/process/wait.rs b/tests/process/wait.rs index f965bf79a..6c51edb16 100644 --- a/tests/process/wait.rs +++ b/tests/process/wait.rs @@ -1,7 +1,6 @@ #[allow(unused_imports)] use libc::{kill, SIGCONT, SIGKILL, SIGSTOP}; use rustix::process; -use serial_test::serial; use std::process::{Command, Stdio}; // These tests must execute serially to prevent race condition, where @@ -9,7 +8,7 @@ use std::process::{Command, Stdio}; // the tests to get stuck. #[test] -#[serial] +#[ignore] fn test_waitpid() { let child = Command::new("yes") .stdout(Stdio::null()) @@ -32,7 +31,7 @@ fn test_waitpid() { target_os = "openbsd" )))] #[test] -#[serial] +#[ignore] fn test_waitid() { let child = Command::new("yes") .stdout(Stdio::null())