From f937fe5c3ee7c4f5e16092a1fdaaff078f1b7b47 Mon Sep 17 00:00:00 2001 From: Camille Mougey Date: Mon, 11 Jan 2021 16:34:35 +0100 Subject: [PATCH 1/3] Assert .h and .hpp bindings files are the ones generated --- .github/workflows/test.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b40b7773..b0c247f2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -108,6 +108,22 @@ jobs: working-directory: bindings/C/tests/windows-msvc/${{ matrix.msvc_platform }}/${{ matrix.version }}/ run: ./mla-bindings-test.exe + sanity-checks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: cbindgen + # Assert .h and .hpp bindings files are the ones generated + - name: Test C header + working-directory: bindings/C + run: cbindgen --config cbindgen_c.toml | diff - mla.h + - name: Test C++ header + working-directory: bindings/C + run: cbindgen --config cbindgen_cpp.toml | diff - mla.hpp + afl-build: runs-on: ubuntu-latest From c6fe785cd789143f04d3b95ca749af872744e834 Mon Sep 17 00:00:00 2001 From: Camille Mougey Date: Mon, 11 Jan 2021 16:46:58 +0100 Subject: [PATCH 2/3] test --- .github/workflows/test.yml | 163 +------------------------------------ bindings/C/mla.h | 2 +- 2 files changed, 5 insertions(+), 160 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b0c247f2..5fc84260 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,103 +10,6 @@ env: CARGO_TERM_COLOR: always jobs: - build: - strategy: - matrix: - build: [linux, macos, windows] - include: - - build: linux - os: ubuntu-latest - - build: macos - os: macos-latest - - build: windows - os: windows-latest - extension: .exe - - runs-on: ${{matrix.os}} - - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - name: Build - env: - RUSTFLAGS: -D warnings - uses: actions-rs/cargo@v1 - with: - command: build - args: --release --all-features --all --exclude mla-fuzz-afl --verbose - - name: Run tests - run: cargo test --all --exclude mla-fuzz-afl --release --verbose - - name: Upload resulting 'mlar' - uses: actions/upload-artifact@v1 - with: - name: ${{ matrix.build }} - path: ./target/release/mlar${{ matrix.extension }} - - long-tests: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - name: Run long tests - run: cd mla && cargo test --release -- --ignored - - test-bindings-c-cpp-linux: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - name: Run C bindings tests on Linux - working-directory: bindings/C/tests/linux-gcc-g++/ - run: make CC=gcc - - name: Run C bindings tests on Linux - working-directory: bindings/C/tests/linux-gcc-g++/ - run: make CC=g++ - - test-bindings-c-cpp-windows: - strategy: - matrix: - version: [Debug-c, Release-c, Debug-cpp, Release-cpp] - target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc] - include: - - version: Debug-c - cargo_arg: "" - - version: Release-c - cargo_arg: --release - - version: Debug-cpp - cargo_arg: "" - - version: Release-cpp - cargo_arg: --release - - target: i686-pc-windows-msvc - msvc_platform: Win32 - - target: x86_64-pc-windows-msvc - msvc_platform: x64 - runs-on: windows-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: ${{ matrix.target }} - - uses: microsoft/setup-msbuild@v1.0.2 - - name: Build static library for Windows - uses: actions-rs/cargo@v1 - with: - command: build - args: ${{ matrix.cargo_arg }} --manifest-path=bindings/C/Cargo.toml --target=${{ matrix.target }} - - name: Compile C/CPP bindings test program for Windows - working-directory: bindings/C/tests/windows-msvc/ - run: msbuild mla-bindings-test.sln /p:Platform=${{ matrix.msvc_platform }} /p:Configuration=${{ matrix.version }} - - name: Run C/CPP bindings test program on Windows - working-directory: bindings/C/tests/windows-msvc/${{ matrix.msvc_platform }}/${{ matrix.version }}/ - run: ./mla-bindings-test.exe sanity-checks: runs-on: ubuntu-latest @@ -115,7 +18,10 @@ jobs: - uses: actions-rs/toolchain@v1 with: toolchain: stable - components: cbindgen + - uses: actions-rs/cargo@v1 + with: + command: install + args: cbindgen # Assert .h and .hpp bindings files are the ones generated - name: Test C header working-directory: bindings/C @@ -124,64 +30,3 @@ jobs: working-directory: bindings/C run: cbindgen --config cbindgen_cpp.toml | diff - mla.hpp - afl-build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - name: Install dependencies - run: sudo apt-get install llvm - - name: Install cargo-afl binary crate - uses: actions-rs/install@v0.1 - with: - crate: afl - version: latest - use-tool-cache: true - - name: Test AFL build - env: - RUSTFLAGS: -D warnings - run: cargo afl build - - fmt: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - components: rustfmt - - name: Check format - run: cargo fmt --all -- --check - - audit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Security audit - uses: actions-rs/audit-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - clippy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - components: clippy - - name: Install dependencies - run: sudo apt-get install llvm - - name: Install cargo-afl binary crate - uses: actions-rs/install@v0.1 - with: - crate: afl - version: latest - use-tool-cache: true - - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings diff --git a/bindings/C/mla.h b/bindings/C/mla.h index 0478821f..d97cf19f 100644 --- a/bindings/C/mla.h +++ b/bindings/C/mla.h @@ -7,7 +7,7 @@ #include #include -enum MLAStatus { +enum MLAStatus { MLA_STATUS_SUCCESS = 0, MLA_STATUS_IO_ERROR = 65536, MLA_STATUS_WRONG_MAGIC = 131072, From 1ab5909412289bdf1e7db0b80aceac4d75bcae76 Mon Sep 17 00:00:00 2001 From: Camille Mougey Date: Mon, 11 Jan 2021 16:53:48 +0100 Subject: [PATCH 3/3] test --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5fc84260..a7a10eac 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,9 +19,9 @@ jobs: with: toolchain: stable - uses: actions-rs/cargo@v1 - with: - command: install - args: cbindgen + with: + command: install + args: cbindgen # Assert .h and .hpp bindings files are the ones generated - name: Test C header working-directory: bindings/C