Add convenience batch script for Win

This commit is contained in:
Jakub Konka
2019-05-20 14:02:35 +02:00
committed by Dan Gohman
parent c3ff3cf075
commit 9ae766db2f
3 changed files with 64 additions and 2 deletions

17
format-all.bat Normal file
View File

@@ -0,0 +1,17 @@
@echo off
setlocal
@rem Format all sources using rustfmt.
@rem This script is an adaption of the shell version
@rem 'format-all.sh'.
for /F "delims=" %%i in ("%%~f0") do set dirname=%%~dpi
cd %dirname%
@REM Make sure we can find rustfmt
set PATH=%PATH%;%USERPROFILE%\.cargo\bin
cmd /C cargo +stable fmt --all -- %*
endlocal
exit /b %ERRORLEVEL%

46
test-all.bat Normal file
View File

@@ -0,0 +1,46 @@
@echo off
setlocal
@rem This is the top-level test script.
@rem It is an adaption of the shell script "test-all.sh".
@rem - Check code formatting.
@rem - Make a debug build.
@rem - Make a release build.
@rem - Run unit tests for all Rust crates
@rem - Build API documentation.
@rem All tests run by this script should be passing at all times.
for /F "delims=" %%i in ("%%~f0") do set dirname=%%~dpi
cd %dirname%
call :banner Rust formatting
cmd /c "%dirname%format-all.bat --check"
if %errorlevel% neq 0 (
echo Formatting diffs detected! Run "cargo fmt --all" to correct.
goto error
)
call :banner Release build
cmd /c cargo build --release || goto error
call :banner Debug build
cmd /c cargo build || goto error
call :banner Rust unit tests
set RUST_BACKTRACE=1
cmd /c cargo test --all || goto error
call :banner Rust documentation: %dirname%target\doc\wasi-common\index.html
cmd /c cargo doc || goto error
call :banner OK
endlocal
exit /b %ERRORLEVEL%
:banner
echo ===== %* =====
exit /b 0
:error
exit /b 1

View File

@@ -6,9 +6,8 @@ set -euo pipefail
# - Check code formatting.
# - Make a debug build.
# - Make a release build.
# - Run unit tests for all Rust crates (including the filetests)
# - Run unit tests for all Rust crates
# - Build API documentation.
# - Optionally, run fuzzing.
#
# All tests run by this script should be passing at all times.