common/tools/ats/smoketest/SmokeTestROM.pm
author Simon Howkins <simonh@symbian.org>
Tue, 04 Aug 2009 12:20:40 +0100
changeset 330 f2e8947e085a
parent 117 483f966c6335
child 872 17498133d9ad
permissions -rw-r--r--
Added invokation to build.xml and adjusted path to backup locations to match my development environment.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
117
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
     1
# Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
     2
# All rights reserved.
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
     3
# This component and the accompanying materials are made available
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
     4
# under the terms of the License "Symbian Foundation License v1.0"
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
     5
# which accompanies this distribution, and is available
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
     6
# at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
     7
#
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
     8
# Initial Contributors:
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
     9
# Nokia Corporation - initial contribution.
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    10
#
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    11
# Contributors:
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    12
#
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    13
# Description:
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    14
# The SmokeTestROM package contains all the subroutines needed to build a ROM for
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    15
# automated smoke testing.
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    16
# This script was born on 18/04/2005
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    17
# Revision number 1: 11/08/2005
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    18
# 
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    19
#
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    20
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    21
#!/usr/bin/perl -w
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    22
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    23
package SmokeTestROM;
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    24
use strict;
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    25
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    26
# Define Core IMAGE file name as created by rombuild
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    27
my $coreImage = "*techview.nand.img";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    28
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    29
# Define the target filename for the Core ROM
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    30
my $newCoreImage = "core.img";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    31
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    32
# Define ROFS IMAGE file name as created by rombuild
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    33
my $ROFSImage = "*techview.nand.rofs.img";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    34
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    35
# Define the target file name for the ROFS ROM
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    36
my $newROFSImage = "rofs1.img";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    37
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    38
# Define NAND image file name.
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    39
my $nandImage = "*ARMV5.IMG";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    40
#
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    41
# CR 0844 (Both H2 and H4 use -D_NAND2)
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    42
# PrepareNANDROM  - subroutine to create the NAND ROM for smoke testing; zero arguments
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    43
# USAGE: PrepareNANDROM("h2"); 
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    44
# USAGE: PrepareNANDROM("h4hrp"); 
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    45
#
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    46
sub PrepareNANDROM
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    47
{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    48
	my ($arg) = @_; # Grab the first and only argument
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    49
	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    50
	# Change dir to NAND Loader directory
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    51
	chdir "$SmokeTest::NandDir" or &SmokeTest::DieLog("Can't cd to $SmokeTest::NandDir");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    52
	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    53
	if(lc($arg) eq "h2") # Here we are in the H2 NAND case
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    54
	{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    55
		# Run the rom command to create the image ... H2 also to use -D_NAND2
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    56
		SmokeTest::ExecCommand ("rom -v=h2 -i=armv5 -t=nandtest_load_noext -d=_NAND2 -b=urel");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    57
	}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    58
	elsif(lc($arg) eq "h4hrp") # Here we are in the H4 NAND case
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    59
	{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    60
		SmokeTest::ExecCommand ("rom -v=h4hrp -i=armv5 -t=nandtest_load_noext -d=_NAND2 -b=urel");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    61
	}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    62
	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    63
	# Change directory to Smoketest directory
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    64
	chdir "$SmokeTest::SmokeTestDir" or &SmokeTest::DieLog("Can't cd to $SmokeTest::SmokeTestDir");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    65
	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    66
	# Get the filename of the NAND image file
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    67
	my @NANDname = glob("$SmokeTest::NandDir\\$nandImage");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    68
	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    69
	# There should be exactly one file matching $nandImage. If not give warning.
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    70
	if(@NANDname != 1)
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    71
	{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    72
		print "PrepareNANDROM: warning: " . scalar(@NANDname) . " files matching $nandImage in $SmokeTest::NandDir\\: [@NANDname].\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    73
	}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    74
	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    75
	# Attempt to delete any files already in this directory left over from previous runs
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    76
	print "PrepareNANDROM: attempting to delete any debris from the last run:\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    77
	SmokeTest::ExecCommand ("DEL /Q $nandImage");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    78
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    79
	for my $filename(@NANDname)
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    80
	{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    81
		if((lc($arg) eq "h2") && ($filename =~ /h2/i)) # This is the H2 NAND case, so copy H2 image
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    82
		{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    83
			# Copy $nandImage to the current working directory
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    84
			print "PrepareNANDROM: copying $filename to .\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    85
			SmokeTest::ExecCommand ("COPY $filename");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    86
		}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    87
		elsif((lc($arg) eq "h4hrp") && ($filename =~ /h4hrp/i)) # This is the H4 NAND case, so copy H4 image
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    88
		{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    89
			# Copy $nandImage to the current working directory
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    90
			print "PrepareNANDROM: copying $filename to .\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    91
			SmokeTest::ExecCommand ("COPY $filename");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    92
		}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    93
	}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    94
}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    95
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    96
#
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    97
# CR 0844 (Both H2 and H4 use -D_NAND2)
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    98
# CreateAndZipROM creates the various ROMS; up to 5 arguments.
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
    99
