Skip to content

Sanitizers tests

Sanitizers tests #28

Workflow file for this run

name: Sanitizers tests
on:
workflow_dispatch:
inputs:
llvm-branch:
description: 'Custom LLVM branch to use. If not specified, the branch from `LLVM.lock` file is used.'
required: false
default: ''
type: string
# For more information about the supported sanitizers in Rust, see:
# https://rustc-dev-guide.rust-lang.org/sanitizers.html
rust-sanitizer:
required: false
default: 'address'
type: string
description: 'A sanitizer to build Rust code with. Possible values are: address, cfi, hwaddress, kcfi, leak, memory or thread'
# For more information about the supported sanitizers in LLVM, see `LLVM_USE_SANITIZER` option in:
# https://www.llvm.org/docs/CMake.html
llvm-sanitizer:
required: false
default: 'Address'
type: string
description: 'A sanitizer to build LLVM with. Possible values are Address, Memory, MemoryWithOrigins, Undefined, Thread, DataFlow, and Address;Undefined'
path:
required: false
type: string
default: 'tests/solidity'
description: 'Path filter of the era-compiler-tester. For example: tests/solidity/simple'
mode:
required: false
type: string
default: 'Y+M3B3 0.8.26'
description: 'Mode filter for the era-compiler-tester. For example: Y+M3B3 0.8.26'
target:
required: false
type: string
default: 'eravm'
description: 'Target filter for the era-compiler-tester. Possible values are: `eravm` or `evm`'
jobs:
run-with-sanitizers:
timeout-minutes: 720
runs-on: matterlabs-ci-runner-high-performance
container:
image: ghcr.io/matter-labs/zksync-llvm-runner:latest
options: -m 110g
env:
TARGET: x86_64-unknown-linux-gnu
RUSTC_BOOTSTRAP: 1
steps:
- name: Checkout compiler-tester
uses: actions/checkout@v4
with:
submodules: recursive
- name: Checkout llvm
if: inputs.llvm-branch != ''
uses: actions/checkout@v4
with:
repository: matter-labs/era-compiler-llvm
ref: ${{ inputs.llvm-branch }}
path: llvm
- name: Build LLVM
uses: matter-labs/era-compiler-ci/.github/actions/build-llvm@v1
with:
clone-llvm: ${{ inputs.llvm-branch == '' }}
sanitizer: ${{ inputs.llvm-sanitizer }}
enable-assertions: true
- name: Build compiler-tester
env:
RUSTFLAGS: "-Z sanitizer=${{ inputs.rust-sanitizer }}"
run: |
rustup component add rust-src --toolchain "$(rustc --version | cut -d ' ' -f2)-${TARGET}"
cargo build --target ${TARGET} -Zbuild-std --bin 'compiler-tester'
- name: Build zksolc and zkvyper
env:
CARGO_CHECKOUT_DIR: /usr/local/cargo/git/checkouts
RUSTFLAGS: "-Z sanitizer=${{ inputs.rust-sanitizer }}"
run: |
cargo build --target ${TARGET} -Zbuild-std \
--manifest-path ${CARGO_CHECKOUT_DIR}/era-compiler-solidity-*/*/Cargo.toml \
--target-dir './target-zksolc/'
cargo build --target ${TARGET} -Zbuild-std \
--manifest-path ${CARGO_CHECKOUT_DIR}/era-compiler-vyper-*/*/Cargo.toml \
--target-dir './target-zkvyper/'
- name: Run tests with sanitizers
run: |
set -x
./target/${TARGET}/debug/compiler-tester \
--target "${{ inputs.target }}" \
--zksolc "./target-zksolc/${TARGET}/debug/zksolc" \
--zkvyper "./target-zkvyper/${TARGET}/debug/zkvyper" \
--path '${{ inputs.path }}' \
--mode '${{ inputs.mode }}'