Skip to content

Commit

Permalink
Split test step
Browse files Browse the repository at this point in the history
  • Loading branch information
romainthomas committed Nov 9, 2023
1 parent 1c0df93 commit 5fe14ae
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 23 deletions.
67 changes: 50 additions & 17 deletions .github/workflows/linux-x86-64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ jobs:
testing:
if: "!contains(github.event.commits[0].message, '[skip-test]')"
runs-on: ubuntu-latest
container:
image: liefproject/manylinux_2_28_x86_64
env:
PYTHON_BINARY: "/opt/python/cp38-cp38/bin/python3.8"
LIEF_SAMPLES_DIR: "/tmp/samples"
LIEF_BUILD_DIR: "/tmp/lief-build"
LIEF_VENV: "/tmp/venv"
options: --user 1001:1001
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -67,26 +75,51 @@ jobs:
key: linux-x86-64-${{ runner.os }}-test-${{ steps.get-date.outputs.date }}
restore-keys: |
linux-x86-64-${{ runner.os }}-test
- name: Python 3.8 -- Wheel & Test
- name: Prepare Python virtual env
shell: bash
env:
PYTHON_VERSION: 38
PYTHON_BINARY: "/opt/python/cp38-cp38/bin/python3.8"
run: |
mkdir -p $HOME/.ccache
chmod -R 777 $HOME/.ccache
$PYTHON_BINARY -m venv ${LIEF_VENV}
source ${LIEF_VENV}/bin/activate
python -m pip install \
-r tests/requirements.txt \
-r api/python/build-requirements.txt
- name: Prepare test samples
shell: bash
run: |
source ${LIEF_VENV}/tmp/lief_venv/bin/activate
mkdir -p ${LIEF_SAMPLES_DIR}
python tests/dl_samples.py ${LIEF_SAMPLES_DIR}
- name: Build & install LIEF
shell: bash
run: |
source ${LIEF_VENV}/bin/activate
export PYLIEF_CONF="${GITHUB_WORKSPACE}/scripts/docker/config/pylinux-test-x64.toml"
python -m pip -vvv install api/python
- name: Run tests
timeout-minutes: 5
shell: bash
run: |
source ${LIEF_VENV}/bin/activate
python tests/run_pytest.py
python tests/run_tools_check.py ${LIEF_BUILD_DIR}/
ctest --output-on-failure --test-dir ${LIEF_BUILD_DIR}/
- name: Run fuzzing tests
shell: bash
timeout-minutes: 10
run: |
source ${LIEF_VENV}/bin/activate
export PYTHONPATH="${GITHUB_WORKSPACE}/tests:$PYTHONPATH"
python tests/elf/fuzzing.py \
${LIEF_BUILD_DIR}/tests/Melkor/src/MELKOR/melkor \
--input-seed ${LIEF_SAMPLES_DIR}/ELF/ELF64_x86-64_binary_ls.bin -n 100
python tests/elf/fuzzing.py \
${LIEF_BUILD_DIR}/tests/Melkor/src/MELKOR/melkor \
--input-seed ${LIEF_SAMPLES_DIR}/ELF/ELF64_x86-64_binary_openssl.bin -n 100
docker run --rm -u 1001:1001 \
-e CCACHE_COMPRESS=1 \
-e CCACHE_MAXSIZE=10.0G \
-e CCACHE_CPP2=1 \
-e CCACHE_DIR=/ccache \
-e PYTHON_VERSION=$PYTHON_VERSION \
-e PYTHON_BINARY=$PYTHON_BINARY \
-v $GITHUB_WORKSPACE:/src \
-v $HOME/.ccache:/ccache \
liefproject/manylinux_2_28_x86_64 \
bash /src/scripts/docker/test-linux-x64
python tests/elf/fuzzing.py \
${LIEF_BUILD_DIR}/tests/Melkor/src/MELKOR/melkor \
--input-seed ${LIEF_SAMPLES_DIR}/ELF/ELF64_x86-64_binary_nm.bin -n 100
pywheels:
runs-on: ubuntu-latest
needs: linux-sdk
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ jobs:
python -m pip install -r tests/requirements.txt
python -m pip -vvv install api/python
python tests/dl_samples.py ${LIEF_SAMPLES_DIR}
- name: Run tests
shell: bash
timeout-minutes: 20
env:
LIEF_SAMPLES_DIR: "/tmp/samples"
LIEF_BUILD_DIR: "/tmp/lief-build"
run: |
python tests/run_pytest.py
python tests/run_tools_check.py ${LIEF_BUILD_DIR}/
ctest --output-on-failure --test-dir ${LIEF_BUILD_DIR}/
Expand Down
8 changes: 2 additions & 6 deletions scripts/docker/test-linux-x64
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/sh
set -ex
set -e
export LIEF_SAMPLES_DIR=/tmp/samples
export CXXFLAGS='-ffunction-sections -fdata-sections -fvisibility-inlines-hidden -static-libgcc'
export CFLAGS='-ffunction-sections -fdata-sections -static-libgcc'
Expand All @@ -18,11 +18,7 @@ python -m pip install \
mkdir -p ${LIEF_SAMPLES_DIR}

python tests/dl_samples.py ${LIEF_SAMPLES_DIR}

pushd /src/api/python
python -m pip -vvv wheel --no-build-isolation --wheel-dir=/src/wheel_stage .
python -m pip -vvv install .
popd
python -m pip -vvv install /src/api/python

# Run the Python test suite
python tests/run_pytest.py
Expand Down

0 comments on commit 5fe14ae

Please sign in to comment.