|
1 rem Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 rem All rights reserved. |
|
3 rem This component and the accompanying materials are made available |
|
4 rem under the terms of "Eclipse Public License v1.0" |
|
5 rem which accompanies this distribution, and is available |
|
6 rem at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 rem |
|
8 rem Initial Contributors: |
|
9 rem Nokia Corporation - initial contribution. |
|
10 rem |
|
11 rem Contributors: |
|
12 rem |
|
13 rem Description: |
|
14 rem |
|
15 |
|
16 @echo off |
|
17 |
|
18 rem ================================================================================================ |
|
19 rem |
|
20 rem NOTES: |
|
21 rem - This batch file is used by DABS to automate DirectGDI tests. |
|
22 rem - The reason behind it is the amount of data used by the tests, which is too |
|
23 rem big for sys$rom.bin to handle |
|
24 rem - This file is both useful for overnight automated testing in DABS as well as a reference |
|
25 rem for the correct setup of the tests during a manual execution. |
|
26 rem |
|
27 rem USAGE: |
|
28 rem install -> Installs to the MMC card all data needed by the test. The process of searching |
|
29 rem for the usb drive is automated. |
|
30 rem :copy -> Retrieves from the MMC card all the output, copying it back to the PC performing |
|
31 rem the automated build. |
|
32 rem :parse -> Once the data is in the build PC, a set of Python scripts are run to generate |
|
33 rem a report page to present the results in an html format. |
|
34 rem |
|
35 rem CAVEAT: |
|
36 rem - From dabslaunch_v6, DABS has been updated as part of the BATS project. Due to |
|
37 rem the nature of BATS, the mechanism for sending and retrieving data to and from the MMC card |
|
38 rem has been updated, as there is no longer a 1 to 1 connection between a build machine and a |
|
39 rem hardware board (making the usb search mechanism useless). |
|
40 rem - This results in a scenario where in a BATS system, only DABS knows in which board a |
|
41 rem particular rom is going to run. For that reason, both :install and :copy are not used within |
|
42 rem the BATS scripts, but nevertheless, they have been left here for reference as well as for |
|
43 rem a helping tool when doing the setup manually. |
|
44 rem |
|
45 rem ================================================================================================ |
|
46 |
|
47 setlocal |
|
48 |
|
49 :: Initialise local variables |
|
50 set TARGET_PLATFORM=%1 |
|
51 set COMMAND_CHOICE=%2 |
|
52 |
|
53 |
|
54 goto :%COMMAND_CHOICE% |
|
55 |
|
56 |
|
57 rem =============================================================== |
|
58 rem == ======= |
|
59 rem == SUPPORT FUNCTIONS ======= |
|
60 rem == ======= |
|
61 rem =============================================================== |
|
62 |
|
63 :checkForUsbDrive |
|
64 dir %1:\ 2>&1 | find "%1:" >NUL 2>&1 |
|
65 if ERRORLEVEL 1 goto :EOF |
|
66 if not exist %1:\usbload.zip goto :EOF |
|
67 echo INFO: %1:\usbload.zip found! |
|
68 set HARDWARE_USB=true |
|
69 set HARDWARE_USB_DRIVE=%1 |
|
70 goto :EOF |
|
71 |
|
72 :wait |
|
73 echo INFO: Waiting %1 seconds |
|
74 for /L %%j in (2,1,%1) do call :wait1 |
|
75 :wait1 |
|
76 for %%i in (%time%) do set startsec=%%~ni% |
|
77 :loop_wait |
|
78 set endsec= |
|
79 for %%k in (%time%) do set endsec=%%~nk% |
|
80 if %endsec%==%startsec% goto loop_wait |
|
81 goto :EOF |
|
82 |
|
83 :searchForUSB |
|
84 for %%i in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do call :checkForUsbDrive %%i |
|
85 goto :EOF |
|
86 |
|
87 :checkAutomation |
|
88 set HARDWARE_USB=false |
|
89 if not exist "\trgtest.exe" echo INFO: \trgtest.exe not found & goto :EOF |
|
90 if not exist "\hardwarecontrol.exe" echo INFO: \hardwarecontrol.exe not found & goto :EOF |
|
91 if not exist "\devcon.exe" echo INFO: \devcon.exe not found & goto :EOF |
|
92 |
|
93 call \devcon.exe remove "USB\Vid_0e22&Pid_1112&Rev_0305" |
|
94 |
|
95 echo INFO: Hardware OFF |
|
96 call \hardwarecontrol.exe --off |
|
97 |
|
98 call :wait 2 |
|
99 |
|
100 echo INFO: Hardware ON |
|
101 call \hardwarecontrol.exe --on |
|
102 |
|
103 call :wait 15 |
|
104 call :searchForUSB |
|
105 |
|
106 if /i "%HARDWARE_USB%"=="true" goto :skipUsbSearch |
|
107 |
|
108 echo INFO: USB Drive not found, trying again... |
|
109 echo INFO: Hardware OFF |
|
110 call \hardwarecontrol.exe --off |
|
111 |
|
112 call :wait 2 |
|
113 |
|
114 echo INFO: Hardware ON |
|
115 call \hardwarecontrol.exe --on |
|
116 |
|
117 call :wait 15 |
|
118 call :searchForUSB |
|
119 |
|
120 if /i "%HARDWARE_USB%"=="true" goto :skipUsbSearch |
|
121 call :usbNotFound |
|
122 goto :EOF |
|
123 |
|
124 :skipUsbSearch |
|
125 if not exist \logs\%TARGET_PLATFORM% md \logs\%TARGET_PLATFORM% |
|
126 goto :EOF |
|
127 |
|
128 :usbNotFound |
|
129 echo ERROR: Target USB Drive not found |
|
130 call \hardwarecontrol.exe --off |
|
131 goto :EOF |
|
132 |
|
133 :hardwareSwitchOff |
|
134 call :wait 15 |
|
135 chkdsk %HARDWARE_USB_DRIVE%: |
|
136 call :wait 2 |
|
137 call \devcon.exe remove "USB\Vid_0e22&Pid_1112&Rev_0305" |
|
138 call :wait 2 |
|
139 echo INFO: Hardware OFF |
|
140 call \hardwarecontrol.exe --off |
|
141 goto :EOF |
|
142 |
|
143 |
|
144 rem =============================================================== |
|
145 rem == ======= |
|
146 rem == INSTALL ======= |
|
147 rem == ======= |
|
148 rem =============================================================== |
|
149 |
|
150 :install |
|
151 |
|
152 call :checkAutomation |
|
153 if /i "%HARDWARE_USB%"=="false" echo ERROR: DirectGDI test initialisation failed. USB not found! & goto :EOF |
|
154 |
|
155 rd /s /q %HARDWARE_USB_DRIVE%:\img |
|
156 md %HARDWARE_USB_DRIVE%:\img\test |
|
157 |
|
158 call :hardwareSwitchOff |
|
159 |
|
160 goto :EOF |
|
161 |
|
162 |
|
163 |
|
164 rem =============================================================== |
|
165 rem == ======= |
|
166 rem == EXTRACT RESULTS FROM MMC ======= |
|
167 rem == ======= |
|
168 rem =============================================================== |
|
169 |
|
170 :copy |
|
171 |
|
172 call :checkAutomation |
|
173 if /i "%HARDWARE_USB%"=="false" echo ERROR: DirectGDI copy results from MMC card failed. USB not found! & goto :EOF |
|
174 |
|
175 rem copy test mbms from MMC card |
|
176 set CDRIVE=%EPOCROOT%epoc32\data\c |
|
177 xcopy /EIYR %HARDWARE_USB_DRIVE%:\img\test %CDRIVE%\img\test |
|
178 |
|
179 call :hardwareSwitchOff |
|
180 goto :EOF |
|
181 |
|
182 |
|
183 |
|
184 rem =============================================================== |
|
185 rem == ======= |
|
186 rem == PARSE RESULTS ONCE IN THE PC ======= |
|
187 rem == ======= |
|
188 rem =============================================================== |
|
189 |
|
190 :parse |
|
191 |
|
192 rem copy reference mbms from source |
|
193 chdir %EPOCROOT% |
|
194 set CDRIVE=%EPOCROOT%epoc32\data\c |
|
195 unzip -qo %CDRIVE%\img\reference.zip -d %CDRIVE%\img\ref |
|
196 rem the next one overwrites some of the mbm copied in the previous copy. |
|
197 unzip -qo %CDRIVE%\img\replacements_from_directgdi\replacement.zip -d %CDRIVE%\img\ref |
|
198 |
|
199 rem create logs directory |
|
200 if not exist %CDRIVE%\logs md %CDRIVE%\logs |
|
201 |
|
202 rem convert .mbm files to .bmp files and run the bitmap comparison tests, and create html reports |
|
203 chdir %CDRIVE%\img |
|
204 perl runtest.pl %TARGET_PLATFORM% |
|
205 |
|
206 set LOGDIR=logs |
|
207 PUSHD \ |
|
208 FOR /D %%G IN (logs*) DO (IF EXIST %%G\%TARGET_PLATFORM%\directgdi_flag SET LOGDIR=%%G) |
|
209 POPD |
|
210 |
|
211 set RESULTS=\%LOGDIR%\%TARGET_PLATFORM%\directgdi_results |
|
212 set ONBSUMMARY=\%LOGDIR%\%TARGET_PLATFORM% |
|
213 rem copy difference bitmaps, test image bitmaps and reference image bitmaps to results directories |
|
214 xcopy /IYR %CDRIVE%\img\ref\*.bmp %RESULTS%\img\ref |
|
215 xcopy /IYR %CDRIVE%\img\test\*.bmp %RESULTS%\img\test |
|
216 xcopy /IYR %CDRIVE%\img\RGBDiff*.bmp %RESULTS%\img |
|
217 rem copy results web pages |
|
218 xcopy /SIYR %CDRIVE%\logs\*.html %RESULTS%\logs |
|
219 xcopy /SIYR %CDRIVE%\*.htm %ONBSUMMARY% |
|
220 goto :EOF |
|
221 |
|
222 |
|
223 goto :EOF |
|
224 |
|
225 endlocal |