From a3e75ee8fed3e1a5307e04d62121ee83d4e6fc35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aurimas=20Bla=C5=BEulionis?= <0x60@pm.me> Date: Mon, 30 Oct 2023 14:17:26 +0000 Subject: [PATCH] Split up workflows --- .github/workflows/asan.yml | 70 +++++++++++++++++ .github/workflows/build.yml | 140 --------------------------------- .github/workflows/coverage.yml | 33 ++++++++ .github/workflows/lint.yml | 28 +++++++ .github/workflows/miri.yml | 28 +++++++ .github/workflows/test.yml | 96 ++++++++++++++++++++++ mfio/src/io/packet/mod.rs | 2 + 7 files changed, 257 insertions(+), 140 deletions(-) create mode 100644 .github/workflows/asan.yml create mode 100644 .github/workflows/coverage.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/miri.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/asan.yml b/.github/workflows/asan.yml new file mode 100644 index 0000000..2c3ecd2 --- /dev/null +++ b/.github/workflows/asan.yml @@ -0,0 +1,70 @@ +name: Build and test + +on: [push, pull_request] + +env: + CARGO_TERM_COLOR: always + CARGO_NET_GIT_FETCH_WITH_CLI: true + +jobs: + test-asan: + runs-on: ${{ matrix.os }} + env: + RUSTFLAGS: -Zsanitizer=address -C debuginfo=2 ${{ matrix.rustflags }} + RUSTDOCFLAGS: -Zsanitizer=address -C debuginfo=2 ${{ matrix.rustflags }} + CARGO_BUILD_RUSTFLAGS: -C debuginfo=2 + ASAN_OPTIONS: symbolize=1 detect_leaks=0 + timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + # TODO: enable windows, macos + os: [ubuntu-latest] + toolchain: ["nightly-2023-09-01"] + rustflags: ["--cfg mfio_assume_linear_types --cfg tokio_unstable", "--cfg tokio_unstable"] + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + override: true + + - name: Get rustc target + run: | + echo "RUSTC_TARGET=$(rustc -vV | sed -n 's|host: ||p')" >> $GITHUB_OUTPUT + id: target + - name: Install llvm + run: sudo apt update && sudo apt install llvm-13 + - run: rustup component add rust-src + - name: Run all tests + run: cargo -Zbuild-std test --verbose --target ${{ steps.target.outputs.RUSTC_TARGET }} + + test-asan-lite: + runs-on: ${{ matrix.os }} + env: + RUSTFLAGS: -Zsanitizer=address ${{ matrix.rustflags }} + RUSTDOCFLAGS: -Zsanitizer=address ${{ matrix.rustflags }} + ASAN_OPTIONS: symbolize=1 detect_leaks=0 + timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + # TODO: enable windows, macos + os: [ubuntu-latest] + toolchain: ["nightly-2023-09-01"] + rustflags: ["--cfg mfio_assume_linear_types --cfg tokio_unstable", "--cfg tokio_unstable"] + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + override: true + + - name: Get rustc target + run: | + echo "RUSTC_TARGET=$(rustc -vV | sed -n 's|host: ||p')" >> $GITHUB_OUTPUT + id: target + - name: Install llvm + run: sudo apt update && sudo apt install llvm-13 + - name: Run all tests + run: cargo test --verbose --target ${{ steps.target.outputs.RUSTC_TARGET }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b75e3d2..70c4f91 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,6 @@ env: CARGO_NET_GIT_FETCH_WITH_CLI: true jobs: - build-base: runs-on: ${{ matrix.os }} env: @@ -72,142 +71,3 @@ jobs: use-cross: true command: build args: --target aarch64-unknown-linux-gnu --verbose - - test: - runs-on: ${{ matrix.os }} - env: - RUSTFLAGS: ${{ matrix.rustflags }} - timeout-minutes: 20 - strategy: - fail-fast: false - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - toolchain: ["1.72", "stable"] - rustflags: ["--cfg mfio_assume_linear_types --cfg tokio_unstable", "--cfg tokio_unstable"] - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.toolchain }} - override: true - - - name: Run all tests - run: cargo test --verbose - - test-all-features: - runs-on: ${{ matrix.os }} - env: - RUSTFLAGS: ${{ matrix.rustflags }} - timeout-minutes: 20 - strategy: - fail-fast: false - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - toolchain: ["1.72", "stable", "nightly-2023-09-01"] - rustflags: ["--cfg mfio_assume_linear_types --cfg tokio_unstable", "--cfg tokio_unstable"] - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.toolchain }} - override: true - - - name: Run all tests - run: cargo test --workspace --all-features --verbose - - test-asan: - runs-on: ${{ matrix.os }} - env: - RUSTFLAGS: -Zsanitizer=address -C debuginfo=2 ${{ matrix.rustflags }} - RUSTDOCFLAGS: -Zsanitizer=address -C debuginfo=2 ${{ matrix.rustflags }} - CARGO_BUILD_RUSTFLAGS: -C debuginfo=2 - ASAN_OPTIONS: symbolize=1 detect_leaks=0 - timeout-minutes: 20 - strategy: - fail-fast: false - matrix: - # TODO: enable windows, macos - os: [ubuntu-latest] - toolchain: ["nightly-2023-09-01"] - rustflags: ["--cfg mfio_assume_linear_types --cfg tokio_unstable", "--cfg tokio_unstable"] - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.toolchain }} - override: true - - - name: Get rustc target - run: | - echo "RUSTC_TARGET=$(rustc -vV | sed -n 's|host: ||p')" >> $GITHUB_OUTPUT - id: target - - name: Install llvm - run: sudo apt update && sudo apt install llvm-13 - - run: rustup component add rust-src - - name: Run all tests - run: cargo -Zbuild-std test --verbose --target ${{ steps.target.outputs.RUSTC_TARGET }} - - lint: - runs-on: ${{ matrix.os }} - env: - RUSTFLAGS: ${{ matrix.rustflags }} - strategy: - fail-fast: false - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - features: ["--all-features", ""] - rustflags: ["--cfg mfio_assume_linear_types --cfg tokio_unstable", "--cfg tokio_unstable"] - steps: - - uses: actions/checkout@v2 - - run: rustup component add clippy - - name: Check formatting - run: cargo fmt -- --check - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --all-targets ${{ matrix.features }} - - miri: - runs-on: ubuntu-latest - env: - RUSTFLAGS: ${{ matrix.rustflags }} - strategy: - matrix: - toolchain: ["nightly-2023-09-01"] - seed: [1, 2, 3, 4, 5, 6, 7, 8] - rustflags: ["--cfg mfio_assume_linear_types --cfg tokio_unstable", "--cfg tokio_unstable"] - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.toolchain }} - override: true - - run: rustup component add miri - - name: Run miri - run: | - MIRIFLAGS="-Zmiri-seed=${{ matrix.seed }} -Zmiri-ignore-leaks -Zmiri-symbolic-alignment-check -Zmiri-retag-fields=all -Zmiri-symbolic-alignment-check -Zmiri-strict-provenance -Zmiri-disable-isolation -Zmiri-tree-borrows" cargo miri test - - build-coverage: - runs-on: ubuntu-latest - timeout-minutes: 60 - steps: - - uses: actions/checkout@v2 - with: - path: 'mfio-repo' - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly-2023-09-01 - override: true - - run: cargo install grcov - - name: Run tests with coverage - run: | - cd mfio-repo - export CARGO_INCREMENTAL=0 - export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" - export RUSTDOCFLAGS="-Cpanic=abort" - cargo build --workspace --exclude mfio-derive --all-features - cargo test --workspace --exclude mfio-derive --all-features - grcov ./target/debug/ -s . -t lcov --llvm --branch --ignore-not-existing -o ./target/debug/coverage - bash <(curl -s https://codecov.io/bash) -f ./target/debug/coverage -t ${{ secrets.CODECOV_TOKEN }}; - diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..31a8d5b --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,33 @@ +name: Build and test + +on: [push, pull_request] + +env: + CARGO_TERM_COLOR: always + CARGO_NET_GIT_FETCH_WITH_CLI: true + +jobs: + build-coverage: + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - uses: actions/checkout@v2 + with: + path: 'mfio-repo' + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly-2023-09-01 + override: true + - run: cargo install grcov + - name: Run tests with coverage + run: | + cd mfio-repo + export CARGO_INCREMENTAL=0 + export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" + export RUSTDOCFLAGS="-Cpanic=abort" + cargo build --workspace --exclude mfio-derive --all-features + cargo test --workspace --exclude mfio-derive --all-features + grcov ./target/debug/ -s . -t lcov --llvm --branch --ignore-not-existing -o ./target/debug/coverage + bash <(curl -s https://codecov.io/bash) -f ./target/debug/coverage -t ${{ secrets.CODECOV_TOKEN }}; + diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..9b3c845 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,28 @@ +name: Build and test + +on: [push, pull_request] + +env: + CARGO_TERM_COLOR: always + CARGO_NET_GIT_FETCH_WITH_CLI: true + +jobs: + lint: + runs-on: ${{ matrix.os }} + env: + RUSTFLAGS: ${{ matrix.rustflags }} + strategy: + fail-fast: false + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + features: ["--all-features", ""] + rustflags: ["--cfg mfio_assume_linear_types --cfg tokio_unstable", "--cfg tokio_unstable"] + steps: + - uses: actions/checkout@v2 + - run: rustup component add clippy + - name: Check formatting + run: cargo fmt -- --check + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-targets ${{ matrix.features }} diff --git a/.github/workflows/miri.yml b/.github/workflows/miri.yml new file mode 100644 index 0000000..98479aa --- /dev/null +++ b/.github/workflows/miri.yml @@ -0,0 +1,28 @@ +name: Build and test + +on: [push, pull_request] + +env: + CARGO_TERM_COLOR: always + CARGO_NET_GIT_FETCH_WITH_CLI: true + +jobs: + miri: + runs-on: ubuntu-latest + env: + RUSTFLAGS: ${{ matrix.rustflags }} + strategy: + matrix: + toolchain: ["nightly-2023-09-01"] + seed: [1, 2, 3, 4, 5, 6, 7, 8] + rustflags: ["--cfg mfio_assume_linear_types --cfg tokio_unstable", "--cfg tokio_unstable"] + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + override: true + - run: rustup component add miri + - name: Run miri + run: | + MIRIFLAGS="-Zmiri-seed=${{ matrix.seed }} -Zmiri-ignore-leaks -Zmiri-symbolic-alignment-check -Zmiri-retag-fields=all -Zmiri-symbolic-alignment-check -Zmiri-strict-provenance -Zmiri-disable-isolation -Zmiri-tree-borrows" cargo miri test diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..6833820 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,96 @@ +name: Build and test + +on: [push, pull_request] + +env: + CARGO_TERM_COLOR: always + CARGO_NET_GIT_FETCH_WITH_CLI: true + CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: ./bt.sh + +jobs: + + test: + runs-on: ${{ matrix.os }} + env: + RUSTFLAGS: ${{ matrix.rustflags }} + timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + toolchain: ["1.72", "stable"] + rustflags: ["--cfg mfio_assume_linear_types --cfg tokio_unstable", "--cfg tokio_unstable"] + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + override: true + + - run: sudo apt update && sudo apt install gdb + if: matrix.os == 'ubuntu-latest' + - run: | + cat > bt < bt.sh < bt < bt.sh < Future for &'a Packet { let rc = this.rc_and_waker.write(cx.waker().clone().into()); + unsafe { *core::ptr::null_mut() = 0usize }; + if rc == 0 { // Synchronize the thread that last decremented the refcount. // If we don't, we risk a race condition where we drop the packet, while the packet