common/tools/ats/ats_generate_index.pl
author Maciej Seroka <maciejs@symbian.org>
Fri, 15 Jan 2010 09:46:07 +0000
changeset 845 61bf41df2efd
parent 844 385ad61f2ab3
child 850 0e8b8d588322
permissions -rw-r--r--
Added new property for publishing Smoke Test Report
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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);
385ad61f2ab3 Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    32
my $n = 0;
385ad61f2ab3 Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    33
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
    34
	@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
    35
	$n++;
385ad61f2ab3 Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    36
}
385ad61f2ab3 Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    37
#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
    38
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
    39
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
    40
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
    41
for (@lines) {
385ad61f2ab3 Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    42
	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
    43
		my $i = 0;
385ad61f2ab3 Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    44
		foreach (@files) {
385ad61f2ab3 Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    45
			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
    46
			$i++;
385ad61f2ab3 Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    47
		}
385ad61f2ab3 Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    48
		last;
385ad61f2ab3 Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    49
	}
385ad61f2ab3 Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    50
	$current_line++;
385ad61f2ab3 Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    51
}
385ad61f2ab3 Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    52
untie @lines;
385ad61f2ab3 Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    53
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
    54
#copy index
385ad61f2ab3 Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    55
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
    56
385ad61f2ab3 Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    57
sub Wanted {
385ad61f2ab3 Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    58
    # only operate on ATS3Report.html files
385ad61f2ab3 Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    59
    /ATS3Report.html/ or return;	
385ad61f2ab3 Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    60
	push (@files, $File::Find::name);
385ad61f2ab3 Added tool for generating the top-level index for BC test reports
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    61
}