# Usage:
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   100
# CreateAndZipROM("ARMV5", "lubbock", "-DRVCT", "PlatSec");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   101
# CreateAndZipROM("ARMV5", "h2", "-DRVCT", "PlatSec");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   102
# CreateAndZipROM("ARMV5", "h2", "-DRVCT", "PlatSec", "-D_NAND2");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   103
# CreateAndZipROM("ARMV5", "h4hrp", "-DRVCT", "PlatSec", "-D_NAND2");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   104
#
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   105
sub CreateAndZipROM
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   106
{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   107
	my @args = @_; # Array to hold the arguments
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   108
	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   109
	# This sixth argument $args[5] determines whether to build the NAND version
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   110
	# of the ROM or not. Set it equal to the empty string if the argument
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   111
	# isn't defined otherwise it should equal the argument
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   112
	my $nandROM;
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   113
	if(defined $args[5])
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   114
	{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   115
		if($args[5] =~  /-D_NAND/)
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   116
		{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   117
			$nandROM = $args[5];
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   118
		}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   119
		else
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   120
		{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   121
			die "Invalid final argument in CreateAndZipROM. Exiting.\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   122
		}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   123
	}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   124
	else
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   125
	{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   126
		$nandROM = "";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   127
	}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   128
	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   129
	print "\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   130
	# 
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   131
	# Build ROM with STAT run automatically
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   132
	#
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   133
	print "\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   134
	print "#\n# Build $args[0] $args[1] ROM with STAT run automatically\n#\n"; 
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   135
	print "\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   136
	SmokeTest::PrintDateTime();
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   137
	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   138
	my $eabi = "";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   139
	if ($args[0] eq "ARMV5")
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   140
	{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   141
		$eabi = "-D_EABI=$args[0]";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   142
	}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   143
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   144
    my ($iProductNum,$buildrom);
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   145
	$iProductNum = $args[4];
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   146
	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   147
	if ($iProductNum eq 'Future' || $iProductNum  >= 9.5)
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   148
	{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   149
####????DavidZjang#$buildrom = SmokeTest::ExecCommand ("buildrom -D_STARTUPMODE2 -D_EABI=ARMV5 -fm=\\epoc32\\rom\\include\\featuredatabase.xml h4hrp techview statauto.iby -osys$rom.bin");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   150
####????MCL########$buildrom = SmokeTest::ExecCommand ("buildrom -D_STARTUPMODE2 $eabi -fm=\\epoc32\\rom\\include\\featuredatabase.XML GTC_Standard statauto.iby testconfigfileparser.iby");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   151
	    $buildrom = SmokeTest::ExecCommand ("buildrom -D_STARTUPMODE2 $eabi -fm=\\epoc32\\rom\\include\\featuredatabase.XML GTC_Standard statauto.iby testconfigfileparser.iby");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   152
	}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   153
	else
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   154
	{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   155
	    $buildrom = SmokeTest::ExecCommand ("buildrom -D_STARTUPMODE2 $eabi -fr=\\epoc32\\rom\\include\\featureUIDs.XML GTC_Standard statauto.iby testconfigfileparser.iby");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   156
	}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   157
	print $buildrom;
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   158
	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   159
	if ( ($buildrom =~ m/rombuild.*failed/i) )
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   160
	{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   161
		print "\n*** Error In Smoke Test ***\n Building the ROM failed\n$!\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   162
		#&SmokeTest::DieLog("Error In Smoke Test: Building the ROM failed");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   163
	} 
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   164
	else 
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   165
	{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   166
		print "\n*** ROM built successfully ***\n";	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   167
	}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   168
	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   169
	if ($nandROM =~ /-D_NAND/)
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   170
	{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   171
		# Need to rename each on individually as there are several files ending in ".img"
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   172
		print "\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   173
		print "#\n# Renaming NAND ROMs\n#\n"; 
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   174
		print "\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   175
		SmokeTest::ExecCommand ("MOVE /Y $ROFSImage $newROFSImage");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   176
		SmokeTest::ExecCommand ("MOVE /Y $coreImage $newCoreImage");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   177
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   178
		# Copy each of the image files to the \epoc32\rom directory
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   179
		print "\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   180
		print "#\n# Copying NAND ROMs\n#\n"; 
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   181
		print "\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   182
		SmokeTest::ExecCommand ("COPY $newROFSImage \\epoc32\\rom\\");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   183
		SmokeTest::ExecCommand ("COPY $newCoreImage \\epoc32\\rom\\");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   184
		
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   185
		# Delete the images
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   186
		print "\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   187
		print "#\n# Deleting images\n#\n"; 
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   188
		print "\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   189
		SmokeTest::ExecCommand ("DEL *.img");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   190
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   191
#  passing $args[1] i.e. h2 / h4hrp to PrepareNANDROM due to CR 0844 (Both H2 and H4 use -D_NAND2)
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   192
    	&PrepareNANDROM("$args[1]");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   193
	}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   194
	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   195
	# Rename the IMG file to sys$rom.bin
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   196
	my $ImgDir = SmokeTest::ExecCommand ("DIR *.img");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   197
		
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   198
	$ImgDir =~ /(\S+\.img)/i;
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   199
		
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   200
	#&SmokeTest::DieLog("Building ROMs failed: Cannot find .IMG file") unless defined $1;
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   201
	print "Name of ROM : $1 \n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   202
	SmokeTest::ExecCommand ("MOVE /Y $1 sys\$rom.bin");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   203
	print "\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   204
		
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   205
	# 
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   206
	# ZIP ROM using \epoc32\tools\zip.exe
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   207
	# 
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   208
	print "\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   209
	print "#\n# ZIP ROM using \\epoc32\\tools\\zip.exe\n#\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   210
	print "\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   211
	SmokeTest::PrintDateTime();
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   212
	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   213
	# Now zip the file
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   214
	my $zipresult = SmokeTest::ExecCommand ("$SmokeTest::BuildDir$ENV{EPOCROOT}epoc32\\tools\\zip.exe -Tv sys\$rom sys\$rom.bin");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   215
	print "\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   216
	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   217
	# Test for zip errors
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   218
	if ($zipresult =~ m/No errors detected/i) # Good case: no errors detected.
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   219
	{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   220
		print "*** ROM zip successful: no errors detected ***\n";	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   221
	}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   222
	elsif ($zipresult =~ m/zip error/i) # Zip error
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   223
	{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   224
		print "*** Error In Smoke Test ***\n Zipping the ROM failed $!\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   225
		#&SmokeTest::DieLog("Error In Smoke Test: Zipping the ROM failed");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   226
	}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   227
	else # Worst case
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   228
	{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   229
		print "*** Error In Smoke Test ***\n Zipping unable to start $!\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   230
	}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   231
	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   232
	# Form the string for the temporary zip file locations
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   233
	my $tempZipLocation = "$SmokeTest::SmokeTestDir\\$args[0]\\$args[1]";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   234
	if ($nandROM =~ /-D_NAND/) # Add \NAND folder if a NAND ROM is being built
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   235
	{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   236
		
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   237
		if ($args[2] eq "pagedrom") # Add \NAND_DP folder if a Demand Paging NAND ROM is being built
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   238
		{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   239
			$tempZipLocation .= "\\NAND\(DP\)";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   240
		}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   241
		else
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   242
		{
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   243
			$tempZipLocation .= "\\NAND";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   244
		}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   245
	}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   246
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   247
	# Make the temp zip folder
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   248
	SmokeTest::ExecCommand ("MKDIR $tempZipLocation");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   249
	print "\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   250
	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   251
	# Copy the ROM to the appropriate directory to be copied later
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   252
	SmokeTest::ExecCommand ("MOVE /Y sys\$rom.zip $tempZipLocation\\sys\$rom.zip");
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   253
	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   254
	print "\n";
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   255
	
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   256
	SmokeTest::PrintDateTime();
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   257
}
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   258
483f966c6335 Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff changeset
   259
1;