From 6a1c6ca47277aa6046972e469b6ad577ca882802 Mon Sep 17 00:00:00 2001 From: Anton Baliasnikov Date: Mon, 8 Jul 2024 15:58:33 +0100 Subject: [PATCH] feat: support --target parameter for compiler tester --- .github/actions/build-llvm/action.yml | 7 ++++++- .github/workflows/benchmarks.yml | 14 ++++++++++++-- .github/workflows/integration-tests.yaml | 17 ++++++++++++++--- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/.github/actions/build-llvm/action.yml b/.github/actions/build-llvm/action.yml index afd2448..e205d8f 100644 --- a/.github/actions/build-llvm/action.yml +++ b/.github/actions/build-llvm/action.yml @@ -16,6 +16,10 @@ inputs: description: "Enable assertions." required: false default: 'true' + sanitizer: + description: 'A sanitizer to build LLVM with. Possible values are Address, Memory, MemoryWithOrigins, Undefined, Thread, DataFlow, and Address;Undefined' + required: false + default: '' extra-args: description: 'Extra CMake arguments to compile LLVM.' required: false @@ -132,5 +136,6 @@ runs: [ "${{ inputs.enable-tests }}" = "true" ] && ENABLE_TESTS="--enable-tests" [ "${{ inputs.enable-assertions }}" = "true" ] && ENABLE_ASSERTIONS="--enable-assertions" [ "${{ inputs.extra-args }}" != "" ] && EXTRA_ARGS="--extra-args ${{ inputs.extra-args }}" + [ "${{ inputs.sanitizer }}" != "" ] && SANITIZER="--sanitizer ${{ inputs.sanitizer }}" zksync-llvm build --target-env ${{ inputs.target-env }} \ - --use-ccache ${{ inputs.builder-extra-args }} ${DEBUG_ARG} ${ENABLE_TESTS} ${ENABLE_ASSERTIONS} ${EXTRA_ARGS} + --use-ccache ${{ inputs.builder-extra-args }} ${DEBUG_ARG} ${ENABLE_TESTS} ${ENABLE_ASSERTIONS} ${SANITIZER} ${EXTRA_ARGS} diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index ec57fa4..a8971e7 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -63,14 +63,20 @@ on: required: false default: '' description: 'custom solc version to use for benchmarks' + target-machine: + type: string + required: false + default: '' + description: 'Target machine passed via `--target` for era-compiler-tester. Available arguments: `EraVM`, `EVM`, `EVMInterpreter`. Use `default` or `` to skip `--target` parameter.' jobs: + benchmarks: strategy: fail-fast: false matrix: type: ["reference", "candidate"] - name: ${{ matrix.type }} + name: ${{ inputs.target-machine}} ${{ matrix.type }} runs-on: matterlabs-ci-runner container: image: matterlabs/llvm_runner:ubuntu22-llvm17-latest @@ -146,8 +152,12 @@ jobs: echo $(./solc-bin/solc-${{ inputs.custom-solc-version}} --version) - name: Run benchmarks + shell: bash -ex {0} run: | - ./target/release/compiler-tester \ + if [[ -n "${{ inputs.target-machine }}" && "${{ inputs.target-machine }}" != "default" ]]; then + TARGET="--target ${{ inputs.target-machine }}" + fi + echo ./target/release/compiler-tester ${TARGET} \ --zksolc './target-zksolc/release/zksolc' \ --zkvyper './target-zkvyper/release/zkvyper' \ --path=${{ inputs.compiler_llvm_benchmark_path || '' }} \ diff --git a/.github/workflows/integration-tests.yaml b/.github/workflows/integration-tests.yaml index 45e084c..e912094 100644 --- a/.github/workflows/integration-tests.yaml +++ b/.github/workflows/integration-tests.yaml @@ -16,6 +16,11 @@ on: required: false default: '' description: 'Path filter for integration tests execution. For example: `tests/solidity/`.' + target-machine: + type: string + required: false + default: '' + description: 'Target machine passed via `--target` for era-compiler-tester. Available arguments: `EraVM`, `EVM`, `EVMInterpreter`. Use `default` or `` to skip `--target` parameter.' extra-args: type: string required: false @@ -53,12 +58,14 @@ on: description: 'Compiler LLVM repository to use. Required for forks testing.' jobs: - run-integration-tests: + + integration-tests: runs-on: ci-runner-compiler timeout-minutes: 720 container: image: matterlabs/llvm_runner:ubuntu22-llvm17-latest options: -m 110g + name: Integration Tests ${{ inputs.target-machine || 'default' }} steps: - name: Checkout compiler-tester @@ -122,9 +129,12 @@ jobs: echo $(./solc-bin/solc-${{ inputs.custom-solc-version}} --version) - name: Run integration tests + shell: bash -ex {0} run: | - set -x - ./target/release/compiler-tester \ + if [[ -n "${{ inputs.target-machine }}" && "${{ inputs.target-machine }}" != "default" ]]; then + TARGET="--target ${{ inputs.target-machine }}" + fi + echo ./target/release/compiler-tester ${TARGET} \ --zksolc './target-zksolc/release/zksolc' \ --zkvyper './target-zkvyper/release/zkvyper' \ --path '${{ inputs.path }}' ${{ inputs.extra-args }} @@ -133,6 +143,7 @@ jobs: uses: 8398a7/action-slack@v3 if: (failure() || success()) && (github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork) with: + job_name: Integration Tests ${{ inputs.target-machine || 'default' }} status: ${{ job.status }} fields: repo,commit,author,action,eventName,ref,workflow,job,took,pullRequest env: