From 0a2283a2432ea278131eb08df83f43e5b3cef5b7 Mon Sep 17 00:00:00 2001 From: quininer Date: Sat, 17 Aug 2024 16:31:19 +0800 Subject: [PATCH] fix ci (#300) --- .github/workflows/ci.yml | 58 ++++++++++---------------------- io-uring-test/src/tests/futex.rs | 2 +- io-uring-test/src/tests/net.rs | 4 +-- io-uring-test/src/tests/queue.rs | 5 ++- io-uring-test/src/utils.rs | 2 +- src/cqueue.rs | 4 +-- src/lib.rs | 2 +- 7 files changed, 26 insertions(+), 51 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36e93937..158b630c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,22 +12,12 @@ jobs: matrix: target: - x86_64-unknown-linux-gnu - - aarch64-unknown-linux-gnu steps: - uses: actions/checkout@v4 - - uses: actions-rs/cargo@v1 - with: - command: test - use-cross: true - args: --target ${{ matrix.target }} - - uses: actions-rs/cargo@v1 - with: - command: run - use-cross: true - # Only run the test package on x86 until we find an ergonomic way - # to virtualize aarch64 - args: --package io-uring-test --features io-uring-test/ci --target x86_64-unknown-linux-gnu + - uses: dtolnay/rust-toolchain@stable + - name: Test + run: cargo run --package io-uring-test --features io-uring-test/ci --target ${{ matrix.target }} check-bench: runs-on: ubuntu-latest @@ -35,22 +25,11 @@ jobs: strategy: fail-fast: false - matrix: - target: - - x86_64-unknown-linux-gnu - steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - profile: minimal - components: clippy - override: true - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --package io-uring-bench + - uses: dtolnay/rust-toolchain@stable + - name: Bench + run: cargo bench --package io-uring-bench check: runs-on: ubuntu-latest @@ -60,7 +39,7 @@ jobs: matrix: toolchain: - - nightly + - stable - "1.48" target: - x86_64-unknown-linux-gnu @@ -70,26 +49,23 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.toolchain }} - target: ${{ matrix.target }} - components: clippy - override: true - - uses: actions-rs/clippy-check@v1 + - uses: dtolnay/rust-toolchain@stable with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --target ${{ matrix.target }} + toolchain: ${{ matrix.toolchain }} + target: ${{ matrix.target }} + components: clippy + override: true + - name: Lint + run: cargo clippy --target ${{ matrix.target }} fmt: name: fmt runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Install Rust - run: rustup update stable - - name: Install rustfmt - run: rustup component add rustfmt + - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt - name: "rustfmt --check" run: | diff --git a/io-uring-test/src/tests/futex.rs b/io-uring-test/src/tests/futex.rs index c115bc48..d0253914 100644 --- a/io-uring-test/src/tests/futex.rs +++ b/io-uring-test/src/tests/futex.rs @@ -26,7 +26,7 @@ fn syscall_futex(futex: *const u32, op: libc::c_int, val: u32) -> io::Result= 0 { - Ok(ret) + Ok(ret as _) } else { Err(io::Error::from_raw_os_error(-ret as _)) } diff --git a/io-uring-test/src/tests/net.rs b/io-uring-test/src/tests/net.rs index 4502b365..60d77319 100644 --- a/io-uring-test/src/tests/net.rs +++ b/io-uring-test/src/tests/net.rs @@ -1661,11 +1661,11 @@ pub fn test_udp_sendzc_with_dest 33 => match cqe.result() { // First SendZc notification 11 => { - assert_eq!(cqueue::more(cqe.flags()), true); + assert!(cqueue::more(cqe.flags())); } // Last SendZc notification 0 => { - assert_eq!(cqueue::more(cqe.flags()), false); + assert!(!cqueue::more(cqe.flags())); } _ => panic!("wrong result for notification"), }, diff --git a/io-uring-test/src/tests/queue.rs b/io-uring-test/src/tests/queue.rs index 69067ab9..68dddad3 100644 --- a/io-uring-test/src/tests/queue.rs +++ b/io-uring-test/src/tests/queue.rs @@ -172,11 +172,10 @@ pub fn test_msg_ring_data( let fd = types::Fd(dest_ring.as_raw_fd()); let result = 82; // b'R' let user_data = 85; // b'U' - let flags = None; unsafe { ring.submission() .push( - &opcode::MsgRingData::new(fd, result, user_data, flags) + &opcode::MsgRingData::new(fd, result, user_data, None) .build() .into(), ) @@ -194,7 +193,7 @@ pub fn test_msg_ring_data( assert_eq!(dest_cqes.len(), 1); assert_eq!(dest_cqes[0].user_data(), user_data); assert_eq!(dest_cqes[0].result(), result); - assert_eq!(dest_cqes[0].flags(), flags.unwrap_or(0)); + assert_eq!(dest_cqes[0].flags(), 0); Ok(()) } diff --git a/io-uring-test/src/utils.rs b/io-uring-test/src/utils.rs index 9a8ae07b..9ac51e26 100644 --- a/io-uring-test/src/utils.rs +++ b/io-uring-test/src/utils.rs @@ -102,7 +102,7 @@ pub fn writev_readv( let mut output = vec![0; text.len()]; let mut output2 = vec![0; text2.len()]; - let text3 = vec![IoSlice::new(text), IoSlice::new(text2)]; + let text3 = [IoSlice::new(text), IoSlice::new(text2)]; let mut output3 = vec![IoSliceMut::new(&mut output), IoSliceMut::new(&mut output2)]; let write_e = opcode::Writev::new(fd_in, text3.as_ptr().cast(), text3.len() as _); diff --git a/src/cqueue.rs b/src/cqueue.rs index c37daa50..2bf35951 100644 --- a/src/cqueue.rs +++ b/src/cqueue.rs @@ -210,7 +210,7 @@ impl Entry { /// /// This is currently used for: /// - Storing the selected buffer ID, if one was selected. See - /// [`BUFFER_SELECT`](crate::squeue::Flags::BUFFER_SELECT) for more info. + /// [`BUFFER_SELECT`](crate::squeue::Flags::BUFFER_SELECT) for more info. #[inline] pub fn flags(&self) -> u32 { self.0.flags @@ -259,7 +259,7 @@ impl Entry32 { /// /// This is currently used for: /// - Storing the selected buffer ID, if one was selected. See - /// [`BUFFER_SELECT`](crate::squeue::Flags::BUFFER_SELECT) for more info. + /// [`BUFFER_SELECT`](crate::squeue::Flags::BUFFER_SELECT) for more info. #[inline] pub fn flags(&self) -> u32 { self.0 .0.flags diff --git a/src/lib.rs b/src/lib.rs index 317d61e6..111a31bd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,7 @@ //! //! The crate only provides a summary of the parameters. //! For more detailed documentation, see manpage. -#![warn(rust_2018_idioms, unused_qualifications)] +#![warn(rust_2018_idioms)] #[macro_use] mod util;