Skip to content

Commit

Permalink
gh: Add llvm test suite workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jezurko committed Feb 27, 2024
1 parent eedf3c4 commit 0703024
Showing 1 changed file with 138 additions and 0 deletions.
138 changes: 138 additions & 0 deletions .github/workflows/llvm-ts-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
#
# Copyright (c) 2021-present, Trail of Bits, Inc.
# All rights reserved.
#
# This source code is licensed in accordance with the terms specified in
# the LICENSE file found in the root directory of this source tree.
#

name: "LLVM test suite"

on:
push:
branches:
- 'master'

tags:
- '*'

pull_request:
branches:
- '*'

jobs:
build:
name: "Build VAST"
strategy:
matrix:
llvm-version: [17]
image-version: [22.04]

runs-on: ubuntu-${{ matrix.image-version }}
timeout-minutes: 60
container:
image:
ghcr.io/trailofbits/vast-ubuntu-${{ matrix.image-version }}-llvm-${{ matrix.llvm-version }}-dev:latest

env:
CMAKE_PREFIX_PATH: "/usr/lib/llvm-${{ matrix.llvm-version }}/lib/cmake/mlir/;/usr/lib/llvm-${{ matrix.llvm-version }}/lib/cmake/clang/"
TOOLCHAIN: ${{ github.workspace }}/cmake/lld.toolchain.cmake
LLVM_EXTERNAL_LIT: "/usr/local/bin/lit"

steps:
- name: Clone the VAST repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1

- name: Configure build
run: |
cmake --preset ninja-multi-default --toolchain ${TOOLCHAIN} \
-DCMAKE_VERBOSE_MAKEFILE=True \
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \
-DLLVM_EXTERNAL_LIT=${LLVM_EXTERNAL_LIT}
- name: Build release
run: |
cmake --build --preset ninja-rel -j $(nproc)
cpack -G TXZ --config ./builds/ninja-multi-default/CPackConfig.cmake
- name: Save VAST build
uses: actions/cache@v4
with:
path: ./builds/ninja-multi-default/package/*
retention-days: 1

test:
name: "Run LLVM test suite"
needs: build
strategy:
matrix:
llvm-version: [17]
image-version: [22.04]
vast-target: ['hl', 'llvm', '']


runs-on: ubuntu-${{ matrix.image-version }}
timeout-minutes: 60
container:
image:
ghcr.io/trailofbits/vast-ubuntu-${{ matrix.image-version }}-llvm-${{ matrix.llvm-version }}-dev:latest

steps:
- name: Fetch VAST artifact
uses: actions/download-artifact@v4
with:
name: VAST

- name: Unpack VAST
run: |
mkdir vast && tar -xf VAST-* -C vast --strip-components=1
- name: Export vast-front
run: |
echo "${PWD}/vast/bin/" >> $GITHUB_PATH
- name: Install test suite dependencies
run: |
apt-get update
apt-get install clang
pip3 install lit pandas scipy
- name: Clone test suite repository
uses: actions/checkout@v4
with:
repository: Jezurko/llvm-test-suite
path: llvm-test-suite
fetch-depth: 1

- name: Run test-suite
run: |
mkdir llvm-test-suite/build && cd llvm-test-suite/build/
cmake ../ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=$(readlink -f ../tools/compiler) \
-DCMAKE_CXX_COMPILER=$(readlink -f ../tools/compiler++) \
-C=../cmake/caches/O3.cmake \
-DTEST_SUITE_SUBDIRS=SingleSource \
-DTEST_SUITE_VAST_ENABLE=ON \
-DTEST_SUITE_VAST_TARGET=${{ matrix.vast-target }}
make -j $(nproc) -k
- name: Collect run data (mlir)
if: ${{ matrix.vast-target }} != ''
run: |
cd llvm-test-suite/build
../utils/mlir_compile_json_gen.py >> ../../results.json
- name: Collect run data (bin)
if: ${{ matrix.vast-target }} == ''
run: |
cd llvm-test-suite/build
lit --timeout=60 -v -o ../../results.json
- name: Upload results
uses: actions/upload-artifact@v4
with:
files: results${{ matrix.vast-target }}.json
name: results${{ matrix.vast-target }}

0 comments on commit 0703024

Please sign in to comment.