Merge "Stop CreateSolidActor from creating an RGBA BufferImage when it isn't needed...
[platform/core/uifw/dali-toolkit.git] / automated-tests / scripts / summarize.pl
1 #!/usr/bin/perl
2
3 use strict;
4 use XML::Parser;
5 use Encode;
6 use Getopt::Long;
7 use Cwd;
8
9 my $pwd = getcwd;
10 my $num_tests=0;
11 my $num_passes=0;
12 my $num_actual_passes=0;
13 my $text = "";
14
15 sub handle_start
16 {
17     my ($p, $elt, %attrs) = @_;
18
19     if($elt =~ /testcase/)
20     {
21         $num_tests++;
22         if($attrs{"result"} eq "PASS")
23         {
24             $num_passes++;
25         }
26     }
27     if($elt =~ /actual_result/)
28     {
29         $text = "";
30     }
31 }
32
33 sub handle_end
34 {
35   my ($p, $elt) = @_;
36   if($elt =~ /actual_result/)
37   {
38       if($text eq "PASS")
39       {
40           $num_actual_passes++;
41       }
42       $text = "";
43   }
44 }
45
46 sub handle_char
47 {
48   my ($p, $str) = @_;
49   $text .= $str;
50 }
51
52 my($parser) = new XML::Parser(Handlers => {Start => \&handle_start,
53                                            End   => \&handle_end,
54                                            Char  => \&handle_char});
55
56
57 # Write summary.xml:
58 open SUMMARY, ">summary.xml" || die "Can't open summary.xml for writing:$!\n";
59 print SUMMARY << "EOS";
60 <?xml version="1.0" encoding="UTF-8"?>
61 <?xml-stylesheet type="text/xsl" href="./style/summary.xsl"?>
62 <result_summary plan_name="Core">
63   <other xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string" />
64   <summary test_plan_name="Empty test_plan_name">
65     <start_at>2014-03-21_18_52_41</start_at>
66     <end_at>2014-03-21_18_57_54</end_at>
67   </summary>
68 EOS
69
70 print "\n\nSummary of all tests:\n";
71 my $output_files = `ls tct*core-tests.xml`;
72 my $file;
73 foreach $file (split /\s+/, $output_files )
74 {
75     $num_tests=0;
76     $num_passes=0;
77     $num_actual_passes=0;
78     $text = "";
79
80     $parser->parsefile($file);
81
82     my $pass_rate = sprintf("%5.2f", $num_passes * 100.0 / $num_tests);
83     my $num_fails = $num_tests - $num_passes;
84     my $fail_rate = sprintf("%5.2f", $num_fails * 100.0 / $num_tests);
85
86     my $suite_name = $file;
87     $suite_name =~ s/\.xml$//;
88
89     print "$suite_name: $num_passes tests passed out of $num_tests ( $pass_rate% )\n";
90
91 print SUMMARY << "EOS2";
92   <suite name="$suite_name">
93     <total_case>$num_tests</total_case>
94     <pass_case>$num_passes</pass_case>
95     <pass_rate>$pass_rate</pass_rate>
96     <fail_case>$num_fails</fail_case>
97     <fail_rate>$fail_rate</fail_rate>
98     <block_case>0</block_case>
99     <block_rate>0.00</block_rate>
100     <na_case>0</na_case>
101     <na_rate>0.00</na_rate>
102   </suite>
103 EOS2
104 }
105
106 print SUMMARY "</result_summary>\n";
107 close SUMMARY;
108
109 print "Summary of results written to summary.xml\n";