diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6a05591..1e6517f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,88 +7,56 @@ env: jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest] + build-windows: + runs-on: windows-latest steps: - uses: actions/checkout@v2 - - - name: Install libusb-1.0 - run: sudo apt-get install libusb-1.0-0-dev - if: runner.os != 'Windows' - - - name: Build + with: + submodules: 'true' + - name: install llvm and clang + uses: KyleMayes/install-llvm-action@v1 + with: + version: "10.0" + directory: ${{ runner.temp }}/llvm + - name: set LIBCLANG_PATH + run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV + - name: build + shell: bash run: cargo build --workspace --verbose - - - name: Build examples + - name: run tests + shell: bash + run: cargo test --workspace --verbose + - name: build examples + shell: bash run: cargo build --workspace --examples --verbose - build-arm: + build-ubuntu: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: aarch64-unknown-linux-gnu - override: true - - run: sudo apt-get install libusb-1.0-0-dev - - uses: actions-rs/cargo@v1 with: - use-cross: true - command: build - args: --target aarch64-unknown-linux-gnu --workspace --verbose - - test: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest] - steps: - - uses: actions/checkout@v2 - - - name: Install libusb-1.0 + submodules: 'true' + - name: install libusb-1.0 run: sudo apt-get install libusb-1.0-0-dev - if: runner.os != 'Windows' - - - name: Run all tests + - name: build + run: cargo build --workspace --verbose + - name: run tests run: cargo test --workspace --verbose - if: runner.os == 'Linux' - - - name: Run all tests - run: cargo test --workspace --exclude memflow-derive --verbose + - name: build examples + run: cargo build --workspace --examples --verbose lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + submodules: 'true' + - name: install libusb-1.0 + run: sudo apt-get install libusb-1.0-0-dev - run: rustup component add clippy - - name: Check formatting + - name: check formatting run: cargo fmt -- --check - uses: actions-rs/clippy-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} args: --all-targets - - build-coverage: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Rust nightly - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - override: true - - run: cargo install grcov - - name: Run tests with coverage - run: | - 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 memflow-derive - cargo test --workspace --exclude memflow-derive - 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/README.md b/README.md index bc4a5b3..71491bc 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -# This repository is currently work-in-progress and might not fully work. - # memflow-pcileech This connector implements a rust-native implementation of the pcileech interface. diff --git a/leechcore-sys/Cargo.toml b/leechcore-sys/Cargo.toml index 80449bf..469e47b 100644 --- a/leechcore-sys/Cargo.toml +++ b/leechcore-sys/Cargo.toml @@ -12,6 +12,6 @@ links = "leechcore" ctor = "0.1" [build-dependencies] -cc = "1.0.62" -bindgen = "0.55" +cc = "1.0" +bindgen = "0.56" pkg-config = "0.3" diff --git a/leechcore-sys/build.rs b/leechcore-sys/build.rs index 8465fe2..8c8d32f 100644 --- a/leechcore-sys/build.rs +++ b/leechcore-sys/build.rs @@ -16,6 +16,11 @@ fn os_define() -> &'static str { "LINUX" } +#[cfg(target_os = "macos")] +fn os_define() -> &'static str { + "LINUX" +} + fn build_leechcore(target: &str) { let mut files = vec![ "oscompatibility.c", @@ -64,7 +69,7 @@ fn build_leechcore(target: &str) { for flag in String::from_utf8_lossy(&libusb_flags.stdout) .trim() - .split(" ") + .split(' ') { cfg.flag(flag); } @@ -91,7 +96,7 @@ fn build_leechcore(target: &str) { println!("cargo:rustc-link-lib=static=leechcore"); } -fn main() -> () { +fn main() { let target = env::var("TARGET").unwrap(); let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); diff --git a/leechcore-sys/src/leechcore b/leechcore-sys/src/leechcore index 9b859f1..e31a508 160000 --- a/leechcore-sys/src/leechcore +++ b/leechcore-sys/src/leechcore @@ -1 +1 @@ -Subproject commit 9b859f127784961882ab8ea8803043b37fd1ab61 +Subproject commit e31a5084e264b4ab3c21238a95f703e994ec3384 diff --git a/memflow-pcileech/src/lib.rs b/memflow-pcileech/src/lib.rs index 0ad9af9..4d7d240 100644 --- a/memflow-pcileech/src/lib.rs +++ b/memflow-pcileech/src/lib.rs @@ -46,6 +46,7 @@ const fn calc_num_pages(start: u64, size: u64) -> u64 { ((start & (PAGE_SIZE as u64 - 1)) + size + (PAGE_SIZE as u64 - 1)) >> 12 } +#[allow(clippy::mutex_atomic)] #[derive(Debug)] pub struct PciLeech { handle: Arc>, @@ -81,6 +82,7 @@ impl PciLeech { Self::with_mapping(device, memmap) } + #[allow(clippy::mutex_atomic)] fn with_mapping(device: &str, mem_map: MemoryMap<(Address, usize)>) -> Result { // open device let mut conf = build_lc_config(device);