Skip to content

Commit

Permalink
Update scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ark0f committed Nov 28, 2024
1 parent 4d6d0c0 commit 439f3bd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ jobs:
runs-on: [kuberunner, github-runner-01]
env:
RUSTUP_HOME: /tmp/rustup_home
RUSTFLAGS: "--cfg fuzz"
steps:
- name: Cancel Previous Runs
if: ${{ github.event_name == 'pull_request' }}
Expand Down
4 changes: 2 additions & 2 deletions scripts/src/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ EOF
}

gear_build() {
$CARGO build --workspace "$@" --exclude runtime-fuzzer --exclude runtime-fuzzer-fuzz
$CARGO build --workspace "$@"
}

fuzzer_build() {
$CARGO build "$@" -p runtime-fuzzer -p runtime-fuzzer-fuzz
RUSTFLAGS="--cfg fuzz" $CARGO build "$@" -p runtime-fuzzer -p runtime-fuzzer-fuzz
}

node_build() {
Expand Down
8 changes: 4 additions & 4 deletions scripts/src/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ EOF
}

gear_check() {
echo " >> Check workspace without crates that use runtime with 'fuzz' feature"
__GEAR_WASM_BUILDER_NO_BUILD=1 SKIP_WASM_BUILD=1 SKIP_VARA_RUNTIME_WASM_BUILD=1 cargo check --workspace "$@" --exclude runtime-fuzzer --exclude runtime-fuzzer-fuzz
echo " >> Check workspace"
__GEAR_WASM_BUILDER_NO_BUILD=1 SKIP_WASM_BUILD=1 SKIP_VARA_RUNTIME_WASM_BUILD=1 cargo check --workspace "$@"

echo " >> Check crates that use runtime with 'fuzz' feature"
cargo check "$@" -p runtime-fuzzer -p runtime-fuzzer-fuzz
echo " >> Check crates that use 'cfg(fuzz)"
RUSTFLAGS="--cfg fuzz" cargo check "$@" -p gear-common -p vara-runtime -p runtime-fuzzer -p runtime-fuzzer-fuzz
}

runtime_imports() {
Expand Down
8 changes: 5 additions & 3 deletions scripts/src/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,16 @@ run_fuzzer() {
fi

# Run fuzzer
RUST_LOG="$LOG_TARGETS" cargo fuzz run --release --sanitizer=none main $CORPUS_DIR -- -rss_limit_mb=$RSS_LIMIT_MB -max_len=$MAX_LEN -len_control=0
RUSTFLAGS="--cfg fuzz" RUST_LOG="$LOG_TARGETS" \
cargo fuzz run --release --sanitizer=none main $CORPUS_DIR -- -rss_limit_mb=$RSS_LIMIT_MB -max_len=$MAX_LEN -len_control=0
}

run_lazy_pages_fuzzer() {
. $(dirname "$SELF")/fuzzer_consts.sh

ROOT_DIR="$1"
CORPUS_DIR="$2"
RUSTFLAGS="--cfg fuzz"

# Navigate to lazy pages fuzzer dir
cd $ROOT_DIR/utils/lazy-pages-fuzzer
Expand All @@ -122,7 +124,7 @@ run_lazy_pages_fuzzer() {

run_fuzzer_tests() {
# This includes property tests for runtime-fuzzer.
cargo nextest run -p runtime-fuzzer
RUSTFLAGS="--cfg fuzz" cargo nextest run -p runtime-fuzzer
}

# TODO this is likely to be merged with `pallet_test` or `workspace_test` in #1802
Expand All @@ -134,7 +136,7 @@ doc_test() {
MANIFEST="$1"
shift

__GEAR_WASM_BUILDER_NO_BUILD=1 SKIP_WASM_BUILD=1 SKIP_VARA_RUNTIME_WASM_BUILD=1 $CARGO test --doc --workspace --exclude runtime-fuzzer --exclude runtime-fuzzer-fuzz --manifest-path="$MANIFEST" --no-fail-fast "$@"
__GEAR_WASM_BUILDER_NO_BUILD=1 SKIP_WASM_BUILD=1 SKIP_VARA_RUNTIME_WASM_BUILD=1 $CARGO test --doc --workspace --manifest-path="$MANIFEST" --no-fail-fast "$@"
}

time_consuming_tests() {
Expand Down

0 comments on commit 439f3bd

Please sign in to comment.