Skip to content

llvm-quick-fuzz

llvm-quick-fuzz #4758

Workflow file for this run

name: llvm-quick-fuzz
on:
workflow_dispatch: # i.e. manual activation
# This workflow utilizes a wide range of llvm versions, each of which can be
# installed. When not cached, this could take a long time to run and therefore
# running it nightly (at 3AM) can help ensure it doesn't impact normal
# development. However, notifications of failures are sent to the last person
# that updated this cron syntax portion, or who last enabled the workflow.
# That's pretty inconvenient (and brittle), so now that caching is enabled,
# this is set to be run on approved branches and master merges.
# schedule:
# # * is a special character in YAML so you have to quote this string
# - cron: '* 3 * * *'
pull_request_review:
types: [submitted] # + github.event.review.state check below
env:
# The CACHE_VERSION can be updated to force the use of a new cache if
# the current cache contents become corrupted/invalid. This can
# sometimes happen when (for example) the OS version is changed but
# older .so files are cached, which can have various effects
# (e.g. cabal complains it can't find a valid version of the "happy"
# tool).
CACHE_VERSION: 1
jobs:
fuzz:
runs-on: ${{ matrix.os }}
if: github.event.review.state == 'approved'
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
# See doc/developing.md
ghc: ["9.2.8"]
llvm: [ "https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.2/clang+llvm-16.0.2-x86_64-linux-gnu-ubuntu-22.04.tar.xz"
, "https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz"
, "https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz"
, "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz"
, "https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.0/clang+llvm-12.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz"
, "https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz"
, "https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz"
, "https://releases.llvm.org/9.0.0/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz"
, "https://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz"
, "https://releases.llvm.org/7.0.1/clang+llvm-7.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz"
, "https://releases.llvm.org/6.0.1/clang+llvm-6.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz"
, "https://releases.llvm.org/5.0.2/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04.tar.xz"
, "https://releases.llvm.org/4.0.1/clang+llvm-4.0.1-x86_64-linux-gnu-debian8.tar.xz"
, "https://releases.llvm.org/3.9.0/clang+llvm-3.9.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz"
, "https://releases.llvm.org/3.8.0/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz"
, "https://releases.llvm.org/3.7.1/clang+llvm-3.7.1-x86_64-linux-gnu-ubuntu-14.04.tar.xz"
, "https://releases.llvm.org/3.6.2/clang+llvm-3.6.2-x86_64-linux-gnu-ubuntu-14.04.tar.xz"
, "https://releases.llvm.org/3.5.2/clang+llvm-3.5.2-x86_64-linux-gnu-ubuntu-14.04.tar.xz"
]
name: llvm-quick-fuzz - ${{ matrix.llvm }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: haskell/actions/setup@v1
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
- uses: actions/cache/restore@v3
name: Restore cabal store cache
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-newstyle
key: ${{ env.CACHE_VERSION }}-cabal-${{ matrix.os }}-${{ matrix.ghc }}-${{ github.sha }}
restore-keys: ${{ env.CACHE_VERSION }}-cabal-${{ matrix.os }}-${{ matrix.ghc }}-
- shell: bash
run: |
sudo apt-get -y install csmith libcsmith-dev creduce
ln -s /usr/include/csmith $PWD/csmith-include
- shell: bash
name: Install LLVM
run: |
{ curl -sSL ${{ matrix.llvm }} -o llvm.tar.xz && tar xf llvm.tar.xz && mv clang+llvm-* llvm ; } || \
{ curl -sSL ${{ matrix.llvm }} -o llvm.tar.xz && tar xf llvm.tar.xz && mv clang+llvm-* llvm ; }
echo "$PWD/llvm/bin" >> $GITHUB_PATH
- name: Configure
run: cabal configure --enable-tests -j2 -ffuzz -fregressions
- shell: bash
name: Build
run: cabal build llvm-disasm fuzz-llvm-disasm
- shell: bash
run: ln -s $PWD/llvm/bin/clang $PWD/llvm/bin/clangy
- shell: bash
name: Run fuzzing
run: |
cabal exec fuzz-llvm-disasm -- -n 50 --junit-xml results.xml -o results --collapse --clang-flags="-O -w" --clang-flags="-O -w -g" -c clangy
test $(grep "failures=\"0\"" results.xml | wc -l) -eq 2
env:
CSMITH_PATH: "csmith-include"
- uses: actions/cache/save@v3
name: Save cabal store cache
if: always()
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-newstyle
key: ${{ env.CACHE_VERSION }}-cabal-${{ matrix.os }}-${{ matrix.ghc }}-${{ github.sha }}