32
|
1 |
::---------------------------------------------------------------------------
|
|
2 |
:: Helper for FlexTimer building and testing
|
|
3 |
::
|
|
4 |
:: Commands:
|
|
5 |
::
|
|
6 |
:: BUILD_ALL Build component to all targets
|
|
7 |
:: BUILD_ERROR Inform user about failed build
|
|
8 |
:: BUILD_OK Inform user about passed build
|
|
9 |
:: BUILD_TRACES Build OST traces to targets WINSCW_UDEB and ARMV5_UDEB
|
|
10 |
:: CHECK_EPOCROOT Check that epocroot is set correctly
|
|
11 |
:: CLEAN_NOLOGS Reallyclean component, no output to screen
|
|
12 |
:: DEL_CTC_REPORTS Delete old CTC reports
|
|
13 |
:: GEN_CMT_REPORTS Generate CMT reports
|
|
14 |
:: GEN_COV_REPORTS Generate and deliver Coveruty Prevent reports
|
|
15 |
:: GEN_CS_REPORTS Genrete CodeScanner reports
|
|
16 |
:: GEN_CTC_REPORTS Generate CTC reports
|
|
17 |
:: GEN_IMAGE Make flash images
|
|
18 |
:: GEN_SYMBOLS Generate symbol files
|
|
19 |
:: INSTRUMENT_CTC Instrument CTC++ to component's WINSCW_UDEB target
|
|
20 |
:: RUN_TESTS Compile test component, run test application and check
|
|
21 |
:: test results
|
|
22 |
:: SCHEDULER Execute commands from QUEUE
|
|
23 |
:: SHOW_HELP Show help of the script
|
|
24 |
:: START_UP Enable delayed environment expansion
|
|
25 |
:: TEST_FAILED Inform user about failed tests
|
|
26 |
:: THE_END Stop execution of the script
|
|
27 |
::
|
|
28 |
::---------------------------------------------------------------------------
|
|
29 |
:: Change history:
|
|
30 |
::
|
|
31 |
:: 1.0 01-Apr-2010 First version in SVN
|
|
32 |
::
|
|
33 |
::---------------------------------------------------------------------------
|
|
34 |
|
|
35 |
@echo off
|
|
36 |
setlocal
|
|
37 |
|
|
38 |
set VERSION=1.0 [01/04/2010 15:08:42]
|
|
39 |
|
|
40 |
:: The source path is one dir up from the BAT's location
|
|
41 |
for /f %%i in ("%0") do set SOURCE_PATH=%%~dpi..
|
|
42 |
|
|
43 |
set MAKE_PATH=%SOURCE_PATH%\group\bld.inf
|
|
44 |
set TEST_MAKE_PATH=%SOURCE_PATH%\test\testflextimer\group\bld.inf
|
|
45 |
|
|
46 |
:: Commands for the component
|
|
47 |
set CMD_BUILD_ALL=sbs -b %MAKE_PATH%
|
|
48 |
set CMD_BUILD_CLEAN=sbs -b %MAKE_PATH% reallyclean
|
|
49 |
set CMD_BUILD_TRACE=sbs -b %MAKE_PATH% -c winscw_udeb.tracecompiler -c armv5_udeb.tracecompiler
|
|
50 |
|
|
51 |
:: Commands for test component
|
|
52 |
set CMD_TEST_BUILD=sbs -b %TEST_MAKE_PATH% -c winscw_udeb -c armv5
|
|
53 |
set CMD_TEST_RUN=start /wait %EPOCROOT%epoc32\release\winscw\udeb\atsinterface.exe -dtextshell -- -testmodule testflextimer
|
|
54 |
|
|
55 |
:: Commands and settings for CTC++
|
|
56 |
set CTC_OUTFILE=MON
|
|
57 |
set CTC_OUTPATH=.
|
|
58 |
set CMD_CTC_BUILD=ctcwrap -i m -v -2comp sbs.bat -b %MAKE_PATH% -c winscw_udeb
|
|
59 |
set CMD_CTC_CLEAN=sbs -b %MAKE_PATH% -c winscw_udeb reallyclean
|
|
60 |
set CMD_CTC_GEN=ctcpost %CTC_OUTPATH%\%CTC_OUTFILE%.sym %CTC_OUTPATH%\%CTC_OUTFILE%.dat ^| ctc2html
|
|
61 |
|
|
62 |
:: Command for CMT
|
|
63 |
set CMD_CMT_GEN=dir /s /b %SOURCE_PATH%\*.cpp %SOURCE_PATH%\*.inl ^| findstr /I /V "\\test\\" ^| cmt ^| cmt2html
|
|
64 |
|
|
65 |
:: Commands and settings for Coverity Prevent
|
|
66 |
set COV_OUTPATH=coverity
|
|
67 |
set CMD_COV_BUILD=cov-build --dir %COV_OUTPATH% sbs -b %MAKE_PATH%
|
|
68 |
set CMD_COV_ANALYZE=cov-analyze --dir %COV_OUTPATH% --all --symbian
|
|
69 |
set CMD_COV_DELIVER=cov-commit-defects --dir %COV_OUTPATH% --remote trwsim47 --user cadsw --password cov3rity --product flextimer --cva
|
|
70 |
set CMD_COV_SHOW_RESULTS=start http://trwsim47:5467
|
|
71 |
|
|
72 |
:: Commands for iMaker
|
|
73 |
set CMD_IMAKE_CORE=imaker vasco_ui core USE_SYMGEN=0
|
|
74 |
set CMD_IMAKE_ROFS2=imaker vasco_ui rofs2 USE_SYMGEN=0
|
|
75 |
set CMD_IMAKE_ROFS3=imaker vasco_ui rofs3 USE_SYMGEN=0
|
|
76 |
set CMD_IMAKE_UDAERASE=imaker vasco_ui udaerase USE_SYMGEN=0
|
|
77 |
set CMD_IMAKE_CORE_SYMBOLS=imaker vasco_ui romsymbol
|
|
78 |
set CMD_IMAKE_ROFS2_SYMBOLS=imaker vasco_ui rofs2-symbol
|
|
79 |
set CMD_IMAKE_ROFS3_SYMBOLS=imaker vasco_ui rofs3-symbol
|
|
80 |
|
|
81 |
:: Commands and settings for CodeScanner
|
|
82 |
set CODESCANNER_PATH=cs_output
|
|
83 |
set CMD_CODESCANNER=codescanner -t off
|
|
84 |
|
|
85 |
:: Python script for checking from test logs are tests passed
|
|
86 |
set PY_ALL_TESTS_PASSED=^
|
|
87 |
import re,sys;^
|
|
88 |
file = open('%EPOCROOT%/epoc32/winscw/c/logs/testframework/testreport.txt');^
|
|
89 |
txt = '\n'.join(file);^
|
|
90 |
reg1 = re.search('^\s*(?:Passed cases\: (\d+))$', txt, re.MULTILINE);^
|
|
91 |
reg2 = re.search('^\s*(?:Total cases\: (\d+))$', txt, re.MULTILINE);^
|
|
92 |
sys.exit(0 if reg1.group(1)==reg2.group(1) else 1)
|
|
93 |
|
|
94 |
:: Python script for parsing test result summary from test logs
|
|
95 |
set PY_PARSE_TEST_RESULTS=^
|
|
96 |
import re;^
|
|
97 |
file = open('%EPOCROOT%/epoc32/winscw/c/logs/testframework/testreport.txt');^
|
|
98 |
txt = '\n'.join(file);^
|
|
99 |
reg = re.findall('^\s*(.*cases\: \d+)$', txt, re.MULTILINE);^
|
|
100 |
print '\n'.join(reg);^
|
|
101 |
file.close()
|
|
102 |
|
|
103 |
::---------------------------------------------------------------------------
|
|
104 |
:: Parse input
|
|
105 |
::---------------------------------------------------------------------------
|
|
106 |
|
|
107 |
if not "%1"=="__INITIALIZED__" (
|
|
108 |
goto START_UP
|
|
109 |
|
|
110 |
) else (
|
|
111 |
|
|
112 |
if "%2"=="" (
|
|
113 |
set QUEUE=CHECK_EPOCROOT CLEAN_NOLOGS BUILD_ALL BUILD_TRACES RUN_TESTS GEN_CMT_REPORTS GEN_CS_REPORTS
|
|
114 |
goto SCHEDULER
|
|
115 |
|
|
116 |
) else if /i "%2"=="build" (
|
|
117 |
set QUEUE=CHECK_EPOCROOT CLEAN_NOLOGS BUILD_ALL BUILD_TRACES
|
|
118 |
goto SCHEDULER
|
|
119 |
|
|
120 |
) else if /i "%2"=="ctc" (
|
|
121 |
rem - atsinterface does not work with CTC instrumentation, use consoleui instead
|
|
122 |
rem - NOTE Emulator has to be closed manually
|
|
123 |
set CMD_TEST_RUN=start /wait %EPOCROOT%epoc32\release\winscw\udeb\consoleui.exe -dtextshell -- -testmodule testflextimer -run all
|
|
124 |
set QUEUE=CHECK_EPOCROOT INSTRUMENT_CTC DEL_CTC_REPORTS RUN_TESTS GEN_CTC_REPORTS
|
|
125 |
goto SCHEDULER
|
|
126 |
|
|
127 |
) else if /i "%2"=="cov" (
|
|
128 |
set QUEUE=CHECK_EPOCROOT CLEAN_NOLOGS GEN_COV_REPORTS
|
|
129 |
goto SCHEDULER
|
|
130 |
|
|
131 |
) else if /i "%2"=="image" (
|
|
132 |
set QUEUE=CHECK_EPOCROOT GEN_IMAGE GEN_SYMBOLS
|
|
133 |
goto SCHEDULER
|
|
134 |
|
|
135 |
) else if /i "%2"=="test" (
|
|
136 |
set QUEUE=CHECK_EPOCROOT GEN_CMT_REPORTS GEN_CS_REPORTS
|
|
137 |
goto SCHEDULER
|
|
138 |
|
|
139 |
) else if /i "%2"=="help" goto SHOW_HELP
|
|
140 |
)
|
|
141 |
|
|
142 |
echo Illegal parameter %2
|
|
143 |
|
|
144 |
goto SHOW_HELP
|
|
145 |
|
|
146 |
::---------------------------------------------------------------------------
|
|
147 |
:START_UP
|
|
148 |
::---------------------------------------------------------------------------
|
|
149 |
:: Start a command shell with delayed environment expansion
|
|
150 |
|
|
151 |
cmd.exe /V:ON /C %0 __INITIALIZED__ %1
|
|
152 |
|
|
153 |
goto THE_END
|
|
154 |
|
|
155 |
::---------------------------------------------------------------------------
|
|
156 |
:SCHEDULER
|
|
157 |
::---------------------------------------------------------------------------
|
|
158 |
:: Run the build commands. Eat commands from QUEUE one by one
|
|
159 |
|
|
160 |
for /f "tokens=1*" %%i in ( "!QUEUE!" ) do (
|
|
161 |
set QUEUE=%%j
|
|
162 |
rem echo ====================================================================
|
|
163 |
rem echo %%i
|
|
164 |
rem echo ====================================================================
|
|
165 |
goto %%i
|
|
166 |
)
|
|
167 |
|
|
168 |
goto BUILD_OK
|
|
169 |
|
|
170 |
::---------------------------------------------------------------------------
|
|
171 |
:BUILD_ALL
|
|
172 |
::---------------------------------------------------------------------------
|
|
173 |
|
|
174 |
call %CMD_BUILD_ALL%
|
|
175 |
if not "%errorlevel%"=="0" goto BUILD_ERROR
|
|
176 |
|
|
177 |
goto SCHEDULER
|
|
178 |
|
|
179 |
::---------------------------------------------------------------------------
|
|
180 |
:BUILD_TRACES
|
|
181 |
::---------------------------------------------------------------------------
|
|
182 |
|
|
183 |
call %CMD_BUILD_TRACE%
|
|
184 |
if not "%errorlevel%"=="0" goto BUILD_ERROR
|
|
185 |
|
|
186 |
goto SCHEDULER
|
|
187 |
|
|
188 |
::---------------------------------------------------------------------------
|
|
189 |
:CLEAN_NOLOGS
|
|
190 |
::---------------------------------------------------------------------------
|
|
191 |
:: Reallyclean FlexTimer component without showing compilation logs on screen
|
|
192 |
|
|
193 |
call %CMD_BUILD_CLEAN% > NUL 2>&1
|
|
194 |
|
|
195 |
goto SCHEDULER
|
|
196 |
|
|
197 |
::---------------------------------------------------------------------------
|
|
198 |
:INSTRUMENT_CTC
|
|
199 |
::---------------------------------------------------------------------------
|
|
200 |
:: Instrument FlexTimer WINSCW UDEB with CTC++
|
|
201 |
|
|
202 |
:: Remove old CTC symbols
|
|
203 |
del %CTC_OUTPATH%\%CTC_OUTFILE%.sym > NUL 2>&1
|
|
204 |
|
|
205 |
:: Clean old compilation
|
|
206 |
call %CMD_CTC_CLEAN% > NUL 2>&1
|
|
207 |
|
|
208 |
:: Instrument the code
|
|
209 |
call %CMD_CTC_BUILD%
|
|
210 |
if not "%errorlevel%"=="0" goto BUILD_ERROR
|
|
211 |
|
|
212 |
goto SCHEDULER
|
|
213 |
|
|
214 |
::---------------------------------------------------------------------------
|
|
215 |
:DEL_CTC_REPORTS
|
|
216 |
::---------------------------------------------------------------------------
|
|
217 |
:: Delete CTC generated test reports. SYM-file is deleted before
|
|
218 |
:: instrumenting CTC.
|
|
219 |
|
|
220 |
del %CTC_OUTPATH%\%CTC_OUTFILE%.dat > NUL 2>&1
|
|
221 |
rmdir /q /s %CTC_OUTPATH%\CTCHTML > NUL 2>&1
|
|
222 |
|
|
223 |
goto SCHEDULER
|
|
224 |
|
|
225 |
::---------------------------------------------------------------------------
|
|
226 |
:RUN_TESTS
|
|
227 |
::---------------------------------------------------------------------------
|
|
228 |
|
|
229 |
:: Compile test component
|
|
230 |
call %CMD_TEST_BUILD%
|
|
231 |
if not "%errorlevel%"=="0" goto BUILD_ERROR
|
|
232 |
|
|
233 |
echo Testing...
|
|
234 |
|
|
235 |
:: Run test application
|
|
236 |
%CMD_TEST_RUN%
|
|
237 |
if not "%errorlevel%"=="0" goto TEST_FAILED
|
|
238 |
|
|
239 |
:: Verify test results
|
|
240 |
call python -c "%PY_ALL_TESTS_PASSED%"
|
|
241 |
if not "%errorlevel%"=="0" goto TEST_FAILED
|
|
242 |
|
|
243 |
goto SCHEDULER
|
|
244 |
|
|
245 |
::---------------------------------------------------------------------------
|
|
246 |
:GEN_CTC_REPORTS
|
|
247 |
::---------------------------------------------------------------------------
|
|
248 |
|
|
249 |
:: Generate CTC++ reports
|
|
250 |
call %CMD_CTC_GEN%
|
|
251 |
if not "%errorlevel%"=="0" goto BUILD_ERROR
|
|
252 |
|
|
253 |
goto SCHEDULER
|
|
254 |
|
|
255 |
::---------------------------------------------------------------------------
|
|
256 |
:GEN_CMT_REPORTS
|
|
257 |
::---------------------------------------------------------------------------
|
|
258 |
|
|
259 |
call %CMD_CMT_GEN%
|
|
260 |
|
|
261 |
goto SCHEDULER
|
|
262 |
|
|
263 |
::---------------------------------------------------------------------------
|
|
264 |
:GEN_COV_REPORTS
|
|
265 |
::---------------------------------------------------------------------------
|
|
266 |
|
|
267 |
:: Delete the old results
|
|
268 |
rmdir /q /s %COV_OUTPATH% > NUL 2>&1
|
|
269 |
|
|
270 |
:: Build with Coverity Prevent
|
|
271 |
call %CMD_COV_BUILD%
|
|
272 |
if not "%errorlevel%"=="0" goto BUILD_ERROR
|
|
273 |
|
|
274 |
:: Analyze the code
|
|
275 |
call %CMD_COV_ANALYZE%
|
|
276 |
if not "%errorlevel%"=="0" goto BUILD_ERROR
|
|
277 |
|
|
278 |
:: Deliver the results
|
|
279 |
call %CMD_COV_DELIVER%
|
|
280 |
if not "%errorlevel%"=="0" goto BUILD_ERROR
|
|
281 |
|
|
282 |
:: Open the results
|
|
283 |
%CMD_COV_SHOW_RESULTS%
|
|
284 |
|
|
285 |
goto SCHEDULER
|
|
286 |
|
|
287 |
::---------------------------------------------------------------------------
|
|
288 |
:GEN_CS_REPORTS
|
|
289 |
::---------------------------------------------------------------------------
|
|
290 |
|
|
291 |
set __CODESCANNER_LAST_DIR=
|
|
292 |
set __CODESCANNER_PARAMETERS=
|
|
293 |
|
|
294 |
:: Find all inc and src -directories that are not in codescanner results nor
|
|
295 |
:: test code. Add '-i' parameter to every directory except the last one. (As
|
|
296 |
:: codescanner -h states.)
|
|
297 |
|
|
298 |
for /f "usebackq" %%i in (`dir /s /b %SOURCE_PATH%\src %SOURCE_PATH%\inc ^| findstr /V "\\test\\ \\%CODESCANNER_PATH%\\"`) do (
|
|
299 |
if defined __CODESCANNER_LAST_DIR set __CODESCANNER_PARAMETERS=!__CODESCANNER_PARAMETERS! -i !__CODESCANNER_LAST_DIR!
|
|
300 |
set __CODESCANNER_LAST_DIR=%%i
|
|
301 |
)
|
|
302 |
|
|
303 |
%CMD_CODESCANNER% %__CODESCANNER_PARAMETERS% %__CODESCANNER_LAST_DIR% %CODESCANNER_PATH%
|
|
304 |
if not "%errorlevel%"=="0" goto BUILD_ERROR
|
|
305 |
|
|
306 |
:: Open the results
|
|
307 |
start %CODESCANNER_PATH%\problemIndex.html
|
|
308 |
|
|
309 |
goto SCHEDULER
|
|
310 |
|
|
311 |
::---------------------------------------------------------------------------
|
|
312 |
:CHECK_EPOCROOT
|
|
313 |
::---------------------------------------------------------------------------
|
|
314 |
|
|
315 |
:: Check that the given parameter is a root dir.
|
|
316 |
for /f %%i in ("%EPOCROOT%") do (
|
|
317 |
if /i not "%EPOCROOT%"=="%%~di\" (
|
|
318 |
echo EPOCROOT is invalid: %EPOCROOT%
|
|
319 |
echo It should be a root of certain drive letter e.g. T:\
|
|
320 |
goto BUILD_ERROR
|
|
321 |
)
|
|
322 |
)
|
|
323 |
|
|
324 |
goto SCHEDULER
|
|
325 |
|
|
326 |
::---------------------------------------------------------------------------
|
|
327 |
:GEN_IMAGE
|
|
328 |
::---------------------------------------------------------------------------
|
|
329 |
|
|
330 |
:: Go to the SDK drive
|
|
331 |
for /f %%i in ("%EPOCROOT%") do %%~di
|
|
332 |
|
|
333 |
:: Make image
|
|
334 |
call %CMD_IMAKE_CORE%
|
|
335 |
if not "%errorlevel%"=="0" goto BUILD_ERROR
|
|
336 |
|
|
337 |
call %CMD_IMAKE_ROFS2%
|
|
338 |
if not "%errorlevel%"=="0" goto BUILD_ERROR
|
|
339 |
|
|
340 |
call %CMD_IMAKE_ROFS3%
|
|
341 |
if not "%errorlevel%"=="0" goto BUILD_ERROR
|
|
342 |
|
|
343 |
call %CMD_IMAKE_UDAERASE%
|
|
344 |
if not "%errorlevel%"=="0" goto BUILD_ERROR
|
|
345 |
|
|
346 |
echo.
|
|
347 |
echo ======================================================================
|
|
348 |
echo IMAGES ARE READY
|
|
349 |
echo ======================================================================
|
|
350 |
echo.
|
|
351 |
|
|
352 |
goto SCHEDULER
|
|
353 |
|
|
354 |
::---------------------------------------------------------------------------
|
|
355 |
:GEN_SYMBOLS
|
|
356 |
::---------------------------------------------------------------------------
|
|
357 |
|
|
358 |
:: Go to the SDK drive
|
|
359 |
for /f %%i in ("%EPOCROOT%") do %%~di
|
|
360 |
|
|
361 |
:: Generate symbols
|
|
362 |
call %CMD_IMAKE_CORE_SYMBOLS%
|
|
363 |
if not "%errorlevel%"=="0" goto BUILD_ERROR
|
|
364 |
|
|
365 |
call %CMD_IMAKE_ROFS2_SYMBOLS%
|
|
366 |
if not "%errorlevel%"=="0" goto BUILD_ERROR
|
|
367 |
|
|
368 |
call %CMD_IMAKE_ROFS3_SYMBOLS%
|
|
369 |
if not "%errorlevel%"=="0" goto BUILD_ERROR
|
|
370 |
|
|
371 |
goto SCHEDULER
|
|
372 |
|
|
373 |
::---------------------------------------------------------------------------
|
|
374 |
:BUILD_ERROR
|
|
375 |
::---------------------------------------------------------------------------
|
|
376 |
|
|
377 |
echo.
|
|
378 |
echo Build failed
|
|
379 |
echo.
|
|
380 |
|
|
381 |
goto THE_END
|
|
382 |
|
|
383 |
::---------------------------------------------------------------------------
|
|
384 |
:BUILD_OK
|
|
385 |
::---------------------------------------------------------------------------
|
|
386 |
|
|
387 |
echo.
|
|
388 |
echo Build OK
|
|
389 |
echo.
|
|
390 |
|
|
391 |
goto THE_END
|
|
392 |
|
|
393 |
::---------------------------------------------------------------------------
|
|
394 |
:TEST_FAILED
|
|
395 |
::---------------------------------------------------------------------------
|
|
396 |
|
|
397 |
echo.
|
|
398 |
echo Testing failed
|
|
399 |
echo.
|
|
400 |
|
|
401 |
call python -c "%PY_PARSE_TEST_RESULTS%"
|
|
402 |
|
|
403 |
goto THE_END
|
|
404 |
|
|
405 |
::---------------------------------------------------------------------------
|
|
406 |
:SHOW_HELP
|
|
407 |
::---------------------------------------------------------------------------
|
|
408 |
echo.
|
|
409 |
echo A script for building and testing FlexTimer. Version %VERSION%
|
|
410 |
echo.
|
|
411 |
echo Usage:
|
|
412 |
echo flextimer_build ^<option^>
|
|
413 |
echo.
|
|
414 |
echo Options:
|
|
415 |
echo.
|
|
416 |
echo ^<none^> Build component (with traces), build test component and run
|
|
417 |
echo tests, generate static analysis
|
|
418 |
echo.
|
|
419 |
echo build Rebuild component (with traces)
|
|
420 |
echo.
|
|
421 |
echo cov Generate and deliver Coverity Prevent report
|
|
422 |
echo.
|
|
423 |
echo ctc Instrument CTC++, build test component and run tests,
|
|
424 |
echo generate test coverity reports
|
|
425 |
echo.
|
|
426 |
echo image Create CORE and ROFS1, ROFS2, ROFS3 and UDAERASE flash images
|
|
427 |
echo.
|
|
428 |
echo help Show this help
|
|
429 |
echo.
|
|
430 |
|
|
431 |
::---------------------------------------------------------------------------
|
|
432 |
:THE_END
|
|
433 |
::---------------------------------------------------------------------------
|
|
434 |
endlocal
|