|
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\* |
|
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 |
|
43 call :finish |
|
44 goto :END |
|
45 |
|
46 :::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
47 :: function STARTUP |
|
48 :: |
|
49 :: Initializing script |
|
50 :::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
51 :STARTUP |
|
52 |
|
53 set BUILDTESTS=TRUE |
|
54 set RUNTESTS=TRUE |
|
55 set REMOVETESTS=TRUE |
|
56 set INSTRUMENT=TRUE |
|
57 set REMOVEINSTRUMENT=TRUE |
|
58 set DOMODULESTESTS=TRUE |
|
59 set ABLD_CALL=abld test build winscw udeb -keepgoing |
|
60 set PATH_TO_DLL=\epoc32\release\winscw\udeb |
|
61 set PATH_TO_MOVE_DLL=\epoc32\release\winscw\udeb\z\sys\bin |
|
62 set PATH_TO_COVERAGE_DATA=\coverage_data |
|
63 |
|
64 |
|
65 if not exist %PATH_TO_DLL%\eunitexerunner.exe ( |
|
66 echo EUnit not installed! |
|
67 goto end |
|
68 ) |
|
69 |
|
70 if not exist %PATH_TO_COVERAGE_DATA% ( |
|
71 mkdir %PATH_TO_COVERAGE_DATA% |
|
72 ) |
|
73 |
|
74 if [%1] EQU [] ( goto default ) |
|
75 |
|
76 call :%1 |
|
77 call :%2 |
|
78 call :%3 |
|
79 call :%4 |
|
80 call :%5 |
|
81 echo Running tests = %RUNTESTS% |
|
82 echo Instrumenting tests = %INSTRUMENT% |
|
83 goto default |
|
84 |
|
85 :/NOCLEANUP |
|
86 set REMOVEINSTRUMENT=FALSE |
|
87 set REMOVETESTS=FALSE |
|
88 goto end |
|
89 |
|
90 :/NORUN |
|
91 set RUNTESTS=FALSE |
|
92 set REMOVEINSTRUMENT=FALSE |
|
93 set REMOVETESTS=FALSE |
|
94 goto end |
|
95 |
|
96 :/NOINSTRUMENT |
|
97 set INSTRUMENT=FALSE |
|
98 goto end |
|
99 |
|
100 :/NOBUILD |
|
101 set BUILDTESTS=FALSE |
|
102 goto end |
|
103 |
|
104 :/ONLYUNITTESTS |
|
105 set DOMODULESTESTS=FALSE |
|
106 goto end |
|
107 |
|
108 :::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
109 :: function FINISH |
|
110 :: |
|
111 :: Finishes run_auto_tests.bat |
|
112 :::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
113 :FINISH |
|
114 call :move |
|
115 |
|
116 if [%RUNTESTS%] EQU [TRUE] ( |
|
117 call :runtests |
|
118 ) |
|
119 |
|
120 if [%REMOVETESTS%] EQU [TRUE] ( |
|
121 call :removetests |
|
122 ) |
|
123 |
|
124 if [%INSTRUMENT%] EQU [TRUE] ( |
|
125 call :calculatecoverage |
|
126 ) |
|
127 |
|
128 if [%REMOVEINSTRUMENT%] EQU [TRUE] ( |
|
129 call :removecoverage |
|
130 ) |
|
131 goto end |
|
132 |
|
133 :::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
134 :: function BUILD |
|
135 :: param directory |
|
136 :: |
|
137 :: builds test from given directory |
|
138 :::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
139 :BUILD |
|
140 setlocal |
|
141 if [%BUILDTESTS%] EQU [FALSE] ( goto end ) |
|
142 echo Building %1 |
|
143 if not exist %1 ( |
|
144 echo %1 Not found! |
|
145 goto end |
|
146 ) |
|
147 |
|
148 pushd . |
|
149 call cd %1\group |
|
150 call bldmake bldfiles |
|
151 call abld test clean winscw udeb |
|
152 if [%INSTRUMENT%] EQU [TRUE] ( |
|
153 call ctcwrap -n %PATH_TO_COVERAGE_DATA%\%1 -i m -C "EXCLUDE=*" -C "NO_EXCLUDE=%TESTED_SRC%" %ABLD_CALL% |
|
154 ) else ( |
|
155 call %ABLD_CALL% |
|
156 ) |
|
157 |
|
158 popd |
|
159 endlocal |
|
160 goto end |
|
161 |
|
162 |
|
163 :::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
164 :: function MOVE |
|
165 :: |
|
166 :: moves compiled tests to eunit directory |
|
167 :::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
168 :MOVE |
|
169 echo Moving tests |
|
170 call move %PATH_TO_DLL%\ut_*.dll %PATH_TO_MOVE_DLL% |
|
171 call move %PATH_TO_DLL%\mt_*.dll %PATH_TO_MOVE_DLL% |
|
172 goto end |
|
173 |
|
174 |
|
175 :::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
176 :: function RUNTESTS |
|
177 :: |
|
178 :: Runs tests in eunit directory |
|
179 :::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
180 :RUNTESTS |
|
181 echo Running tests |
|
182 call %PATH_TO_DLL%\eunitexerunner.exe -dtextshell -- |
|
183 copy \epoc32\winscw\c\shared\EUnit\Logs\EUnit_log.xml \lastrun_EUnit_log.xml |
|
184 goto end |
|
185 |
|
186 :::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
187 :: function CALCULATECOVERAGE |
|
188 :: |
|
189 :: Calculates test coverage. Generates html |
|
190 :::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
191 :CALCULATECOVERAGE |
|
192 echo Calculating coverage |
|
193 ctcpost %PATH_TO_COVERAGE_DATA%\*.sym | ctcmerge -i - -o profile.txt |
|
194 call ctc2html -i profile.txt -o \coverage_result -nsb |
|
195 goto end |
|
196 |
|
197 :::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
198 :: function REMOVETESTS |
|
199 :: |
|
200 :: Removes tests from eunit directory |
|
201 :::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
202 :REMOVETESTS |
|
203 echo Removing Test dlls |
|
204 call sleep 3 |
|
205 call del %PATH_TO_MOVE_DLL%\t_*.dll |
|
206 call del %PATH_TO_MOVE_DLL%\mt_*.dll |
|
207 call del %PATH_TO_MOVE_DLL%\ut_*.dll |
|
208 call del %PATH_TO_MOVE_DLL%\it_*.dll |
|
209 goto end |
|
210 |
|
211 :::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
212 :: function REMOVECOVERAGE |
|
213 :: |
|
214 :: Removes data from coverage directory |
|
215 :::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
216 :REMOVECOVERAGE |
|
217 echo Removing deleting coverage data |
|
218 call del %PATH_TO_COVERAGE_DATA%\*.sym |
|
219 call del %PATH_TO_COVERAGE_DATA%\*.dat |
|
220 call del profile.txt |
|
221 goto end |
|
222 |
|
223 :::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
224 :: function END |
|
225 :: |
|
226 :: Prints done |
|
227 :::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
228 :END |
|
229 echo Done! |