author | hgs |
Mon, 04 Oct 2010 16:06:10 +0300 | |
changeset 76 | cfea66083b62 |
parent 45 | 6b911d05207e |
child 78 | baacf668fe89 |
permissions | -rw-r--r-- |
37 | 1 |
rem |
2 |
rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
rem All rights reserved. |
|
4 |
rem This component and the accompanying materials are made available |
|
5 |
rem under the terms of "Eclipse Public License v1.0" |
|
6 |
rem which accompanies this distribution, and is available |
|
7 |
rem at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
rem |
|
9 |
rem Initial Contributors: |
|
10 |
rem Nokia Corporation - initial contribution. |
|
11 |
rem |
|
12 |
rem Contributors: |
|
13 |
rem |
|
14 |
rem Description: |
|
15 |
rem |
|
16 |
||
17 |
@echo off |
|
18 |
setlocal |
|
19 |
goto :startup |
|
20 |
||
21 |
:::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
22 |
:: function DEFAULT |
|
23 |
:: |
|
24 |
:: Modify this function |
|
25 |
:: - TESTED_SRC can be changed to match tested code. |
|
26 |
:: Specifies path from testcode group directory to |
|
27 |
:: tested code |
|
28 |
:: - Add test directories to be runned |
|
29 |
:: ie. "call :build ut_projectdirectory" or use |
|
30 |
:: "for /f %%a in ('dir /b ut_*') do call :build %%a" |
|
31 |
:: which compiles, instruments and runs all test directories |
|
32 |
:: starting with "ut_". |
|
33 |
:::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
34 |
:DEFAULT |
|
35 |
set TESTED_SRC=..\..\src\*.cpp |
|
36 |
||
37 |
for /f %%a in ('dir /b ut_*') do call :build %%a |
|
38 |
if [%DOMODULESTESTS%] EQU [TRUE] ( |
|
39 |
for /f %%a in ('dir /b mt_*') do call :build %%a |
|
40 |
) |
|
41 |
||
42 |
call :finish |
|
43 |
goto :END |
|
44 |
||
45 |
:::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
46 |
:: function STARTUP |
|
47 |
:: |
|
48 |
:: Initializing script |
|
49 |
:::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
50 |
:STARTUP |
|
51 |
||
52 |
set BUILDTESTS=TRUE |
|
53 |
set RUNTESTS=TRUE |
|
54 |
set INSTRUMENT=TRUE |
|
55 |
set REMOVEINSTRUMENT=TRUE |
|
56 |
set DOMODULESTESTS=TRUE |
|
57 |
set SBS_CALL=sbs --config winscw_udeb --keepgoing BUILD |
|
58 |
set PATH_TO_DLL=\epoc32\release\winscw\udeb |
|
59 |
set PATH_TO_COVERAGE_DATA=\coverage_data |
|
60 |
set PATH_TO_RESULT=\test_result |
|
61 |
||
62 |
if not exist %PATH_TO_COVERAGE_DATA% ( |
|
63 |
mkdir %PATH_TO_COVERAGE_DATA% |
|
64 |
) |
|
65 |
||
66 |
if not exist %PATH_TO_RESULT% ( |
|
67 |
mkdir %PATH_TO_RESULT% |
|
68 |
) |
|
69 |
||
70 |
if [%1] EQU [] ( goto default ) |
|
71 |
||
72 |
call :%1 |
|
73 |
call :%2 |
|
74 |
call :%3 |
|
75 |
call :%4 |
|
76 |
call :%5 |
|
77 |
echo Running tests = %RUNTESTS% |
|
78 |
echo Instrumenting tests = %INSTRUMENT% |
|
79 |
goto default |
|
80 |
||
81 |
:/NOCLEANUP |
|
82 |
set REMOVEINSTRUMENT=FALSE |
|
83 |
goto end |
|
84 |
||
85 |
:/NORUN |
|
86 |
set RUNTESTS=FALSE |
|
87 |
set REMOVEINSTRUMENT=FALSE |
|
88 |
goto end |
|
89 |
||
90 |
:/NOINSTRUMENT |
|
91 |
set INSTRUMENT=FALSE |
|
92 |
goto end |
|
93 |
||
94 |
:/NOBUILD |
|
95 |
set BUILDTESTS=FALSE |
|
96 |
goto end |
|
97 |
||
98 |
:/ONLYUNITTESTS |
|
99 |
set DOMODULESTESTS=FALSE |
|
100 |
goto end |
|
101 |
||
102 |
:::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
103 |
:: function FINISH |
|
104 |
:: |
|
105 |
:: Finishes run_auto_tests.bat |
|
106 |
:::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
107 |
:FINISH |
|
108 |
||
109 |
if [%RUNTESTS%] EQU [TRUE] ( |
|
110 |
call :runtests |
|
111 |
) |
|
112 |
||
113 |
if [%INSTRUMENT%] EQU [TRUE] ( |
|
114 |
call :calculatecoverage |
|
115 |
) |
|
116 |
||
117 |
if [%REMOVEINSTRUMENT%] EQU [TRUE] ( |
|
118 |
call :removecoverage |
|
119 |
) |
|
120 |
goto end |
|
121 |
||
122 |
:::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
123 |
:: function BUILD |
|
124 |
:: param directory |
|
125 |
:: |
|
126 |
:: builds test from given directory |
|
127 |
:::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
128 |
:BUILD |
|
129 |
setlocal |
|
130 |
if [%BUILDTESTS%] EQU [FALSE] ( goto end ) |
|
131 |
echo Building %1 |
|
132 |
if not exist %1 ( |
|
133 |
echo %1 Not found! |
|
134 |
goto end |
|
135 |
) |
|
136 |
||
137 |
pushd . |
|
138 |
call cd %1 |
|
139 |
call qmake |
|
140 |
call sbs --config winscw_udeb --keepgoing CLEAN |
|
141 |
if [%INSTRUMENT%] EQU [TRUE] ( |
|
76 | 142 |
call ctcwrap -n %PATH_TO_COVERAGE_DATA%\%1 -i d -C "EXCLUDE=*" -C "NO_EXCLUDE=%TESTED_SRC%" "%SBS_CALL%" |
37 | 143 |
) else ( |
144 |
call %SBS_CALL% |
|
145 |
) |
|
146 |
||
147 |
popd |
|
148 |
endlocal |
|
149 |
goto end |
|
150 |
||
151 |
||
152 |
:::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
153 |
:: function RUNTESTS |
|
154 |
:: |
|
155 |
:: NOTE! Function assumes that test binary is named according to test directory. |
|
156 |
:::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
157 |
:RUNTESTS |
|
158 |
echo Running tests |
|
159 |
for /f %%a in ('dir /b ut_*') do ( |
|
160 |
call %PATH_TO_DLL%\%%a.exe |
|
161 |
move \epoc32\winscw\c\data\%%a.log %PATH_TO_RESULT%\%%a.log |
|
162 |
) |
|
163 |
goto end |
|
164 |
||
165 |
:::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
166 |
:: function CALCULATECOVERAGE |
|
167 |
:: |
|
168 |
:: Calculates test coverage. Generates html |
|
169 |
:::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
170 |
:CALCULATECOVERAGE |
|
171 |
echo Calculating coverage |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
172 |
ctcpost %PATH_TO_COVERAGE_DATA%\*.sym -p - | ctcmerge -i - -o profile.txt |
37 | 173 |
call ctc2html -t 70 -i profile.txt -o \coverage_result -nsb |
174 |
goto end |
|
175 |
||
176 |
:::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
177 |
:: function REMOVECOVERAGE |
|
178 |
:: |
|
179 |
:: Removes data from coverage directory |
|
180 |
:::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
181 |
:REMOVECOVERAGE |
|
182 |
echo Removing deleting coverage data |
|
183 |
call del %PATH_TO_COVERAGE_DATA%\*.sym |
|
184 |
call del %PATH_TO_COVERAGE_DATA%\*.dat |
|
185 |
call del profile.txt |
|
186 |
goto end |
|
187 |
||
188 |
:::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
189 |
:: function END |
|
190 |
:: |
|
191 |
:: Prints done |
|
192 |
:::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
193 |
:END |
|
194 |
echo Done! |