author | Dario Sestito <darios@symbian.org> |
Mon, 12 Jul 2010 12:02:01 +0100 | |
changeset 1163 | b60154bd7ef7 |
parent 850 | 0e8b8d588322 |
permissions | -rw-r--r-- |
844
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
1 |
#!/usr/bin/perl |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
2 |
|
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
3 |
# Copyright (c) 2009 Symbian Foundation Ltd |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
4 |
# This component and the accompanying materials are made available |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
5 |
# under the terms of the License "Eclipse Public License v1.0" |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
6 |
# which accompanies this distribution, and is available |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
7 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
8 |
# |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
9 |
# Initial Contributors: |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
10 |
# Symbian Foundation Ltd - initial contribution. |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
11 |
# Maciej Seroka, maciej@symbian.org |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
12 |
# |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
13 |
# Description: |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
14 |
# This is a tool for generating the top-level index for BC test reports. |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
15 |
|
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
16 |
use strict; |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
17 |
use File::Copy; |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
18 |
use Tie::File; |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
19 |
use File::Find; |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
20 |
|
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
21 |
my @files; |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
22 |
my @lines; |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
23 |
sub Wanted; |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
24 |
|
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
25 |
my $path; |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
26 |
if ($ARGV[0]) { |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
27 |
$path = $ARGV[0]; |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
28 |
} |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
29 |
else { die "Missing parameter \"path\". For example: //v800020/Publish/SF_builds/symbian2/builds/default/symbian2_default.sf-test-bc-check.PDK_2.0.1.51/ats_reports"; } |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
30 |
|
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
31 |
find(\&Wanted, $path); |
850
0e8b8d588322
Fixed ats_generate_index.pl to not include the link to Smoke Test Report
Maciej Seroka <maciejs@symbian.org>
parents:
844
diff
changeset
|
32 |
|
0e8b8d588322
Fixed ats_generate_index.pl to not include the link to Smoke Test Report
Maciej Seroka <maciejs@symbian.org>
parents:
844
diff
changeset
|
33 |
#Find and delete the link to Smoke Test Report |
844
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
34 |
my $n = 0; |
850
0e8b8d588322
Fixed ats_generate_index.pl to not include the link to Smoke Test Report
Maciej Seroka <maciejs@symbian.org>
parents:
844
diff
changeset
|
35 |
my $item_to_find = $path . "/ATS3Report.html"; |
0e8b8d588322
Fixed ats_generate_index.pl to not include the link to Smoke Test Report
Maciej Seroka <maciejs@symbian.org>
parents:
844
diff
changeset
|
36 |
foreach (@files) { |
0e8b8d588322
Fixed ats_generate_index.pl to not include the link to Smoke Test Report
Maciej Seroka <maciejs@symbian.org>
parents:
844
diff
changeset
|
37 |
if (@files[$n] eq $item_to_find) { splice @files, $n, 1; } |
0e8b8d588322
Fixed ats_generate_index.pl to not include the link to Smoke Test Report
Maciej Seroka <maciejs@symbian.org>
parents:
844
diff
changeset
|
38 |
$n++; |
0e8b8d588322
Fixed ats_generate_index.pl to not include the link to Smoke Test Report
Maciej Seroka <maciejs@symbian.org>
parents:
844
diff
changeset
|
39 |
} |
0e8b8d588322
Fixed ats_generate_index.pl to not include the link to Smoke Test Report
Maciej Seroka <maciejs@symbian.org>
parents:
844
diff
changeset
|
40 |
|
0e8b8d588322
Fixed ats_generate_index.pl to not include the link to Smoke Test Report
Maciej Seroka <maciejs@symbian.org>
parents:
844
diff
changeset
|
41 |
$n = 0; |
844
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
42 |
foreach (@files) { #Replace "//v800020/Publish" with "http://cdn.symbian,org" |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
43 |
@files[$n] =~ s/\/\/v800020\/Publish/http:\/\/cdn.symbian.org/; |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
44 |
$n++; |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
45 |
} |
850
0e8b8d588322
Fixed ats_generate_index.pl to not include the link to Smoke Test Report
Maciej Seroka <maciejs@symbian.org>
parents:
844
diff
changeset
|
46 |
|
844
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
47 |
#Copy template and insert links |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
48 |
copy("report_template.html","index.html") or die ("Cannot copy file \"report_template.html\". $!\n"); |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
49 |
tie @lines, 'Tie::File', "index.html" or die ("Cannot tie file \"index.html\". $!\n"); |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
50 |
my $current_line = 0; |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
51 |
for (@lines) { |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
52 |
if (/<!-- Insert reports here -->/) { |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
53 |
my $i = 0; |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
54 |
foreach (@files) { |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
55 |
splice @lines, $current_line+$i+1, 0, "<tr class=\"tableData\"><td align=\"center\">" . ($i+1) . "</td>" . "<td align=\"left\"><a href=\"" . @files[$i] . "\">" . @files[$i] . "</a></td></tr>"; |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
56 |
$i++; |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
57 |
} |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
58 |
last; |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
59 |
} |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
60 |
$current_line++; |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
61 |
} |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
62 |
untie @lines; |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
63 |
print @{files} . " link(s) added.\n"; |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
64 |
#copy index |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
65 |
copy("index.html","$path/index.html") or die ("Cannot copy file \"index.html\" to $path. $!\n"); |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
66 |
|
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
67 |
sub Wanted { |
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
68 |
# only operate on ATS3Report.html files |
850
0e8b8d588322
Fixed ats_generate_index.pl to not include the link to Smoke Test Report
Maciej Seroka <maciejs@symbian.org>
parents:
844
diff
changeset
|
69 |
/ATS3Report.html/ or return; |
0e8b8d588322
Fixed ats_generate_index.pl to not include the link to Smoke Test Report
Maciej Seroka <maciejs@symbian.org>
parents:
844
diff
changeset
|
70 |
push (@files, $File::Find::name); |
844
385ad61f2ab3
Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff
changeset
|
71 |
} |