Skip to content

Commit

Permalink
ci: test
Browse files Browse the repository at this point in the history
  • Loading branch information
antonbaliasnikov committed Apr 2, 2024
1 parent 51fc815 commit 2baf2fe
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 2 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ jobs:
files: test-results-*.xml
action_fail_on_inconclusive: true

# TODO: separate install and execution and add retry if install fails (!)
- name: Building and running the compiler tester
id: compiler_tester_run
env:
Expand Down
File renamed without changes.
File renamed without changes.
181 changes: 181 additions & 0 deletions .github/workflows/regression-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
name: "Regression tests"

on:
pull_request:
branches:
- main

jobs:
prepare-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.prepare.outputs.matrix }}
steps:
# Special setup for PRs to extract all commits in PR
# with the maximum checkout speed
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: ${{ github.event.pull_request.commits }}
- name: Prepare commits
id: prepare
run: |
git fetch --depth=1 origin +refs/heads/${{github.base_ref}}:refs/remotes/origin/${{github.base_ref}}
COMMITS_TO_TEST=$(git rev-list origin/${{ github.base_ref }}..${{ github.head_ref }} --pretty='"%H"' --no-commit-header)
echo "matrix={ \"commit\": [${COMMITS_TO_TEST//$'\n'/, }] }" | tee -a ${GITHUB_OUTPUT}
regression-tests:
runs-on: [ self-hosted, ci-runner-compiler ]
container:
image: matterlabs/llvm_runner:ubuntu22-llvm15-latest
options: -m 110g
needs: prepare-matrix
strategy:
matrix: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ matrix.commit }}
fetch-depth: ${{ github.event.pull_request.commits }}
path: "llvm"

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v39
with:
separator: ","
skip_initial_fetch: true

- name: Build LLVM
uses: ./llvm/.github/actions/build
with:
extra-args: "\\-DLLVM_ENABLE_WERROR=On \\-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
enable-tests: true

# Test change
- name: Checking with clang-tidy-diff.py
working-directory: llvm
shell: bash
run: |
set -euxo pipefail
git fetch --depth=1 origin +refs/heads/${{github.base_ref}}:refs/remotes/origin/${{github.base_ref}}
git diff -U0 origin/${{github.base_ref}}
git diff -U0 origin/${{github.base_ref}} \
| ./clang-tools-extra/clang-tidy/tool/clang-tidy-diff_Zegar.py \
-p1 -clang-tidy-binary $(which clang-tidy) \
-path ../target-llvm/build-final/compile_commands.json
- name: "Listed files"
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
echo "Formatting files:"
echo "$CHANGED_FILES"
- name: Install clang-format
uses: aminya/setup-cpp@v1
with:
clangformat: 17.0.1

- name: Install python dependencies
working-directory: llvm
run: |
apt update && apt install -y python3-pip
pip install -r llvm/utils/git/requirements_formatting_era_llvm.txt
- name: Run code formatter
working-directory: llvm
env:
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
START_REV: ${{ github.event.pull_request.base.sha }}
END_REV: ${{ github.event.pull_request.head.sha }}
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
python3 ./llvm/utils/git/code-format-helper-era-llvm.py \
--token ${{ secrets.GITHUB_TOKEN }} \
--issue-number $GITHUB_PR_NUMBER \
--start-rev $(git merge-base $START_REV $END_REV) \
--end-rev $END_REV \
--changed-files "$CHANGED_FILES"
# - name: Running Lit tests with default options
# run: |
# BINDIR=$(target-llvm/build-final/bin/llvm-config --bindir)
# ${BINDIR}/llvm-lit -vv -s './target-llvm/build-final/test' --xunit-xml-output test-results-default.xml

# - name: Running Lit EraVM tests with llc verification options
# env:
# LLC_OPTS:
# "--cgp-verify-bfi-updates \
# --compile-twice \
# --earlycse-debug-hash \
# --loop-distribute-verify \
# --machine-combiner-verify-pattern-order \
# --phicse-debug-hash \
# --reassociate-geps-verify-no-dead-code \
# --safepoint-ir-verifier-print-only \
# --scev-verify-ir \
# --tail-dup-verify \
# --unroll-verify-domtree \
# --verify-regalloc \
# --vplan-verify-hcfg \
# --march=eravm"
# XFAILS:
# "CodeGen/EraVM/memcpy-expansion.ll;\
# CodeGen/EraVM/flag-setting-set-implicit-flags.ll;\
# CodeGen/EraVM/indexed-ld-in-a-loop-bug.ll;\
# CodeGen/EraVM/machine-outliner.mir;\
# CodeGen/EraVM/machine-outliner-tail.mir;\
# CodeGen/EraVM/select_fold.mir;\
# CodeGen/EraVM/select_tie.mir;\
# CodeGen/EraVM/select-zero-bitrot.mir;\
# CodeGen/EraVM/select-zero-flags.mir;\
# CodeGen/EraVM/hoist-flag-setting.mir;\
# CodeGen/EraVM/fold-similar-instructions.mir"

# run: |
# BINDIR=$(target-llvm/build-final/bin/llvm-config --bindir)
# ${BINDIR}/llvm-lit -vv -s --xfail "${XFAILS}" "-Dllc=${BINDIR}/llc ${LLC_OPTS}" './llvm/llvm/test/CodeGen/EraVM/' \
# --xunit-xml-output test-results-llc.xml

# - name: Running Lit tests with opt verification options
# env:
# OPT_OPTS:
# "--cgp-verify-bfi-updates \
# --earlycse-debug-hash \
# --loop-distribute-verify \
# --machine-combiner-verify-pattern-order \
# --phicse-debug-hash \
# --scev-verify-ir \
# --tail-dup-verify \
# --unroll-verify-domtree \
# --verify-assumption-cache \
# --verify-cfg-preserved \
# --verify-cfiinstrs \
# --verify-coalescing \
# --verify-dom-info \
# --verify-loop-info \
# --verify-loop-lcssa \
# --verify-machine-dom-info \
# --verify-machineinstrs \
# --verify-memoryssa \
# --verify-misched \
# --verify-regalloc \
# --verify-scev-strict \
# --vplan-verify-hcfg \
# --march=eravm"
# XFAILS:
# "Transforms/LoopVectorize/vplan_hcfg_stress_test.ll;\
# Transforms/LoopFlatten/widen-iv2.ll;\
# Transforms/LoopFusion/simple.ll"
# run: |
# BINDIR=$(target-llvm/build-final/bin/llvm-config --bindir)
# ${BINDIR}/llvm-lit -vv -s --xfail "${XFAILS}" "-Dopt=${BINDIR}/opt ${OPT_OPTS}" './llvm/llvm/test/CodeGen/' \
# --xunit-xml-output test-results-opt.xml

# - name: Upload results
# uses: EnricoMi/[email protected]
# with:
# check_name: Lit Tests Results ${{ matrix.commit }}
# files: test-results-*.xml
# action_fail_on_inconclusive: true
4 changes: 2 additions & 2 deletions llvm/lib/Bitcode/Writer/BitWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ using namespace llvm;

/*===-- Operations on modules ---------------------------------------------===*/

int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *Path) {
int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *pa_PATH) {
std::error_code EC;
raw_fd_ostream OS(Path, EC, sys::fs::OF_None);
raw_fd_ostream OS(pa_PATH, EC, sys::fs::OF_None);

if (EC)
return -1;
Expand Down

0 comments on commit 2baf2fe

Please sign in to comment.