-
Notifications
You must be signed in to change notification settings - Fork 7
/
ysi_test.bat
163 lines (142 loc) · 3.62 KB
/
ysi_test.bat
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
@echo off
setlocal enableextensions enabledelayedexpansion
set MODE=YSI_TEST
set TARGET=
set COMPILER=
echo.
echo *******************************************************
echo *******************************************************
echo *******************************************************
echo *** ***
echo *** Run as admin (for directory link creations) ***
echo *** ***
echo *******************************************************
echo *******************************************************
echo *******************************************************
:get_args
if "%~1"=="" goto :args_got
if /I "%~1"=="-m" set MODE=%~2& shift
if /I "%~1"=="--mode" set MODE=%~2& shift
if /I "%~1"=="-f" set TARGET=%~2& shift
if /I "%~1"=="--flags" set TARGET=%~2& shift
if /I "%~1"=="-h" goto :show_help
if /I "%~1"=="--help" goto :show_help
shift
goto :get_args
:show_help
echo.
echo Usage: TEST_ADD [flags]
echo.
echo Optional flags:
echo --mode=mode_name : The name of the mode to compile. Defaults to YSI_TEST.
echo -m : Synonym for "--mode".
echo --help : Show this help.
echo -h : Synonym for "--help".
echo --flags=flags : The flags to use for this build.
echo -f : Synonym for "--flags"
echo.
goto :eof
:args_got
echo.
mkdir .\logs 2> nul > nul
call :main
goto :eof
:main
rem Old compiler
echo.
echo ************************
echo ************************
echo ************************
echo *** ***
echo *** OLD COMPILER ***
echo *** ***
echo ************************
echo ************************
echo ************************
echo.
call :switch_old
call :do_builds
rem New compiler
echo ************************
echo ************************
echo ************************
echo *** ***
echo *** NEW COMPILER ***
echo *** ***
echo ************************
echo ************************
echo ************************
echo.
call :switch_new
call :do_builds
goto :eof
:do_builds
if "%TARGET%"=="" (
call :all_builds
) else (
call :spawn "_%COMPILER%" "%TARGET%"
call :wait "_%COMPILER%"
)
goto :eof
:all_builds
for /L %%g in (0, 1, 3) do (
for /L %%m in (0, 1, 3) do (
rem Spawn the processes.
for /L %%o in (0, 1, 1) do (
for /L %%d in (0, 1, 2) do (
set /a port=7770 + %%o * 10 + %%d
call :spawn "_%%g%%m%%o%%d_%COMPILER%" "GTYPE=%%g MTYPE=%%m -O%%o -d%%d" "!port!" "%COMPILER%"
)
)
rem Wait for all others to complete.
for /L %%o in (0, 1, 1) do (
for /L %%d in (0, 1, 2) do (
call :wait "_%%g%%m%%o%%d_%COMPILER%" "GTYPE=%%g MTYPE=%%m -O%%o -d%%d"
)
)
)
)
rem Print the results.
for /L %%g in (0, 1, 3) do (
for /L %%m in (0, 1, 3) do (
for /L %%o in (0, 1, 1) do (
for /L %%d in (0, 1, 2) do (
call :print "_%%g%%m%%o%%d_%COMPILER%" "GTYPE=%%g MTYPE=%%m -O%%o -d%%d"
)
)
)
)
goto :eof
:spawn
echo.
echo *** Running: %MODE%%~1.amx %~2
start "YSI test: %~2, %~4 compiler" cmd /c _spawn_one_test.bat %MODE% %1 %2 %3
goto :eof
:wait
:wait_loop
rem Poor man's sleep 1.
call :sleep_1s
if not exist logs\%MODE%%~1.server.txt (
goto wait_loop
)
goto :eof
:print
echo.
echo *** Checking: %~1
findstr /L "Fails: " logs\%MODE%%~1.server.txt
goto :eof
:switch_new
cd qawno/
call compiler_switch.bat "new"
cd ..
set COMPILER=new
goto :eof
:switch_old
cd qawno/
call compiler_switch.bat "old"
cd ..
set COMPILER=old
goto :eof
:sleep_1s
ping -n 2 -i 1 8.8.8.8 > nul
goto :eof