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 @goto invoke_perl |
|
18 |
|
19 #!perl |
|
20 #line 5 |
|
21 |
|
22 ################################################################################################################ |
|
23 # This Script will be used to run EUnit testcases with or without codetest |
|
24 # Instrumentation. |
|
25 ################################################################################################################ |
|
26 |
|
27 # Packages needed |
|
28 #use strict; # strict naming rules |
|
29 use File::Find; # File operations |
|
30 use XML::Simple; # XML parsing |
|
31 File::Spec::Win32; # File operartions |
|
32 use Getopt::Long; # parameter handling |
|
33 use Cwd; # Directory operations |
|
34 Getopt::Long::Configure( "bundling_override","ignore_case_always" ); |
|
35 |
|
36 # Global variables |
|
37 |
|
38 # System defined location of files |
|
39 my($eunit_destination_dir)= "\\Epoc32\\release\\winscw\\udeb\\z\\sys\\bin\\"; |
|
40 my($build_destination_dir)= "\\Epoc32\\release\\winscw\\udeb\\"; |
|
41 my($build_tools_dir)= "\\Epoc32\\tools\\"; |
|
42 my($eunit_xml_file)= "\\Epoc32\\winscw\\C\\DigiaEUnit\\Logs\\DigiaEUnit_log.xml"; |
|
43 |
|
44 # Default names |
|
45 my($codetest_workspace)="codetest.idb"; |
|
46 my($unittest_result_file)="eunit_result.html"; |
|
47 my($currentdir)= cwd; |
|
48 my($results_destinationdir)=cwd; |
|
49 |
|
50 # Variables |
|
51 my (@subsystems, # List of user selected sub systems |
|
52 @sourcefiles, # List of user selected source files |
|
53 @makefiles, # List of make files |
|
54 @dll_filenames); # List of dll file names |
|
55 |
|
56 my ($param_help, # To extract all zip files |
|
57 $param_command, # Command to Run |
|
58 $param_dest, # Copy results to |
|
59 $param_all, # Destination directory |
|
60 $param_selectedsource, # Debug version enables data dumber |
|
61 $param_noclean, # Debug builds |
|
62 $param_nobuild, # Creates an Environment |
|
63 $param_nostub, # Dont build stubs |
|
64 $param_nosdkinst, # Dont Instrument SDK |
|
65 $param_exe, # Launch the exe specified |
|
66 $param_version); # Version |
|
67 |
|
68 my($choice, |
|
69 $user_selection, |
|
70 $count); |
|
71 |
|
72 #---------------------------------------Main Start----------------------------------------------------------# |
|
73 |
|
74 |
|
75 # read commandline parameters |
|
76 my $result = GetOptions('help' => \$param_help, # Display help info |
|
77 'command=s' => \$param_command, # Command to run |
|
78 'dest=s' => \$param_dest, # Destination directory |
|
79 'all' => \$param_all, # Run all |
|
80 'sourcefiles' => \$param_selectedsource,# To Select Source files |
|
81 'noclean' => \$param_noclean, # Dont run reallyclean |
|
82 'nobuild' => \$param_nobuild, # Dont run symbian build commands |
|
83 'nostub' => \$param_nostub, # Dont build stupbs |
|
84 'nosdkinst' => \$param_nosdkinst, # Dont instrument SDK. It is already done |
|
85 'exe=s' => \$param_exe, # Launch the exe specified.if nothing then epoc will be used |
|
86 'version' => \$param_version); # Version Information |
|
87 #Parse user options |
|
88 usage()if(!defined $param_command); # command is manadatory |
|
89 $choice=1 if $param_command eq ('ct'|'CT'); # set choice 1 if ct ( codtest) |
|
90 $param_exe=$build_destination_dir.'EUnitExeRunner' if(!defined $param_exe); |
|
91 |
|
92 #Checking for EUnit. Cant proceed without Eunit. |
|
93 if (! -e $build_destination_dir."EUnitExeRunner.exe") { |
|
94 print "*** EUnit is not installed for this SDK. Install EUnit by using Installation Manager from SymSEE ***\n"; |
|
95 exit 1; |
|
96 } |
|
97 |
|
98 if($param_command eq ('eu'|'EU')){ # set choice 2 if eu ( Eunit) |
|
99 unset_codetest_commands(); # unset the codetest commands |
|
100 $choice=2; |
|
101 } |
|
102 $choice=3 if $param_command eq ('mm'|'MM'); # set choice 3 if mm ( manual codtest run) |
|
103 if(defined $param_dest){ |
|
104 $results_destinationdir=$param_dest ; |
|
105 } |
|
106 else{ |
|
107 print "\n Note: No results destination directory specified.Results will be copied to Current Directory\n"; |
|
108 $results_destinationdir=~s/\//\\/g; |
|
109 $results_destinationdir=$results_destinationdir."\\"; |
|
110 } |
|
111 |
|
112 $param_noclean=1 if(defined $param_nobuild); |
|
113 run_system_command("bldmake bldfiles") if (!defined $param_nobuild); |
|
114 display_sybsystems(); # display list of subsystems |
|
115 |
|
116 if(defined $param_all){ |
|
117 print "\nOptions -all specified.Building all components \n "; |
|
118 $user_selection=0; |
|
119 } |
|
120 else { |
|
121 print "\t Options selected : "; |
|
122 $user_selection = <STDIN>;chomp ($user_selection); |
|
123 exit 0 if $user_selection =~ /^[Qq]/; |
|
124 } |
|
125 |
|
126 if(!$param_nostub){ |
|
127 print "\n\n *** Building stubs first ***\n\n "; |
|
128 system("abld reallyclean winscw udeb"); |
|
129 system("abld build winscw udeb"); |
|
130 print "\n\n *** End of building stubs ***\n\n "; |
|
131 } |
|
132 |
|
133 print "\n\n *** Building test components ***\n\n"; |
|
134 build_user_selected(); |
|
135 print "\n\n *** End of Building test components ***\n\n "; |
|
136 |
|
137 chomp(@dll_filenames); |
|
138 foreach my $dll(@dll_filenames){ |
|
139 run_system_command("copy ".$build_destination_dir.$dll." ".$eunit_destination_dir.$dll); |
|
140 } |
|
141 |
|
142 #Move Codetest.idb to temp directory so that codetest.py automation script can use it |
|
143 if($choice==1){ |
|
144 open DATFILE , ">$ENV{'TEMP'}/unitrunner.dat"; |
|
145 my(@drive); |
|
146 @drive=split(/:/,$currentdir); |
|
147 if($param_exe=~/EUnitExeRunner/) |
|
148 { |
|
149 print DATFILE @drive[0].":".$build_destination_dir.$param_exe."\n"; |
|
150 print DATFILE "$param_exe /L xml /E S60AppEnv /T 100 "."@dll_filenames"."\n"; |
|
151 } |
|
152 else |
|
153 { |
|
154 print DATFILE @drive[0].":".$build_tools_dir.$param_exe."\n"; |
|
155 } |
|
156 close DATFILE; |
|
157 run_system_command("move codetest.idb $ENV{'TEMP'}/codetest.idb"); |
|
158 print "\n\n *** Running codetest python script ***\n\n"; |
|
159 run_system_command("$ENV{'AMC_HOME'}/bin/ctmgr --cli codetest.py %1 %2 %3 %4 %5 %6 %7 %8 %9"); |
|
160 #Move Log files to user destination directory |
|
161 print "\n\n *** Moving Results ***\n\n"; |
|
162 $results_destinationdir.="\\CodeTest"; |
|
163 system("mkdir $results_destinationdir"); |
|
164 system("move $ENV{'TEMP'}\\codetest*.html $results_destinationdir"); |
|
165 system("move $ENV{'TEMP'}\\codetest*.txt $results_destinationdir"); |
|
166 system("move $ENV{'TEMP'}\\codetest*.idb $results_destinationdir"); |
|
167 } |
|
168 elsif($choice==2) { |
|
169 #Run Eunit TestReport |
|
170 print "\n\n *** Running EUnit with selected subsystems ***\n\n"; |
|
171 if($param_exe=~/EUnitExeRunner/) |
|
172 { |
|
173 run_system_command("$param_exe /L xml /E S60AppEnv /T 100 "."@dll_filenames"); |
|
174 } |
|
175 else |
|
176 { |
|
177 run_system_command("$param_exe"); |
|
178 print " Press a key to continue \n"; |
|
179 <STDIN>; |
|
180 } |
|
181 print "\n\n *** Printing Reports ***\n\n"; |
|
182 $results_destinationdir.="\\EUnit"; |
|
183 system("mkdir $results_destinationdir"); |
|
184 print_html_report(); |
|
185 system("copy $eunit_xml_file $results_destinationdir"); |
|
186 } |
|
187 elsif($choice==3) { |
|
188 #Run Eunit with instrumentation |
|
189 do { |
|
190 print "\n Please start CodetestManager and Target Server \n"; |
|
191 print " And load swic source codetest.idb\n"; |
|
192 print " And Press Y/N to Continue or Exit ! "; |
|
193 $user_selection = <STDIN>; |
|
194 chomp ($user_selection); |
|
195 }while($user_selection !~ /^[nN||yY]/); |
|
196 exit 0 if $user_selection =~ /^[nN]/; |
|
197 print "\n\n *** Running EUnit with instrumented subsystems ***\n\n"; |
|
198 if($param_exe=~/EUnitExeRunner/) |
|
199 { |
|
200 run_system_command("$param_exe /L xml /E S60AppEnv /T 100 "."@dll_filenames"); |
|
201 } |
|
202 else |
|
203 { |
|
204 run_system_command("$param_exe"); |
|
205 print " Press a key to continue \n"; |
|
206 <STDIN>; |
|
207 } |
|
208 } |
|
209 |
|
210 print "\n\n *** DONE ***\n\n"; |
|
211 |
|
212 #---------------------------------------Main Ends-------------------------------------------------------------# |
|
213 |
|
214 |
|
215 sub display_sybsystems { |
|
216 get_subsystems(); |
|
217 display_critical_error("Can't find a subsystem.Please Check your bld.inf file!") if(scalar @subsystems==0); |
|
218 print "\n\tPlease choose an option listed below \n"; |
|
219 print "\n\tenter +/- to build backward or forward \n"; |
|
220 print "\t\t0.To build all \n"; |
|
221 $count=1; |
|
222 foreach(@subsystems){ |
|
223 print "\t\t".$count++. "." .$_."\n"; |
|
224 } |
|
225 print "\t\tq.Exit \n\n"; |
|
226 } |
|
227 |
|
228 sub build_user_selected { |
|
229 if($user_selection==0){ |
|
230 system("abld test reallyclean winscw udeb") if(!defined $param_noclean or !defined $param_nobuild); |
|
231 run_system_command("abld test build winscw udeb") if(!defined $param_nobuild); |
|
232 foreach my $subsystem (@makefiles){ |
|
233 get_dll_names($subsystem); |
|
234 get_source_files($subsystem)if($choice==1); |
|
235 } |
|
236 if($choice==1 or $choice==3){ |
|
237 print "\n\n *** Setting the CodeTest Options *** \n\n"; |
|
238 set_codetest_commands(); |
|
239 print "\n\n *** Building again with Instrumentation *** \n\n"; |
|
240 system("abld test reallyclean winscw udeb"); # better to clean before running codetest |
|
241 run_system_command("abld test build winscw udeb"); |
|
242 print "\n\n *** End of Building with Instrumentation *** \n\n"; |
|
243 print "\n\n *** UnSetting the CodeTest Options *** \n\n"; |
|
244 unset_codetest_commands(); |
|
245 } |
|
246 splice(@sourcefiles, 0, scalar @sourcefiles); # delete sourcefiles |
|
247 } |
|
248 elsif($user_selection=~/\+/){ |
|
249 for($count=substr($user_selection,0,1)-1;$count<@subsystems;$count++){ |
|
250 system("abld test reallyclean winscw udeb @subsystems[$count]")if(!defined $param_noclean or !defined $param_nobuild); |
|
251 run_system_command("abld test build winscw udeb @subsystems[$count]")if(!defined $param_nobuild); |
|
252 get_dll_names(@makefiles[$count]); |
|
253 if($choice==1 or $choice==3){ |
|
254 get_source_files(@makefiles[$count]); |
|
255 print "\n\n *** Setting the CodeTest Options *** \n\n"; |
|
256 set_codetest_commands(); |
|
257 print "\n\n *** Building again with Instrumentation *** \n\n"; |
|
258 system("abld test reallyclean winscw udeb @subsystems[$count]"); |
|
259 run_system_command("abld test build winscw udeb @subsystems[$count]"); |
|
260 print "\n\n *** End of Building with Instrumentation *** \n\n"; |
|
261 } |
|
262 print "\n\n *** UnSetting the CodeTest Options *** \n\n" if(!defined $param_nobuild); ; |
|
263 unset_codetest_commands() if(!defined $param_nobuild); |
|
264 splice(@sourcefiles, 0, scalar @sourcefiles); # delete sourcefiles |
|
265 } |
|
266 } |
|
267 elsif($user_selection=~/\-/) { |
|
268 for($count=0;$count<substr($user_selection,0,1);$count++) { |
|
269 system("abld test reallyclean winscw udeb @subsystems[$count]")if(!defined $param_noclean or !defined $param_nobuild); |
|
270 run_system_command("abld test build winscw udeb @subsystems[$count]")if(!defined $param_nobuild); |
|
271 get_dll_names(@makefiles[$count]); |
|
272 if($choice==1 or $choice==3){ |
|
273 get_source_files(@makefiles[$count]); |
|
274 print "\n\n *** Setting the CodeTest Options *** \n\n"; |
|
275 set_codetest_commands(); |
|
276 print "\n\n *** Building again with Instrumentation *** \n\n"; |
|
277 system("abld test reallyclean winscw udeb @subsystems[$count]"); |
|
278 run_system_command("abld test build winscw udeb @subsystems[$count]"); |
|
279 print "\n\n *** End of Building with Instrumentation *** \n\n"; |
|
280 } |
|
281 print "\n\n *** UnSetting the CodeTest Options *** \n\n" if(!defined $param_nobuild); |
|
282 unset_codetest_commands() if(!defined $param_nobuild); |
|
283 splice(@sourcefiles, 0, scalar @sourcefiles); # delete sourcefiles |
|
284 } |
|
285 } |
|
286 else { |
|
287 $count=0; |
|
288 while($count<length $user_selection) { |
|
289 my $str = substr ($user_selection,$count,1); |
|
290 system("abld test reallyclean winscw udeb @subsystems[$str-1]")if(!defined $param_noclean or !defined $param_nobuild); |
|
291 run_system_command("abld test build winscw udeb @subsystems[$str-1]")if(!defined $param_nobuild); |
|
292 get_dll_names(@makefiles[$str-1]); |
|
293 if($choice==1 or $choice==3){ |
|
294 get_source_files(@makefiles[$str-1]); |
|
295 print "\n\n *** Setting the CodeTest Options *** \n\n"; |
|
296 set_codetest_commands(); |
|
297 print "\n\n *** Building again with Instrumentation *** \n\n"; |
|
298 system("abld test reallyclean winscw udeb @subsystems[$str-1]"); |
|
299 run_system_command("abld test build winscw udeb @subsystems[$str-1]"); |
|
300 print "\n\n *** End of Building with Instrumentation *** \n\n"; |
|
301 } |
|
302 unset_codetest_commands(); |
|
303 print "\n\n *** UnSetting the CodeTest Options *** \n\n" ; |
|
304 splice(@sourcefiles, 0, scalar @sourcefiles); # delete sourcefiles |
|
305 $count++; |
|
306 } |
|
307 } |
|
308 } |
|
309 |
|
310 |
|
311 sub set_codetest_commands { |
|
312 if( !defined $param_nosdkinst) { |
|
313 print "\n*** Instrumenting SDK for CodeTest. ***\n"; |
|
314 print "\tIf you done this already for your SDK use -nosdkinst option.\n\n"; |
|
315 run_system_command("copy C:\\APPS\\ct\\cttarget\\rtos\\symbian\\Support\\native\\* $build_destination_dir\\"); |
|
316 run_system_command("copy C:\\APPS\\ct\\cttarget\\rtos\\symbian\\binaries\\SOS_9\\native\\winscw\\* $build_destination_dir\\"); |
|
317 run_system_command("instctsymb.cmd "." -v ".(split(/:/,$currentdir))[0].":\ SOS_9"); |
|
318 $param_nosdkinst = 1; |
|
319 } |
|
320 |
|
321 $ENV{'CODETEST_LIB'}= "NTmvc_TargetLibMD.lib ctsymbiannativemem.lib"; |
|
322 chomp(@sourcefiles); |
|
323 my $filename = join ",",@sourcefiles; |
|
324 $filename =" -CTonly-tag-files=".$filename; |
|
325 my $val="-CTsize_t=unsigned -CTtag-allocator -CTv -CTno-tag-includes -CTtag-level=DC".$filename." -CTidb=".$codetest_workspace; |
|
326 $ENV{'CTDRIVER_ARGS'}= $val; |
|
327 print "CTDRIVER_ARGS=".$ENV{'CTDRIVER_ARGS'}."\n"; |
|
328 } |
|
329 |
|
330 sub unset_codetest_commands { |
|
331 $ENV{'CODETEST_LIB'}= ""; |
|
332 $ENV{'CTDRIVER_ARGS'}= ""; |
|
333 } |
|
334 |
|
335 sub display_critical_error { |
|
336 print "\n->Error Occured : ".$?."\n" if(!@_[0]); |
|
337 print "\n->Error Occured : ".@_[0]."\n" if(@_[0]); |
|
338 exit 1; |
|
339 } |
|
340 |
|
341 sub run_system_command { |
|
342 system(@_[0]); |
|
343 display_critical_error() if($?!=0); |
|
344 } |
|
345 |
|
346 sub usage { |
|
347 print<<ENDOFUSAGE; |
|
348 Usage : |
|
349 eunitrunner -command=ct|eu|mm -dest=resultdir |
|
350 -ct -> To run Codetest. |
|
351 -eu -> To run EunitTestcases. |
|
352 -mm -> To run Manual Mode.Useful if you want to find the coverage inside your code. |
|
353 -resultdir->In where results will be copied. |
|
354 |
|
355 Also you can specify some optional flags to change the behaviour of the script. |
|
356 -all -> To run all subsystems. |
|
357 -sourcefiles -> To Select Source files for instrumentation |
|
358 -noclean -> Don't run reallyclean |
|
359 -nobuild -> Dont run symbian build commands |
|
360 -nostub -> Dont build stubs |
|
361 -nosdkinst-> Dont instrument sdk |
|
362 |
|
363 Some miscellaneous Commands |
|
364 -version -> Version Information. |
|
365 -help -> Usage information. |
|
366 |
|
367 Examples : |
|
368 eunitrunner -command=ct |
|
369 eunitrunner -command=eu C:/temp/results |
|
370 eunitrunner -command=eu C:/temp/results -all |
|
371 eunitrunner -command=ct C:/temp/results\ -sourcefiles -nobuild -noclean -nostub |
|
372 |
|
373 Note:This script should be run from where bld.inf file available |
|
374 Note:Also you must specify TEMP environmental variable.(By default this exists in All windows system) |
|
375 ENDOFUSAGE |
|
376 exit 0; |
|
377 } |
|
378 |
|
379 sub get_subsystems(){ |
|
380 open WHATCMD, "abld test makefile winscw -w |"; |
|
381 my @temparray; |
|
382 while(<WHATCMD>){ |
|
383 chomp; |
|
384 my $makeFile = $_; |
|
385 if( $makeFile =~ /winscw$/i ) { |
|
386 @temparray=split(/\./,$makeFile); |
|
387 @temparray=split(/\\/,@temparray[0]); |
|
388 push @subsystems,pop(@temparray); |
|
389 push @makefiles,$makeFile; |
|
390 } |
|
391 } |
|
392 close WHATCMD; |
|
393 } |
|
394 |
|
395 sub get_source_files($) { |
|
396 open MAKE, @_[0] or die "Cant open $!"; |
|
397 my @temparray; |
|
398 while (<MAKE>){ |
|
399 my($line)=$_; |
|
400 if($line=~/(EPOCBLDUREL).*.\.o.*.:.*.\.cpp/){ |
|
401 if($line!~/INTERNAL|internal/){ |
|
402 @temparray=split(/:/,$line); |
|
403 @temparray=split(/\\/,@temparray[1]); |
|
404 push @sourcefiles,pop @temparray; |
|
405 } |
|
406 } |
|
407 } |
|
408 close MAKE; |
|
409 } |
|
410 |
|
411 sub get_dll_names($){ |
|
412 open MAKE, @_[0] or die "Cant open $_ $!"; |
|
413 my @temparray; |
|
414 my $dll_name; |
|
415 while (<MAKE>){ |
|
416 my($line)=$_; |
|
417 chomp($line); |
|
418 if($line=~/Target.*.\.dll/) { |
|
419 @temparray=split(/\s+/,$line); |
|
420 $dll_name=pop @temparray; |
|
421 chomp($dll_name); |
|
422 push @dll_filenames,$dll_name; |
|
423 last; |
|
424 } |
|
425 } |
|
426 close MAKE; |
|
427 } |
|
428 |
|
429 sub print_html_report { |
|
430 my $simple = XML::Simple->new(); |
|
431 my($total)=0; |
|
432 my($pass_count)=0; |
|
433 my($fail_count)=0; |
|
434 my($passPercent)=0.00; |
|
435 my $struct = $simple->XMLin($eunit_xml_file, forcearray => 1,keyattr => []); |
|
436 open(HTML_FILE, ">$results_destinationdir/$unittest_result_file") || die "Can't open file: $!\n"; |
|
437 # Print initial HTML tags |
|
438 print HTML_FILE "<TABLE BORDER CELLSPACING=\"2\" CELLPADDING=\"2\" WIDTH=\"80%\">\n"; |
|
439 print HTML_FILE "<CAPTION><H3><P ALIGN=Left>Overall Result: Passed</H3></CAPTION>\n"; |
|
440 print HTML_FILE "<tr>\n"; |
|
441 print HTML_FILE "<th BGCOLOR=\"#CCCCCC\">Total TestCases</th>\n"; |
|
442 print HTML_FILE "<th BGCOLOR=\"#00FF00\">Total Passed</th>\n"; |
|
443 print HTML_FILE "<th BGCOLOR=\"#FF0000\">Total Failed</th>\n"; |
|
444 print HTML_FILE "</tr>\n"; |
|
445 print HTML_FILE "<tr>\n"; |
|
446 print HTML_FILE "<td><P ALIGN=Center> </td>\n"; |
|
447 print HTML_FILE "<td><P ALIGN=Center> </td>\n"; |
|
448 print HTML_FILE "<td><P ALIGN=Center> </td>\n"; |
|
449 print HTML_FILE "</tr>\n"; |
|
450 print HTML_FILE "</table>\n"; |
|
451 print HTML_FILE " <BR>"; |
|
452 |
|
453 foreach my $dll(@{$struct->{dll}}){ |
|
454 foreach my $mtestsuite(@{$dll->{testsuite}}){ |
|
455 #if($mtestsuite->{name} eq "Wizard generated"){ |
|
456 # next; |
|
457 # } |
|
458 foreach my $testsuite(@{$mtestsuite->{testsuite}}){ |
|
459 my($testcount)=1; |
|
460 print HTML_FILE "<TABLE BORDER CELLSPACING=\"2\" CELLPADDING=\"2\" WIDTH=\"80%\">\n"; |
|
461 print HTML_FILE "<CAPTION><H3><P ALIGN=Left>$testsuite->{name}</H3></CAPTION>\n"; |
|
462 print HTML_FILE "<tr>\n"; |
|
463 print HTML_FILE "<th>No</th>\n"; |
|
464 print HTML_FILE "<th>Name</th>\n"; |
|
465 print HTML_FILE "<th>Class</th>\n"; |
|
466 print HTML_FILE "<th>Method</th>\n"; |
|
467 print HTML_FILE "<th>Type</th>\n"; |
|
468 print HTML_FILE "<th>Result</th>\n"; |
|
469 print HTML_FILE "</tr>\n"; |
|
470 foreach my $testcase(@{$testsuite->{testcase}}){ |
|
471 print HTML_FILE "<tr>\n"; |
|
472 print HTML_FILE "<td BGCOLOR=\"#CCCCCC\"><P ALIGN=Left>$testcount</td>\n"; |
|
473 print HTML_FILE "<td BGCOLOR=\"#CCCCCC\"><P ALIGN=Left>$testcase->{name}</td>\n"; |
|
474 print HTML_FILE "<td BGCOLOR=\"#CCCCCC\"><P ALIGN=left>$testcase->{class}</td>\n"; |
|
475 print HTML_FILE "<td BGCOLOR=\"#CCCCCC\"><P ALIGN=Left>$testcase->{method}</td>\n"; |
|
476 print HTML_FILE "<td BGCOLOR=\"#CCCCCC\"><P ALIGN=Left>$testcase->{type}</td>\n"; |
|
477 if($testcase->{result}->[0]->{status} eq "OK"){ |
|
478 print HTML_FILE "<TD BGCOLOR=\"#00FF00\"><P ALIGN=Left>PASS</TD>\n"; |
|
479 $pass_count++; |
|
480 } |
|
481 else{ |
|
482 print HTML_FILE "<TD BGCOLOR=\"#FF0000\"><P ALIGN=Left>FAIL</TD>\n"; |
|
483 $fail_count++; |
|
484 } |
|
485 print HTML_FILE "</tr>\n"; |
|
486 $testcount++; |
|
487 } |
|
488 print HTML_FILE "</table>\n"; |
|
489 print HTML_FILE "<BR>\n"; |
|
490 } |
|
491 } |
|
492 } |
|
493 |
|
494 # Print ending HTML tags |
|
495 print HTML_FILE "</body><br></html>"; |
|
496 $total=$fail_count+$pass_count; |
|
497 seek HTML_FILE,301,0; |
|
498 print HTML_FILE "$total"; |
|
499 seek HTML_FILE,334,0; |
|
500 print HTML_FILE "$pass_count"; |
|
501 seek HTML_FILE,367,0; |
|
502 print HTML_FILE "$fail_count"; |
|
503 if($pass_count>0 && $total>0){ |
|
504 $passPercent=sprintf "%.2f", (($pass_count/$total)*100); |
|
505 } |
|
506 else{ |
|
507 $passPercent=sprintf "%.2f","0.00"; |
|
508 } |
|
509 seek HTML_FILE,103,0; |
|
510 print HTML_FILE "$passPercent%"; |
|
511 close (HTML_FILE); # Close html |
|
512 } |
|
513 |
|
514 __END__ |
|
515 |
|
516 :invoke_perl |
|
517 @perl -x -S EunitRunner.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 |
|