diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b40b7773..a7a10eac 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,162 +10,23 @@ 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: + sanity-checks: 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 + - uses: actions-rs/cargo@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++ + command: install + args: 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 - 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 - - 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,