Skip to content

Runtime Fuzz Testing #92

Runtime Fuzz Testing

Runtime Fuzz Testing #92

Workflow file for this run

name: Runtime Fuzz Testing
# https://github.blog/changelog/2021-04-20-github-actions-control-permissions-for-github_token/
# https://github.com/ossf/scorecard/blob/2ef20f17fb2e64147c83440cd2c769653454015a/docs/checks.md#token-permissions
permissions:
# top-level permissions must be defined for security reasons.
packages: read
on:
workflow_dispatch:
inputs:
num_of_iterations:
description: Number of iterations per fuzzable variable
required: False
default: 5
jobs:
build:
runs-on: ubuntu-22.04
container:
image: ghcr.io/intel/fpga-runtime-for-opencl/ubuntu-22.04-dev:main
name: Fuzz Testing
steps:
- name: Clone Radamsa
run: |
mkdir radamsa_repo
cd radamsa_repo
git clone https://gitlab.com/akihe/radamsa.git .
- name: Install Radamsa
run: |
cd radamsa_repo
make
sudo make install
cd ..
- name: Install PyYAML
run: pip install pyyaml
- name: Checkout runtime
uses: actions/checkout@v4
- name: Build
run: |
mkdir -p build/fuzz_testing
cd build/fuzz_testing
CC="${CC:-gcc}" CXX="${CXX:-g++}" cmake -G Ninja ../.. -DCMAKE_BUILD_TYPE=Debug -DACL_CODE_COVERAGE=ON -DACL_TSAN=OFF -DACL_WITH_ASAN=ON -DFUZZ_TESTING=ON "$@"
ninja -v
- name: Fuzz testing
run: |
cd build/fuzz_testing
ls
cd fuzz_testing/script
export AOCL_BOARD_PACKAGE_ROOT="$(git rev-parse --show-toplevel)/test/board/a10_ref"
NUM_OF_ITERATIONS=${{ github.event.inputs.num_of_iterations }}
# This if block is only used during testing, because if this workflow is triggered via pull_request, ${{ github.event.inputs.num_of_iterations }} would be empty
if [ -z "${NUM_OF_ITERATIONS}" ]; then
NUM_OF_ITERATIONS=1
fi
python3 fuzz_test.py --all -n $NUM_OF_ITERATIONS
- name: Peek results
run: |
cat build/fuzz_testing/fuzz_testing/results/results.yml
- name: Upload results
uses: actions/upload-artifact@v4
with:
name: fpga-runtime-for-opencl-${{ github.sha }}-fuzz-test-results-${{ github.run_id }}
path: |
/__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/build/fuzz_testing/fuzz_testing/results/results.yml
/__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/build/fuzz_testing/fuzz_testing/test_outputs
if-no-files-found: error