-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add auto_rerun_test script for windows
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,31 @@ | ||
$STARCOIN_DIR = (get-item $PSScriptRoot).parent.FullName | ||
$TEST_RESULT_FILE="$STARCOIN_DIR/target/debug/test_result.txt" | ||
$TEST_RESULT_FAILED_FILE="$STARCOIN_DIR/target/debug/test_result_failed.txt" | ||
Write-Host "Starcoin root dir: $STARCOIN_DIR" | ||
|
||
$env:RUSTFLAGS="-Ccodegen-units=1 -Copt-level=0" | ||
$env:RUSTC_BOOTSTRAP=1 | ||
$env:RUST_MIN_STACK=8*1024*1024 | ||
$env:RUST_LOG="OFF" | ||
$env:RUST_BACKTRACE=0 | ||
cargo xtest --exclude starcoin-move-prover -j 15 -- --test-threads=10 --color never --format pretty | Tee-Object "$TEST_RESULT_FILE" | ||
|
||
$failed_tests=Select-String -Pattern 'test .* \.\.\. FAILED' -Path "./target/debug/test_result.txt" -AllMatche | ||
Write-Host "All failed tests are redirected to file: $TEST_RESULT_FAILED_FILE" -ForegroundColor Green | ||
$failed_tests > "$TEST_RESULT_FAILED_FILE" | ||
|
||
Write-Host "Retring failed test cases" -ForegroundColor Green | ||
$env:RUST_LOG="DEBUG" | ||
$env:RUST_BACKTRACE="FULL" | ||
$case_status=0 | ||
$failed_tests | ForEach-Object { | ||
$test=$_ -split ' ' | ||
$test=$test[1] | ||
Write-Host "Rerunning test failed case: $test" -ForegroundColor Red | ||
cargo xtest -j 15 "$test" -- --test-threads=1 --nocapture | ||
if ($LASTEXITCODE -ne 0) { | ||
$case_status=$LASTEXITCODE | ||
Write-Host "Test case $test failed with $case_status" -ForegroundColor Red | ||
} | ||
} | ||
exit $case_status |