From 9ae766db2f6747e343b193514b2fa9fab532cc89 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Mon, 20 May 2019 14:02:35 +0200 Subject: [PATCH] Add convenience batch script for Win --- format-all.bat | 17 +++++++++++++++++ test-all.bat | 46 ++++++++++++++++++++++++++++++++++++++++++++++ test-all.sh | 3 +-- 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 format-all.bat create mode 100644 test-all.bat diff --git a/format-all.bat b/format-all.bat new file mode 100644 index 0000000000..fc5d0e15cd --- /dev/null +++ b/format-all.bat @@ -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% \ No newline at end of file diff --git a/test-all.bat b/test-all.bat new file mode 100644 index 0000000000..97ea8a340f --- /dev/null +++ b/test-all.bat @@ -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 \ No newline at end of file diff --git a/test-all.sh b/test-all.sh index 5f7a1be06a..17ec9526ca 100755 --- a/test-all.sh +++ b/test-all.sh @@ -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.