-
Notifications
You must be signed in to change notification settings - Fork 53
Run integration tests with Miri #161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
h313
wants to merge
9
commits into
main
Choose a base branch
from
miri-integration-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
63bb572
Initial commit
h313 c9f6933
Multithread with script
h313 9b80644
Setup miri before running jobs
h313 511f206
Disable a few super long jobs
h313 2baa169
Only run Miri when a review is submitted since each integration test …
h313 8727f58
Don't multi-process non-integration tests
h313 9acb030
Run Miri daily instead of on PR review
h313 bdd7426
Try enabling libm and long running tests again
h313 719fdfd
Add workflow_dispatch trigger to daily tests
h313 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Parallelizes the integration tests when running with Miri# | ||
| # | ||
| # Usage: .github/scripts/run-tests-with-miri.sh | ||
| # Env: MIRI_TEST_TIMEOUT_SECS (default 300) | ||
| # MIRI_TEST_JOBS (default: nproc) | ||
| # MIRI_TEST_TARGETS (default: all targets, space-separated) | ||
| # MIRIFLAGS (passed to `cargo miri test`) | ||
| set -uo pipefail | ||
|
|
||
| manifest_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" | ||
| cd "$manifest_dir" | ||
|
|
||
| cargo miri setup | ||
|
|
||
| timeout_secs="${MIRI_TEST_TIMEOUT_SECS:-300}" | ||
| jobs="${MIRI_TEST_JOBS:-$(nproc)}" | ||
|
|
||
| target_flag() { | ||
| case "$1" in | ||
| lib) echo "--lib" ;; | ||
| *) echo "--test $1" ;; | ||
| esac | ||
| } | ||
| export -f target_flag | ||
|
|
||
| # shellcheck disable=SC2206 | ||
| targets=(${MIRI_TEST_TARGETS:-lib core_integration regression_integration custom_page_sizes_integration statistics_integration}) | ||
|
|
||
| pairs_file="$(mktemp)" | ||
| results_file="$(mktemp)" | ||
| trap 'rm -f "$pairs_file" "$results_file"' EXIT | ||
|
|
||
| for label in "${targets[@]}"; do | ||
| target="$(target_flag "$label")" | ||
| RUSTFLAGS="--cfg miri" cargo test --quiet $target -- --list 2>/dev/null | | ||
| grep ': test$' | sed 's/: test$//' | | ||
| sed "s/^/${label}\t/" \ | ||
| >>"$pairs_file" | ||
| done | ||
|
|
||
| total=$(wc -l <"$pairs_file") | ||
| echo "Running $total tests:" | ||
| echo "Executors: $jobs" | ||
| echo "Timeout: ${timeout_secs}s" | ||
|
|
||
| export TIMEOUT_SECS="$timeout_secs" | ||
|
|
||
| run_one() { | ||
| local label="$1" name="$2" | ||
| local target | ||
| target="$(target_flag "$label")" | ||
|
|
||
| local out status | ||
| out="$(timeout "$TIMEOUT_SECS" cargo miri test --features miri-soft-floats $target -- --exact "$name" 2>&1)" | ||
| status=$? | ||
|
|
||
| if [ "$status" -eq 0 ]; then | ||
| printf 'PASS\t%s\t%s\n' "$label" "$name" | ||
| elif [ "$status" -eq 124 ]; then | ||
| printf 'TIMEOUT\t%s\t%s\n' "$label" "$name" | ||
| echo "!!! TIMED OUT after ${TIMEOUT_SECS}s: $label :: $name" >&2 | ||
| else | ||
| printf 'FAIL\t%s\t%s\n' "$label" "$name" | ||
| echo "!!! FAILED: $label :: $name" >&2 | ||
| echo "$out" >&2 | ||
| fi | ||
| } | ||
| export -f run_one | ||
|
|
||
| xargs -P "$jobs" -L1 bash -c 'run_one "$@"' _ <"$pairs_file" >>"$results_file" | ||
|
|
||
| pass_count=$(grep -c '^PASS' "$results_file" || true) | ||
| timeout_lines=$(grep '^TIMEOUT' "$results_file" || true) | ||
| fail_lines=$(grep '^FAIL' "$results_file" || true) | ||
|
|
||
| echo | ||
| echo "$total / $pass_count tests passed." | ||
|
|
||
| if [ -n "$timeout_lines" ]; then | ||
| echo "Timed out:" | ||
| echo "$timeout_lines" | awk -F'\t' '{print " - " $2 " :: " $3}' | ||
| fi | ||
| if [ -n "$fail_lines" ]; then | ||
| echo "Failed:" | ||
| echo "$fail_lines" | awk -F'\t' '{print " - " $2 " :: " $3}' | ||
| fi | ||
|
|
||
| if [ -n "$timeout_lines" ] || [ -n "$fail_lines" ]; then | ||
| exit 1 | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| name: PR Review | ||
|
|
||
| on: | ||
| pull_request_review: | ||
| types: [submitted] | ||
|
Kronos3 marked this conversation as resolved.
Outdated
|
||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| RUST_BACKTRACE: 1 | ||
| CARGO_TERM_COLOR: always | ||
|
|
||
| jobs: | ||
| miri-integration: | ||
| name: Miri Integration Tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout PR head | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Install Rust toolchain | ||
| uses: actions-rs/toolchain@v1 | ||
| with: | ||
| profile: minimal | ||
| toolchain: nightly | ||
| override: true | ||
| components: miri | ||
|
|
||
| - name: Install WABT (WebAssembly Binary Toolkit) | ||
| run: | | ||
| WABT_VERSION=1.0.41 | ||
| WABT_PLATFORM="linux-x64" | ||
| wget https://github.com/WebAssembly/wabt/releases/download/${WABT_VERSION}/wabt-${WABT_VERSION}-${WABT_PLATFORM}.tar.gz | ||
| tar -xzf wabt-${WABT_VERSION}-${WABT_PLATFORM}.tar.gz | ||
| sudo cp wabt-${WABT_VERSION}/bin/* /usr/local/bin/ | ||
| shell: bash | ||
|
|
||
| - name: Convert wast files for Miri | ||
| run: cargo test --test miri_wast_convert -- --ignored | ||
|
|
||
| - name: Run Miri | ||
| env: | ||
| MIRIFLAGS: -Zmiri-disable-isolation | ||
| MIRI_TEST_TIMEOUT_SECS: 300 | ||
| MIRI_TEST_JOBS: 4 | ||
| MIRI_TEST_TARGETS: core_integration regression_integration custom_page_sizes_integration statistics_integration | ||
| run: ./.github/scripts/run-tests-with-miri.sh | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| #![cfg(not(miri))] | ||
|
|
||
| mod util; | ||
| use spacewasm::vec; | ||
| use util::{run_wast_test_file, spectest_host_module}; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #![cfg(not(miri))] | ||
|
|
||
| mod util; | ||
|
|
||
| #[test] | ||
| #[ignore] | ||
| fn convert() { | ||
| util::convert_wast_for_miri(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| #![cfg(not(miri))] | ||
|
|
||
| mod util; | ||
| use std::{ops::ControlFlow, sync::Mutex}; | ||
|
|
||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.