-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.bat
More file actions
93 lines (83 loc) · 3.13 KB
/
test.bat
File metadata and controls
93 lines (83 loc) · 3.13 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
86
87
88
89
90
91
92
93
@echo off
REM ============================================================================
REM test.bat - Run salma unit tests using Google Test
REM ============================================================================
REM This script:
REM 1. Configures CMake if needed
REM 2. Builds the test executables
REM 3. Runs all Google Test executables
REM ============================================================================
setlocal
echo ============================================================================
echo SALMA TEST RUNNER
echo ============================================================================
echo.
set "REPO_ROOT=%~dp0"
if "%REPO_ROOT:~-1%"=="\" set "REPO_ROOT=%REPO_ROOT:~0,-1%"
set "BUILD_DIR=%REPO_ROOT%\build"
REM ============================================================================
REM STEP 1: Configure CMake
REM ============================================================================
echo [1/3] Checking CMake configuration...
echo ----------------------------------------------------------------------------
if not exist "%BUILD_DIR%\CMakeCache.txt" (
echo No existing configuration found, running build.bat to configure...
call "%REPO_ROOT%\build.bat"
if errorlevel 1 (
echo ERROR: build.bat failed!
pause
exit /b 1
)
echo.
echo Configuration complete, continuing with tests...
) else (
echo Found existing configuration
)
echo.
REM ============================================================================
REM STEP 2: Build Tests
REM ============================================================================
echo [2/3] Building test executable...
echo ----------------------------------------------------------------------------
cmake --build "%BUILD_DIR%" --config Release --target salma_tests
if errorlevel 1 (
echo ERROR: Build failed!
pause
exit /b 1
)
echo.
REM ============================================================================
REM STEP 3: Run Tests
REM ============================================================================
echo [3/3] Running tests...
echo ----------------------------------------------------------------------------
echo.
set ALL_PASSED=1
echo === salma_tests ===
if exist "%BUILD_DIR%\bin\Release\salma_tests.exe" (
"%BUILD_DIR%\bin\Release\salma_tests.exe" --gtest_color=yes
if errorlevel 1 set ALL_PASSED=0
) else if exist "%BUILD_DIR%\bin\salma_tests.exe" (
"%BUILD_DIR%\bin\salma_tests.exe" --gtest_color=yes
if errorlevel 1 set ALL_PASSED=0
) else (
echo ERROR: salma_tests.exe not found!
set ALL_PASSED=0
)
echo.
REM ============================================================================
REM SUMMARY
REM ============================================================================
echo ============================================================================
if %ALL_PASSED%==1 (
echo ALL TESTS PASSED
) else (
echo SOME TESTS FAILED
)
echo ============================================================================
pause
if %ALL_PASSED%==1 (
exit /b 0
) else (
exit /b 1
)