cea-sec/miasm

View on GitHub
.github/workflows/tests.yml

Summary

Maintainability
Test Coverage
name: Miasm regression tests

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ['3.8', '3.10']

    steps:

    - name: Git checkout
      uses: actions/checkout@v3

    - name: Use Python ${{ matrix.python-version }}
      uses: actions/setup-python@v4
      with:
        python-version: ${{ matrix.python-version }}

    - name: Update pip
      run: pip install pip --upgrade

    - name: Install requirements
      run: pip install -r requirements.txt

    - name: Install llvm 11 (llvmlite compatible)
      run: sudo apt-get install llvm-11

    - name: Install optional requirements
      run: pip install -r optional_requirements.txt

    - name: Install Miasm
      uses: ./.github/actions/install

    - name: Base tests
      run: cd test; python --version |& grep -q "Python 3" || flags="-W error"; python $flags test_all.py && git ls-files -o --exclude-standard

    - name: Regression tests
      run: cd test; python --version |& grep -q "Python 3" || flags="-W error"; python $flags test_all.py $MIASM_TEST_EXTRA_ARG && git ls-files -o --exclude-standard
      env:
        MIASM_TEST_EXTRA_ARG: -o regression -t long,python,llvm,gcc,z3,qemu,cparser

    - name: Run examples
      run: cd test; python --version |& grep -q "Python 3" || flags="-W error"; python $flags test_all.py $MIASM_TEST_EXTRA_ARG && git ls-files -o --exclude-standard
      env:
        MIASM_TEST_EXTRA_ARG: -o example -t long,python,llvm,gcc,z3,qemu,cparser

    - name: Test long tests
      run: cd test; python --version |& grep -q "Python 3" || flags="-W error"; python $flags test_all.py $MIASM_TEST_EXTRA_ARG && git ls-files -o --exclude-standard
      env:
        MIASM_TEST_EXTRA_ARG: -o long

    - name: Test qemu jitter llvm/gcc
      run: cd test; python --version |& grep -q "Python 3" || flags="-W error"; python $flags test_all.py $MIASM_TEST_EXTRA_ARG && git ls-files -o --exclude-standard
      env:
        MIASM_TEST_EXTRA_ARG: -o qemu -t llvm,gcc

    - name: Test qemu jitter python/gcc
      run: cd test; python --version |& grep -q "Python 3" || flags="-W error"; python $flags test_all.py $MIASM_TEST_EXTRA_ARG && git ls-files -o --exclude-standard
      env:
        MIASM_TEST_EXTRA_ARG: -o qemu -t python,gcc

    - name: Test qemu jitter python/llvm
      run: cd test; python --version |& grep -q "Python 3" || flags="-W error"; python $flags test_all.py $MIASM_TEST_EXTRA_ARG && git ls-files -o --exclude-standard
      env:
        MIASM_TEST_EXTRA_ARG: -o qemu -t python,llvm

    - name: Test llvm qemu/long
      run: cd test; python --version |& grep -q "Python 3" || flags="-W error"; python $flags test_all.py $MIASM_TEST_EXTRA_ARG && git ls-files -o --exclude-standard
      env:
        MIASM_TEST_EXTRA_ARG: -o llvm -t qemu,long

    - name: Test gcc qemu/long
      run: cd test; python --version |& grep -q "Python 3" || flags="-W error"; python $flags test_all.py $MIASM_TEST_EXTRA_ARG && git ls-files -o --exclude-standard
      env:
        MIASM_TEST_EXTRA_ARG: -o gcc -t qemu,long

    - name: Test python qemu/long
      run: cd test; python --version |& grep -q "Python 3" || flags="-W error"; python $flags test_all.py $MIASM_TEST_EXTRA_ARG && git ls-files -o --exclude-standard
      env:
        MIASM_TEST_EXTRA_ARG: -o python -t qemu,long

    - name: Z3 tests
      run: cd test; python --version |& grep -q "Python 3" || flags="-W error"; python $flags test_all.py $MIASM_TEST_EXTRA_ARG && git ls-files -o --exclude-standard
      env:
        MIASM_TEST_EXTRA_ARG: -o z3

    - name: Cparser tests
      run: cd test; python --version |& grep -q "Python 3" || flags="-W error"; python $flags test_all.py $MIASM_TEST_EXTRA_ARG && git ls-files -o --exclude-standard
      env:
        MIASM_TEST_EXTRA_ARG: -o cparser

    - name: Loader tests
      run: cd example/loader; python --version |& grep -q "Python 3" || flags="-W error"; for i in ../../miasm-extended-tests/loader/dll_win_xp/*.dll; do python get_exports.py $i; done
      env:
        MIASM_EXTENTED_TESTS_LOADER: loader

    - name: Loader tests
      run: cd "miasm-extended-tests/$MIASM_EXTENTED_TESTS_LOADER" && ./test_dll.py
      env:
        MIASM_EXTENTED_TESTS_LOADER: loader

    - name: IR tests
      run: cd "miasm-extended-tests/$MIASM_EXTENTED_TESTS_IR" && ./run.sh
      env:
        MIASM_EXTENTED_TESTS_IR: ir_tests