-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtest.bat
More file actions
85 lines (70 loc) · 1.89 KB
/
Copy pathtest.bat
File metadata and controls
85 lines (70 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
@echo off
setlocal enabledelayedexpansion
set "ROOTDIR=%~dp0"
if "%ROOTDIR:~-1%"=="\" set "ROOTDIR=%ROOTDIR:~0,-1%"
set "BLITZPATH=%ROOTDIR%\compiler\BlitzForge"
set "TESTDIR="
if exist "%ROOTDIR%\src\Tests" (
set "TESTDIR=%ROOTDIR%\src\Tests"
) else if exist "%ROOTDIR%\src\tests" (
set "TESTDIR=%ROOTDIR%\src\tests"
)
if not exist "%BLITZPATH%\bin\blitzcc.exe" (
echo "%BLITZPATH%\bin\blitzcc.exe not found!"
echo "Compile source or download binaries from https://github.com/RydeTec/blitz-forge/releases"
exit /b 1
)
if not defined TESTDIR (
echo "Test directory not found. Expected src\Tests or src\tests."
exit /b 1
)
REM Optional positional arg = substring filter on the test file basename.
REM e.g. `test.bat ItemsTest` runs only files matching *ItemsTest*.bb.
REM Useful for reproducing the documented intermittent ItemsTest flake
REM locally without re-running the whole suite.
set "FILTER=%~1"
if defined FILTER (
set "GLOB=*!FILTER!*.bb"
echo Filter: only files matching !GLOB!
) else (
set "GLOB=*.bb"
)
cd /d "%TESTDIR%"
set /a TOTAL=0
set /a PASSED=0
set /a FAILED=0
set "FAILED_FILES="
for /R %%f in (!GLOB!) do (
set /a TOTAL+=1
echo [RUN ] %%~nxf
"%BLITZPATH%\bin\blitzcc.exe" -t -w "%ROOTDIR%\src" "%%f"
if !errorlevel! equ 0 (
echo [PASS] %%~nxf
set /a PASSED+=1
) else (
echo [FAIL] %%~nxf
set /a FAILED+=1
set "FAILED_FILES=!FAILED_FILES! %%~nxf"
)
)
cd /d "%ROOTDIR%"
if !TOTAL! equ 0 (
if defined FILTER (
echo No test files matched filter "!FILTER!"
) else (
echo No test files found in "%TESTDIR%"
)
endlocal
exit /b 1
)
echo.
echo Ran !TOTAL! files: !PASSED! passed, !FAILED! failed.
if !FAILED! gtr 0 (
echo Failed files:
for %%x in (!FAILED_FILES!) do echo - %%x
echo "Tests failed"
endlocal
exit /b 1
)
echo "Tests passed"
endlocal