Skip to content

Sanitizers tests

Sanitizers tests #14

Workflow file for this run

name: Sanitizers tests
on:
workflow_dispatch:
inputs:
# 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'
jobs:
run-with-sanitizers:
runs-on: [ci-runner-compiler, Linux]
container:
image: ghcr.io/matter-labs/llvm_runner/ubuntu22-llvm17:latest
options: -m 110g
env:
TARGET: x86_64-unknown-linux-gnu
ASAN_OPTIONS: "halt_on_error=0"
RUSTC_BOOTSTRAP: 1
steps:
- name: Checkout compiler-tester
uses: actions/checkout@v4
with:
submodules: recursive
- name: Build LLVM
uses: matter-labs/era-compiler-ci/.github/actions/build-llvm@v1
with:
sanitizer: ${{ inputs.llvm-sanitizer }}
enable-assertions: true
- name: Build compiler-tester
env:
RUSTFLAGS: "-Z sanitizer=${{ inputs.rust-sanitizer }}"
run: |
rustup install nightly-${TARGET}
rustup component add rust-src --toolchain nightly-${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}/release/compiler-tester \
--zksolc "./target-zksolc/${TARGET}/debug/zksolc" \
--zkvyper "./target-zkvyper/${TARGET}/release/zkvyper" \
--path '${{ inputs.path }}'
--mode '${{ inputs.mode }}'