Merge branch 'master' of github.com:memflow/memflow-pcileech

pull/7/head
ko1N 4 years ago
commit ada67bae28

@ -7,88 +7,56 @@ env:
jobs: jobs:
build: build-windows:
runs-on: ${{ matrix.os }} runs-on: windows-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with:
- name: Install libusb-1.0 submodules: 'true'
run: sudo apt-get install libusb-1.0-0-dev - name: install llvm and clang
if: runner.os != 'Windows' uses: KyleMayes/install-llvm-action@v1
with:
- name: Build 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 run: cargo build --workspace --verbose
- name: run tests
- name: Build examples shell: bash
run: cargo test --workspace --verbose
- name: build examples
shell: bash
run: cargo build --workspace --examples --verbose run: cargo build --workspace --examples --verbose
build-arm: build-ubuntu:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - 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: with:
use-cross: true submodules: 'true'
command: build - name: install libusb-1.0
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
run: sudo apt-get install libusb-1.0-0-dev run: sudo apt-get install libusb-1.0-0-dev
if: runner.os != 'Windows' - name: build
run: cargo build --workspace --verbose
- name: Run all tests - name: run tests
run: cargo test --workspace --verbose run: cargo test --workspace --verbose
if: runner.os == 'Linux' - name: build examples
run: cargo build --workspace --examples --verbose
- name: Run all tests
run: cargo test --workspace --exclude memflow-derive --verbose
lint: lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - 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 - run: rustup component add clippy
- name: Check formatting - name: check formatting
run: cargo fmt -- --check run: cargo fmt -- --check
- uses: actions-rs/clippy-check@v1 - uses: actions-rs/clippy-check@v1
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets 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 }};

@ -1,5 +1,3 @@
# This repository is currently work-in-progress and might not fully work.
# memflow-pcileech # memflow-pcileech
This connector implements a rust-native implementation of the pcileech interface. This connector implements a rust-native implementation of the pcileech interface.

@ -12,6 +12,6 @@ links = "leechcore"
ctor = "0.1" ctor = "0.1"
[build-dependencies] [build-dependencies]
cc = "1.0.62" cc = "1.0"
bindgen = "0.55" bindgen = "0.56"
pkg-config = "0.3" pkg-config = "0.3"

@ -16,6 +16,11 @@ fn os_define() -> &'static str {
"LINUX" "LINUX"
} }
#[cfg(target_os = "macos")]
fn os_define() -> &'static str {
"LINUX"
}
fn build_leechcore(target: &str) { fn build_leechcore(target: &str) {
let mut files = vec![ let mut files = vec![
"oscompatibility.c", "oscompatibility.c",
@ -64,7 +69,7 @@ fn build_leechcore(target: &str) {
for flag in String::from_utf8_lossy(&libusb_flags.stdout) for flag in String::from_utf8_lossy(&libusb_flags.stdout)
.trim() .trim()
.split(" ") .split(' ')
{ {
cfg.flag(flag); cfg.flag(flag);
} }
@ -91,7 +96,7 @@ fn build_leechcore(target: &str) {
println!("cargo:rustc-link-lib=static=leechcore"); println!("cargo:rustc-link-lib=static=leechcore");
} }
fn main() -> () { fn main() {
let target = env::var("TARGET").unwrap(); let target = env::var("TARGET").unwrap();
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());

@ -1 +1 @@
Subproject commit 9b859f127784961882ab8ea8803043b37fd1ab61 Subproject commit e31a5084e264b4ab3c21238a95f703e994ec3384

@ -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 ((start & (PAGE_SIZE as u64 - 1)) + size + (PAGE_SIZE as u64 - 1)) >> 12
} }
#[allow(clippy::mutex_atomic)]
#[derive(Debug)] #[derive(Debug)]
pub struct PciLeech { pub struct PciLeech {
handle: Arc<Mutex<HANDLE>>, handle: Arc<Mutex<HANDLE>>,
@ -81,6 +82,7 @@ impl PciLeech {
Self::with_mapping(device, memmap) Self::with_mapping(device, memmap)
} }
#[allow(clippy::mutex_atomic)]
fn with_mapping(device: &str, mem_map: MemoryMap<(Address, usize)>) -> Result<Self> { fn with_mapping(device: &str, mem_map: MemoryMap<(Address, usize)>) -> Result<Self> {
// open device // open device
let mut conf = build_lc_config(device); let mut conf = build_lc_config(device);

Loading…
Cancel
Save