Skip to content

Commit

Permalink
EqBench: Enable to run analysis in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
PLukas2018 committed Oct 22, 2023
1 parent 04f8001 commit 28f2bd1
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Analysis of DiffKemp equivalence checking

on: [push, workflow_dispatch]

jobs:
EqBench:
runs-on: ubuntu-latest
# todo refactor with ci.yaml - maybe creating action for building diffkemp
env:
llvm: 16
CC: gcc-9
CXX: g++-9
asan: OFF
steps:
- uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install Dependencies
working-directory: ${{ github.workspace }}
shell: bash
run: |
sudo apt-get install bc cscope libelf-dev ninja-build
pip install -r requirements.txt
- name: Install LLVM
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-${llvm} main"
sudo apt-get update
sudo apt-get install llvm-${llvm} llvm-${llvm}-dev clang-${llvm}
sudo ln -s /usr/lib/llvm-${llvm} /usr/local/lib/llvm
echo "/usr/lib/llvm-${llvm}/bin" >> $GITHUB_PATH
- name: Prepare Build Environment
run: |
mkdir -p ${{ github.workspace }}/build
- name: CMake
working-directory: ${{ github.workspace }}/build
shell: bash
run: cmake $GITHUB_WORKSPACE -GNinja -DSANITIZE_ADDRESS=${{ env.asan }} -DVENDOR_GTEST=On

- name: Build
working-directory: ${{ github.workspace }}/build
run: ninja

- name: Install
working-directory: ${{ github.workspace }}
run: pip3 install -e .

- name: Run analysis
working-directory: ${{ github.workspace }}
run: |
git clone https://github.com/shrBadihi/EqBench.git
tools/eqbench-analysis.py -o eqbench-results/default-01-disabled-patterns/ --add-clang-options "-O1 " --disable-patterns
tools/eqbench-analysis.py -o eqbench-results/default-01-default-patterns/ --add-clang-options "-O1 "
tools/eqbench-analysis.py -o eqbench-results/default-02-disabled-patterns/ --add-clang-options "-O2 " --disable-patterns
tools/eqbench-analysis.py -o eqbench-results/default-02-default-patterns/ --add-clang-options "-O2 "
tools/eqbench-analysis.py --build-kernel-opt-llvm -o eqbench-results/opt-01-disabled-patterns/ --add-clang-options "-O1 " --disable-patterns
tools/eqbench-analysis.py --build-kernel-opt-llvm -o eqbench-results/opt-01-default-patterns/ --add-clang-options "-O1 "
tools/eqbench-analysis.py --build-kernel-opt-llvm -o eqbench-results/opt-02-disabled-patterns/ --add-clang-options "-O2 " --disable-patterns
tools/eqbench-analysis.py --build-kernel-opt-llvm -o eqbench-results/opt-02-default-patterns/ --add-clang-options "-O2 "
6 changes: 6 additions & 0 deletions tools/eqbench-analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
from pathlib import Path
from progressbar import ProgressBar
import json
import os
import re
import shutil
import subprocess
Expand Down Expand Up @@ -345,6 +346,11 @@ def report(self):
headers=header, tablefmt="pipe")
print(report)

# Printing result summary if runs by github workflow
github_step_summary = os.getenv("GITHUB_STEP_SUMMARY")
if github_step_summary:
with open(github_step_summary, "a") as file:
print(report, file=file)
# Saving summarisation of results to file
report += f"\n\n(only-compare: {self.only_compare})\n"
with open(Path(self.output_dir, "result.md"), "w") as file:
Expand Down

0 comments on commit 28f2bd1

Please sign in to comment.