author | Shabe Razvi <shaber@symbian.org> |
Tue, 01 Jun 2010 17:25:25 +0100 | |
changeset 1052 | 401ecaf0a844 |
parent 1040 | f1f85b34a96f |
child 1090 | 46b3578a07ad |
permissions | -rw-r--r-- |
1040
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
1 |
#!/usr/bin/perl |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
2 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
3 |
# Copyright (c) 2009 Symbian Foundation Ltd |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
4 |
# This component and the accompanying materials are made available |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
5 |
# under the terms of the License "Eclipse Public License v1.0" |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
6 |
# which accompanies this distribution, and is available |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
7 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
8 |
# |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
9 |
# Initial Contributors: |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
10 |
# Symbian Foundation Ltd - initial contribution. |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
11 |
# Maciej Seroka, maciejs@symbian.org |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
12 |
# |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
13 |
# Description: |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
14 |
# This is a tool for updating BRAG status with test results. |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
15 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
16 |
use strict; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
17 |
use Getopt::Long; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
18 |
use XML::Simple; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
19 |
use Tie::File; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
20 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
21 |
my $brag_file; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
22 |
my $ats_report; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
23 |
my $test_report; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
24 |
my $help; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
25 |
my $line; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
26 |
my $auto_tests_total; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
27 |
my $auto_tests_passed; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
28 |
my $auto_tests_failed; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
29 |
my $auto_tests_notrun; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
30 |
my $man_tests_total; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
31 |
my $man_tests_passed; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
32 |
my $man_tests_failed; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
33 |
my $man_tests_notrun; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
34 |
my $temp_path; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
35 |
my $detailshref; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
36 |
my $xml_report; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
37 |
my $test_case; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
38 |
my $test_brag_xml; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
39 |
my $existing_results; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
40 |
my $n; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
41 |
my $m; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
42 |
my @lines; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
43 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
44 |
sub usage($); |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
45 |
sub help(); |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
46 |
sub usage_error(); |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
47 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
48 |
my %optmap = ( 'brag-file' => \$brag_file, |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
49 |
'ats-report' => \$ats_report, |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
50 |
'test-report' => \$test_report, |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
51 |
'help' => \$help); |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
52 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
53 |
GetOptions(\%optmap, |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
54 |
'brag-file=s', |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
55 |
'ats-report=s', |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
56 |
'test-report=s', |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
57 |
'help!') |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
58 |
or usage_error(); |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
59 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
60 |
if ($help) { |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
61 |
help(); |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
62 |
} |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
63 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
64 |
# --brag-file is mandatory. |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
65 |
usage_error(), unless (defined($brag_file)); |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
66 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
67 |
# --ats-report is mandatory. |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
68 |
usage_error(), unless (defined($ats_report)); |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
69 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
70 |
open (FILE, "<$ats_report") or die ("Couldn't open $ats_report for reading: $!\n"); |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
71 |
my $read_flag = -1; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
72 |
print "Reading $ats_report... "; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
73 |
while ($line = <FILE>) { |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
74 |
chomp $line; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
75 |
if ($read_flag >= 0) { $read_flag++ } |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
76 |
if ($read_flag == 1) { # Get Total number of tests. |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
77 |
$auto_tests_total = $line; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
78 |
# Remove td tags. |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
79 |
$auto_tests_total =~ s/^.*\">//; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
80 |
$auto_tests_total =~ s/<.*//; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
81 |
} |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
82 |
if ($read_flag == 4) { # Get number of Passed tests. |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
83 |
($auto_tests_passed) = split /\//,$line; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
84 |
$auto_tests_passed =~ s/^.*\">//; # Remove opening td tag. |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
85 |
} |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
86 |
if ($read_flag == 5) { # Get number of Failed tests. |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
87 |
($auto_tests_failed) = split /\//,$line; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
88 |
$auto_tests_failed =~ s/^.*\">//; # Remove opening td tag. |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
89 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
90 |
} |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
91 |
if ($read_flag == 7) { # Get number of Not run tests. |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
92 |
($auto_tests_notrun) = split /\//,$line; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
93 |
$auto_tests_notrun =~ s/^.*\">//; # Remove opening td tag. |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
94 |
} |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
95 |
if ($line eq "<td class=\"tableData\">Nested tests<\/td>") { # Set flag for reading results. |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
96 |
$read_flag = 0; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
97 |
} |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
98 |
if (($line eq "<\/tr>") && ($read_flag >= 0)) { # Exit loop. |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
99 |
last; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
100 |
}; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
101 |
} |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
102 |
close FILE; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
103 |
print "complete\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
104 |
print "Total number of tests: $auto_tests_total\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
105 |
print "Passed tests: $auto_tests_passed\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
106 |
print "Failed tests: $auto_tests_failed\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
107 |
print "Not run tests: $auto_tests_notrun\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
108 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
109 |
# Define detailshref attribute. |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
110 |
$temp_path = $brag_file; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
111 |
$temp_path =~ s/\\/\//g; # Replace \ with / |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
112 |
$temp_path =~ s/\/summary\/.*//; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
113 |
$detailshref = $ats_report; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
114 |
$detailshref =~ s/\\/\//g; # Replace \ with / |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
115 |
$detailshref =~ s/($temp_path)/../; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
116 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
117 |
if (defined($test_report)) { # Get manual Smoketest results. |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
118 |
print "Parsing " . $test_report . "... "; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
119 |
$xml_report = XMLin("$test_report", keeproot => 1, forcearray => [ 'test-set', 'test-case' ], keyattr => [] ); |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
120 |
print "complete \n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
121 |
$man_tests_total = 0; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
122 |
$man_tests_passed = 0; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
123 |
$man_tests_failed = 0; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
124 |
$man_tests_notrun = 0; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
125 |
foreach $test_case (@{$xml_report->{'test-report'}->{'test-set'}->[0]->{'test-case'}}) { |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
126 |
if (lc($test_case->{'result'}) eq "passed") { $man_tests_passed++ } |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
127 |
if (lc($test_case->{'result'}) eq "failed") { $man_tests_failed++ } |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
128 |
if (lc($test_case->{'result'}) eq "not run") { $man_tests_notrun++ } |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
129 |
$man_tests_total++; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
130 |
} |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
131 |
print "Total number of tests: $man_tests_total\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
132 |
print "Passed tests: $man_tests_passed\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
133 |
print "Failed tests: $man_tests_failed\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
134 |
print "Not run tests: $man_tests_notrun\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
135 |
} |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
136 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
137 |
# Check for Smoketest results in BRAG file. |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
138 |
open (FILE, "<$brag_file") or die ("Couldn't open $brag_file for reading: $!\n"); |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
139 |
$existing_results = 0; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
140 |
$n = 0; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
141 |
while ($line = <FILE>) |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
142 |
{ |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
143 |
chomp $line; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
144 |
if ($line =~ "<phase name=\"Test\">") { |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
145 |
$existing_results = 1; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
146 |
last; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
147 |
} |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
148 |
$n++; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
149 |
} |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
150 |
close FILE; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
151 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
152 |
tie @lines, 'Tie::File', $brag_file or die ("Couldn't tie file $brag_file: $!\n"); |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
153 |
if ($existing_results) { # Delete existing Test Results from BRAG file. |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
154 |
$m = 0; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
155 |
do { |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
156 |
$m++; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
157 |
} while (@lines[$n+$m] !~ "<\/phase>"); |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
158 |
splice @lines, $n, $m+1; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
159 |
} |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
160 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
161 |
# Insert (New) Test Results to BRAG file. |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
162 |
$n = 0; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
163 |
foreach ( @lines ) |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
164 |
{ |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
165 |
if (lc(@lines[$n]) =~ "<\/buildstatus>") { |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
166 |
last; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
167 |
} |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
168 |
$n++; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
169 |
} |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
170 |
splice @lines, $n, 0, "<phase name=\"Test\">"; $n++; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
171 |
splice @lines, $n, 0, "<step detailshref=\"$detailshref\" name=\"Smoketest - automated tests\">"; $n++; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
172 |
splice @lines, $n, 0, "<nestedtests count=\"$auto_tests_total\" property=\"total\"/>"; $n++; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
173 |
splice @lines, $n, 0, "<nestedtests count=\"$auto_tests_passed\" property=\"passed\"/>"; $n++; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
174 |
splice @lines, $n, 0, "<nestedtests count=\"$auto_tests_failed\" property=\"failed\"/>"; $n++; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
175 |
splice @lines, $n, 0, "<nestedtests count=\"$auto_tests_notrun\" property=\"not run\"/>"; $n++; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
176 |
splice @lines, $n, 0, "<\/step>"; $n++; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
177 |
if (defined($test_report)) { |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
178 |
splice @lines, $n, 0, "<step name=\"Smoketest - manual tests\">"; $n++; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
179 |
splice @lines, $n, 0, "<nestedtests count=\"$man_tests_total\" property=\"total\"/>"; $n++; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
180 |
splice @lines, $n, 0, "<nestedtests count=\"$man_tests_passed\" property=\"passed\"/>"; $n++; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
181 |
splice @lines, $n, 0, "<nestedtests count=\"$man_tests_failed\" property=\"failed\"/>"; $n++; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
182 |
splice @lines, $n, 0, "<nestedtests count=\"$man_tests_notrun\" property=\"not run\"/>"; $n++; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
183 |
splice @lines, $n, 0, "<\/step>"; $n++; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
184 |
} |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
185 |
splice @lines, $n, 0, "<\/phase>"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
186 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
187 |
untie @lines; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
188 |
print "$brag_file updated\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
189 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
190 |
# Create Test_BRAG.xml |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
191 |
$test_brag_xml = $temp_path . "\/summary\/" . "Test_BRAG.xml"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
192 |
if (-e $test_brag_xml) { # Delete the file if exists. |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
193 |
unlink($test_brag_xml); |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
194 |
print "$test_brag_xml deleted\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
195 |
} |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
196 |
open (FILE, "> $test_brag_xml") or die ("Couldn't open $test_brag_xml for writing: $!\n"); |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
197 |
print FILE "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
198 |
print FILE "<?xml-stylesheet type='text/xsl' href='brag.xsl'?>\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
199 |
print FILE "<buildStatus>\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
200 |
print FILE "<phase name=\"Test\">\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
201 |
print FILE "<step detailshref=\"$detailshref\" name=\"Smoketest - automated tests\">\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
202 |
print FILE "<nestedtests count=\"$auto_tests_total\" property=\"total\"/>\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
203 |
print FILE "<nestedtests count=\"$auto_tests_passed\" property=\"passed\"/>\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
204 |
print FILE "<nestedtests count=\"$auto_tests_failed\" property=\"failed\"/>\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
205 |
print FILE "<nestedtests count=\"$auto_tests_notrun\" property=\"not run\"/>\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
206 |
print FILE "<\/step>\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
207 |
if (defined($test_report)) { |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
208 |
print FILE "<step name=\"Smoketest - manual tests\">\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
209 |
print FILE "<nestedtests count=\"$man_tests_total\" property=\"total\"/>\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
210 |
print FILE "<nestedtests count=\"$man_tests_passed\" property=\"passed\"/>\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
211 |
print FILE "<nestedtests count=\"$man_tests_failed\" property=\"failed\"/>\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
212 |
print FILE "<nestedtests count=\"$man_tests_notrun\" property=\"not run\"/>\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
213 |
print FILE "<\/step>\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
214 |
} |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
215 |
print FILE "<\/phase>\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
216 |
print FILE "</buildStatus>\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
217 |
close FILE; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
218 |
print "$test_brag_xml saved\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
219 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
220 |
exit 0; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
221 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
222 |
sub usage($) |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
223 |
{ |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
224 |
my $error = shift; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
225 |
my $fh = $error == 0 ? *STDOUT : *STDERR; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
226 |
print $fh "update_brag_status.pl\n" . |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
227 |
"Specify the BRAG xml file and ATS report\n" . |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
228 |
"synopsis:\n" . |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
229 |
" update_brag_status.pl --help\n" . |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
230 |
" update_brag_status.pl [--brag-file=XML_FILE] [--ats-report=HTML_REPORT] [--test-report=XML_REPORT] \n" . |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
231 |
"options:\n" . |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
232 |
" --help Display this help and exit.\n" . |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
233 |
" --brag-file=XML_FILE XML_FILE is the full path to the file containing BRAG summary.\n" . |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
234 |
" --ats-report=HTML_REPORT HTML_REPORT is the full path to the ATS report.\n" . |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
235 |
" --test-report=XML_REPORT XML_REPORT is the name of the test report for manually executed tests.\n" . |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
236 |
" If not specified only automated tests results will be taken into account.\n"; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
237 |
exit $error; |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
238 |
} |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
239 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
240 |
sub help() |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
241 |
{ |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
242 |
usage(0); |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
243 |
} |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
244 |
|
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
245 |
sub usage_error() |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
246 |
{ |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
247 |
usage(1); |
f1f85b34a96f
Added script for updating BRAG status with test results
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
248 |
} |