cryptomgmtlibs/securitytestfw/test/autotesting/testMakesis.pl
branchRCL_3
changeset 53 030c4fbc13d7
parent 50 d07aa956024a
child 57 e0a1505373c1
child 58 b54b58ee9d58
equal deleted inserted replaced
50:d07aa956024a 53:030c4fbc13d7
     1 #
       
     2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 # All rights reserved.
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of the License "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 #
       
     9 # Initial Contributors:
       
    10 # Nokia Corporation - initial contribution.
       
    11 #
       
    12 # Contributors:
       
    13 #
       
    14 # Description:
       
    15 # Perl script that creates PKG files and test MAKESIS tools with different ranges
       
    16 # 
       
    17 
       
    18 #
       
    19 
       
    20 
       
    21 $logFile = "/epoc32/winscw/c/makesis_test.txt";
       
    22 $makesisExeLocation = "/epoc32/tools/makesis";
       
    23 $dumpsisExeLocation = "/epoc32/tools/dumpsis";
       
    24 
       
    25 sub GetTmpFilesCount()
       
    26 {
       
    27 	# get a number of temp files
       
    28 	if ($^O =~ /^MSWIN32$/i)
       
    29 		{
       
    30 		my $dirname = "$ENV{'TEMP'}";
       
    31 		opendir ( DIR, "$dirname" ) or die ( "Can't open dir: $dirname" ); #!
       
    32 		my @List = readdir DIR;
       
    33 		closedir DIR;
       
    34 		
       
    35 		my @TmpFiles = grep( /^~SI.*.tmp/ , @List );
       
    36 		}
       
    37 	else
       
    38 		{
       
    39 		my $dirname = "/tmp/";
       
    40 		opendir ( DIR, "$dirname" ) or die ( "Can't open dir: $dirname" ); #!
       
    41 		my @List = readdir DIR;
       
    42 		closedir DIR;
       
    43 
       
    44 		my @TmpFiles = grep( /tmp*/ , @List );
       
    45 		}
       
    46 
       
    47 	my $TmpCountBefore = @TmpFiles;
       
    48 	
       
    49 	return $TmpCountBefore;
       
    50 }
       
    51 
       
    52 #
       
    53 #Function to write log into file
       
    54 #
       
    55 sub WriteLog {
       
    56 	my ($log) = @_;
       
    57 	#public $logfile;
       
    58 
       
    59 	unless( open($fh, ">> $logFile")) {
       
    60 		printf STDERR "Can\'t open $logfile:$!\n";
       
    61 		return;
       
    62 	}
       
    63 	printf $fh $log;
       
    64 	printf $log;
       
    65 	close $fh;
       
    66 }
       
    67 
       
    68 
       
    69 #
       
    70 # Function to create a file (test.txt or any PKG)
       
    71 #
       
    72 sub CreateFile {
       
    73 	my ($filename, $contents) = @_;
       
    74 
       
    75 	unless (open($fh, "> $filename")) {
       
    76 		printf STDERR "Can't open $filename: $!\n";
       
    77 		return;
       
    78 	}
       
    79 	print $fh $contents;
       
    80 	close $fh;
       
    81 
       
    82 
       
    83 }
       
    84 
       
    85 #
       
    86 # Function to check the log file of the makesis result
       
    87 #
       
    88 sub CheckLog {
       
    89 	my ($pkgfile) = @_[0];
       
    90 	my ($expectedLog) = @_[1];
       
    91 
       
    92 	$logMsg = sprintf "Expected Log: %s\n", $expectedLog;
       
    93 	WriteLog( $logMsg);	
       
    94 
       
    95 	unless (open($resultlog, "$pkgfile.log")) {
       
    96 		printf STDERR "Can't open $pkgfile.log: $!\n";
       
    97 		return 0;
       
    98 	}
       
    99 
       
   100 	foreach $line (<$resultlog>) {
       
   101 		if ( $line =~ m/\Q$expectedLog\E/i) {
       
   102 			close($resultlog);
       
   103 			return 1;
       
   104 		}	
       
   105 	}	
       
   106 	close($resultlog);
       
   107 	return 0;
       
   108 }
       
   109 
       
   110 #
       
   111 # Run MAKESIS with prepared pkg file, log and administrate its result
       
   112 #
       
   113 sub MakeSISFile {
       
   114 
       
   115 	my ($pkgfile) = @_[0];
       
   116 	my ($expectedResult) = @_[1];
       
   117 	my ($expectedLog) = @_[2];
       
   118 	$pkgfile =~ s/\.pkg//;
       
   119 
       
   120 	if($pkgfile ne "testinterpretflag") {
       
   121 		@retval = system("$makesisExeLocation -v $pkgfile.pkg $pkgfile-tmp.sis > $pkgfile.log");
       
   122 	}
       
   123 	else {
       
   124 		@retval = system("$makesisExeLocation -v -c $pkgfile.pkg $pkgfile-tmp.sis > $pkgfile.log");
       
   125 	}
       
   126 
       
   127 	$logMsg = sprintf "Expected code:%5d   result Code:%5d\n", $expectedResult, $?;
       
   128 	WriteLog( $logMsg);
       
   129 
       
   130 	$NumberOfTests++;
       
   131 
       
   132 	if( $? == $expectedResult ) {
       
   133 		if(CheckLog($pkgfile, $expectedLog)) {
       
   134 			$NumberOfPassed++;
       
   135 			WriteLog("Passed\n\n");
       
   136 		}
       
   137 		else {
       
   138 			$NumberOfFailed++;
       
   139 			WriteLog("Failed : Unexpected Error Log\n\n");
       
   140 		}
       
   141 	}
       
   142 	else {
       
   143 		$NumberOfFailed++;
       
   144 		WriteLog("Failed : Unexpected Error Code\n\n");
       
   145 	}
       
   146 
       
   147 	unlink("$pkgfile-tmp.sis");
       
   148 	unlink("$pkgfile.log");
       
   149 	unlink("$pkgfile.pkg");
       
   150 
       
   151 }
       
   152 
       
   153 #
       
   154 # Additional test to check that stub files don't change every time 
       
   155 # they are built.
       
   156 #
       
   157 sub TestSISStubFile {
       
   158 
       
   159 	$teststubpkg = "teststub.pkg";
       
   160 	$teststubsis = "teststub.sis";
       
   161 	$comparisonsis = "comparison.sis";
       
   162 	$teststublog = "teststub.log";
       
   163 
       
   164 	WriteLog("Test invariant stub file\n");
       
   165 
       
   166 	# Generate test PKG file contents
       
   167 	$PkgFile = sprintf( $PkgFileTempl, "-1,-1,-1"); 
       
   168 	# Create PKG file
       
   169 	CreateFile($teststubpkg, $PkgFile);	
       
   170 
       
   171 	# Create a stub sis file
       
   172 	my $result = system("$makesisExeLocation -s $teststubpkg $teststubsis > $teststublog");
       
   173 	
       
   174 	# Wait at least a second and generate it again
       
   175 	sleep 2;
       
   176 	rename($teststubsis, $comparisonsis) or  
       
   177         warn "Couldn't rename $teststubsis to $comparisonsis: $!\n";
       
   178 
       
   179 	my $result2 = system("$makesisExeLocation -s $teststubpkg $teststubsis > $teststublog");
       
   180 
       
   181 	# Check that the files are the same and log the result
       
   182 	use File::Compare;
       
   183 	$NumberOfTests++;
       
   184 	if (compare($teststubsis, $comparisonsis) == 0 
       
   185 	    && $result == 0
       
   186 		&& $result2 == 0) 
       
   187 		{
       
   188 		$NumberOfPassed++;
       
   189 		WriteLog("Passed\n\n");
       
   190 		}
       
   191 	else 
       
   192 		{
       
   193 		$NumberOfFailed++;
       
   194 		WriteLog("Failed\n\n");
       
   195 		}
       
   196 
       
   197 	unlink $teststublog;
       
   198 	unlink $teststubpkg;
       
   199 	unlink $teststubsis ;
       
   200 	unlink $comparisonsis;
       
   201 }
       
   202 
       
   203 #
       
   204 # New test code for DEF083525 - makesis -vs does not create a stub sis file 
       
   205 # This is based on TestSISStubFile, it builds the stub file with -s and -vs options 
       
   206 # and checks the resulting files are the same.  The defects was that the "s" option
       
   207 # was ignored so a stub file was not built.
       
   208 #
       
   209 sub TestDEF083525 {
       
   210 
       
   211 	$teststubpkg = "teststub.pkg";
       
   212 	$teststubsis = "teststub.sis";
       
   213 	$comparisonsis = "comparison.sis";
       
   214 	$teststublog = "teststub.log";
       
   215 
       
   216 	WriteLog("Test for DEF083525 - makesis -vs does not create a stub sis file\n");
       
   217 
       
   218 	# Generate test PKG file contents
       
   219 	$PkgFile = sprintf( $PkgFileTempl, "-1,-1,-1"); 
       
   220 	# Create PKG file
       
   221 	CreateFile($teststubpkg, $PkgFile);	
       
   222 
       
   223 	# Create a stub sis file
       
   224 	my $result = system("$makesisExeLocation -s $teststubpkg $teststubsis > $teststublog");
       
   225 	
       
   226 	# Wait at least a second and generate it again this time using the -vs options
       
   227 	# This defect was that the -vs options was ignored
       
   228 	sleep 2;
       
   229 	rename $teststubsis, $comparisonsis;
       
   230 	my $result2 = system("$makesisExeLocation -vs $teststubpkg $teststubsis > $teststublog");
       
   231 
       
   232 	# Check that the files are the same and log the result
       
   233 	use File::Compare;
       
   234 	$NumberOfTests++;
       
   235 	if (compare($teststubsis, $comparisonsis) == 0 
       
   236 	    && $result == 0
       
   237 		&& $result2 == 0) 
       
   238 		{
       
   239 		$NumberOfPassed++;
       
   240 		WriteLog("Passed\n\n");
       
   241 		}
       
   242 	else 
       
   243 		{
       
   244 		$NumberOfFailed++;
       
   245 		WriteLog("Failed\n\n");
       
   246 		}
       
   247 
       
   248 	unlink $teststublog;
       
   249 	unlink $teststubpkg;
       
   250 	unlink $teststubsis ;
       
   251 	unlink $comparisonsis;
       
   252 }
       
   253 
       
   254 #
       
   255 # New test code for PDEF081989 - makesis parameter -d does not work any more. 
       
   256 # This creates a testembedded.sis file embedding testembedding.sis. This test checks the 
       
   257 # working of -d parameter where the search directory containing the embedding sis file is  
       
   258 # specified with -d option.
       
   259 #
       
   260 
       
   261 sub TestPDEF081989 {
       
   262 
       
   263 	$testembeddingpkg = "testembedding.pkg";
       
   264 	$testembeddingsis = "testembedding.sis";
       
   265 	$testembeddedpkg = "testembedded.pkg";
       
   266 	$testembeddedsis = "testembedded.sis";
       
   267 	$sisFileToEmbed = "/epoc32/winscw/c/";
       
   268 	$outputFile = $sisFileToEmbed.$testembeddingsis;
       
   269 	$testEmbedLog = "testembedded.log";
       
   270 
       
   271 	WriteLog("Test for PDEF081989 - Test for successful creation of a sis file with -d option.\n");
       
   272 
       
   273 	# Generate test PKG file contents for embedding pkg file.
       
   274 	$PkgFile = sprintf( $PkgFileTempl, "-1,-1,-1"); 
       
   275 	# Create PKG file
       
   276 	CreateFile($testembeddingpkg, $PkgFile);	
       
   277 	
       
   278 	# Generate test PKG file contents for embedded pkg file.
       
   279 	$PkgFile = sprintf( $embedContents, "-1,-1,-1"); 
       
   280 	# Create PKG file
       
   281 	CreateFile($testembeddedpkg , $PkgFile);
       
   282 
       
   283 	
       
   284 	# Create an embedding sis file
       
   285 	my $result = system("$makesisExeLocation $testembeddingpkg $outputFile > $testEmbedLog");
       
   286 	
       
   287 	# Create an embedded sis file.Here the sis file embedded is situated elsewhere(in "\\epoc32\\winscw\\c\\").
       
   288 	# Makesis -d option is used to specify the directory to search for sis file embedded. 
       
   289 	my $result1 = system("$makesisExeLocation -d$sisFileToEmbed $testembeddedpkg $testembeddedsis > $testEmbedLog");
       
   290 	
       
   291 	$NumberOfTests++;
       
   292 	if ($result == 0 && $result1 == 0) 
       
   293 		{
       
   294 		$NumberOfPassed++;
       
   295 		WriteLog("Passed\n\n");
       
   296 		}
       
   297 	else 
       
   298 		{
       
   299 		$NumberOfFailed++;
       
   300 		WriteLog("Failed\n\n");
       
   301 		}
       
   302 
       
   303 	unlink $testembeddingpkg;
       
   304 	unlink $outputFile;
       
   305 	unlink $testembeddedpkg;
       
   306 	unlink $testembeddedsis;
       
   307 	unlink $testEmbedLog;
       
   308 	
       
   309 }
       
   310 
       
   311 #
       
   312 # Test code for DEF104895 - makesis with -d option
       
   313 # This creates a testembedded.sis file embedding testembedding.sis. This test checks the 
       
   314 # working of -d parameter where the search directory(bacward slashes) containing the embedding sis file is  
       
   315 # specified with -d option.
       
   316 #
       
   317 
       
   318 sub TestDEF104895 {
       
   319 
       
   320 	$testembeddingpkg = "testembedding.pkg";
       
   321 	$testembeddingsis = "testembedding.sis";
       
   322 	$testembeddedpkg = "testembedded.pkg";
       
   323 	$testembeddedsis = "testembedded.sis";
       
   324 	$sisFileToEmbed = "\\epoc32\\winscw\\c\\";
       
   325 	$outputFile = $sisFileToEmbed.$testembeddingsis;
       
   326 	$testEmbedLog = "testembedded.log";
       
   327 
       
   328 	WriteLog("Test for DEF104895 - Test for successful creation of a sis file with -d option.\n");
       
   329 
       
   330 	# Generate test PKG file contents for embedding pkg file.
       
   331 	$PkgFile = sprintf( $PkgFileTempl, "-1,-1,-1"); 
       
   332 	# Create PKG file
       
   333 	CreateFile($testembeddingpkg, $PkgFile);	
       
   334 	
       
   335 	# Generate test PKG file contents for embedded pkg file.
       
   336 	$PkgFile = sprintf( $embedContents, "-1,-1,-1"); 
       
   337 	# Create PKG file
       
   338 	CreateFile($testembeddedpkg , $PkgFile);
       
   339 
       
   340 	
       
   341 	# Create an embedding sis file
       
   342 	my $result = system("$makesisExeLocation $testembeddingpkg $outputFile > $testEmbedLog");
       
   343 	
       
   344 	# Create an embedded sis file.Here the sis file embedded is situated elsewhere(in "\\epoc32\\winscw\\c\\").
       
   345 	# Makesis -d option is used to specify the directory to search for sis file embedded. 
       
   346 	my $result1 = system("$makesisExeLocation -d$sisFileToEmbed $testembeddedpkg $testembeddedsis > $testEmbedLog");
       
   347 	
       
   348 	$NumberOfTests++;
       
   349 	if ($result == 0 && $result1 == 0) 
       
   350 		{
       
   351 		$NumberOfPassed++;
       
   352 		WriteLog("Passed\n\n");
       
   353 		}
       
   354 	else 
       
   355 		{
       
   356 		$NumberOfFailed++;
       
   357 		WriteLog("Failed\n\n");
       
   358 		}
       
   359 
       
   360 	unlink $testembeddingpkg;
       
   361 	unlink $outputFile;
       
   362 	unlink $testembeddedpkg;
       
   363 	unlink $testembeddedsis;
       
   364 	unlink $testEmbedLog;
       
   365 	
       
   366 }
       
   367 
       
   368 #
       
   369 # New test code for DEF107033 - makesis parameter -d does not work with language dependent files
       
   370 # 
       
   371 #
       
   372 
       
   373 sub TestDEF107033() {
       
   374 
       
   375 	$testlanguagepkg = "testlanguage.pkg";
       
   376 	$testlanguagesis = "testlanguagesis.sis";
       
   377 	$testlanguagelog = "testlanguage.log";
       
   378 
       
   379 	WriteLog("Test makesis parameter -d does not work with language dependent files\n");
       
   380 
       
   381 	# Generate test PKG file contents
       
   382 	$PkgFile = sprintf( $PkgLanguageFileTemp); 
       
   383 	# Create PKG file
       
   384 	CreateFile($testlanguagepkg, $PkgFile);	
       
   385 
       
   386 	# Create a stub sis file
       
   387 	my $result = system("$makesisExeLocation -d/epoc32/winscw/c/tswi/ $testlanguagepkg $testlanguagesis > $testlanguagelog");
       
   388 	
       
   389 
       
   390 	$NumberOfTests++;
       
   391 
       
   392 	if ($result == 0) {
       
   393 		$NumberOfPassed++;
       
   394 		WriteLog("Passed\n\n");
       
   395 	}
       
   396 	else {
       
   397 		$NumberOfFailed++;
       
   398 		WriteLog("Failed\n\n");
       
   399 	}
       
   400 
       
   401 	unlink $testlanguagepkg;
       
   402 	unlink $testlanguagesis;
       
   403 	unlink $testlanguagelog ;
       
   404 
       
   405 }
       
   406 
       
   407 #
       
   408 # Test code for DEF104895 - makesis with -d option
       
   409 # This creates a testembedded.sis file embedding testembedding.sis. This test checks the 
       
   410 # working of -d parameter where the search directory(bacward slashes) containing the embedding sis file is  
       
   411 # specified with -d option.
       
   412 #
       
   413 
       
   414 sub TestLDEF104895 {
       
   415 
       
   416 	$testembeddingpkg = "testembedding.pkg";
       
   417 	$testembeddingsis = "testembedding.sis";
       
   418 	$testembeddedpkg = "testembedded.pkg";
       
   419 	$testembeddedsis = "testembedded.sis";
       
   420 	$sisFileToEmbed = "\\\\epoc32\\\\winscw\\\\c\\\\";
       
   421 	$outputFile = $sisFileToEmbed.$testembeddingsis;
       
   422 	$testEmbedLog = "testembedded.log";
       
   423 
       
   424 	WriteLog("Test for DEF104895 - Test for successful creation of a sis file with -d option.\n");
       
   425 
       
   426 	# Generate test PKG file contents for embedding pkg file.
       
   427 	$PkgFile = sprintf( $PkgFileTempl, "-1,-1,-1"); 
       
   428 	# Create PKG file
       
   429 	CreateFile($testembeddingpkg, $PkgFile);	
       
   430 	
       
   431 	# Generate test PKG file contents for embedded pkg file.
       
   432 	$PkgFile = sprintf( $embedContents, "-1,-1,-1"); 
       
   433 	# Create PKG file
       
   434 	CreateFile($testembeddedpkg , $PkgFile);
       
   435 
       
   436 	
       
   437 	# Create an embedding sis file
       
   438 	my $result = system("$makesisExeLocation $testembeddingpkg $outputFile > $testEmbedLog");
       
   439 	
       
   440 	# Create an embedded sis file.Here the sis file embedded is situated elsewhere(in "\\epoc32\\winscw\\c\\").
       
   441 	# Makesis -d option is used to specify the directory to search for sis file embedded. 
       
   442 	my $result1 = system("$makesisExeLocation -d$sisFileToEmbed $testembeddedpkg $testembeddedsis > $testEmbedLog");
       
   443 	
       
   444 	$NumberOfTests++;
       
   445 	if ($result == 0 && $result1 == 0) 
       
   446 		{
       
   447 		$NumberOfPassed++;
       
   448 		WriteLog("Passed\n\n");
       
   449 		}
       
   450 	else 
       
   451 		{
       
   452 		$NumberOfFailed++;
       
   453 		WriteLog("Failed\n\n");
       
   454 		}
       
   455 
       
   456 	unlink $testembeddingpkg;
       
   457 	unlink $outputFile;
       
   458 	unlink $testembeddedpkg;
       
   459 	unlink $testembeddedsis;
       
   460 	unlink $testEmbedLog;
       
   461 	
       
   462 }
       
   463 
       
   464 
       
   465 #
       
   466 # New test code for DEF090878 - unexpected error by makesis when processing pkg file saved in UTF8 format
       
   467 # This test uses existing utf8.pkg which contains UTF-8 encoded characters and in turn refers to utf8.txt
       
   468 #
       
   469 sub TestDEF090878 {
       
   470 
       
   471 	my $path = "/epoc32/winscw/c/tswi";
       
   472 	my $pkgfile = "$path/utf8";
       
   473 	my $expectedResult = 0;
       
   474 
       
   475 	WriteLog("Test for DEF090878 - unexpected error by makesis when processing pkg file saved in UTF8 format\n");
       
   476 	WriteLog("UTF-8 encoded file: $pkgfile.pkg\n");
       
   477 	
       
   478 	# Do MAKESIS test
       
   479 	@retval = system("$makesisExeLocation $pkgfile.pkg $pkgfile-tmp.sis > $pkgfile.log");
       
   480 	
       
   481 	$logMsg = sprintf "Expected code:%5d   result Code:%5d\n", $expectedResult, $?;
       
   482 	WriteLog( $logMsg);
       
   483 
       
   484 	$NumberOfTests++;
       
   485 	
       
   486 	if( $? == $expectedResult ) {
       
   487 		$NumberOfPassed++;
       
   488 		WriteLog("Passed\n\n");
       
   489 	}
       
   490 	else {
       
   491 		$NumberOfFailed++;
       
   492 		WriteLog("Failed\n\n");
       
   493 	}
       
   494 
       
   495 	unlink("$pkgfile-tmp.sis");
       
   496 	unlink("$pkgfile.sis");
       
   497 	unlink("$pkgfile.log");
       
   498 }
       
   499 
       
   500 #
       
   501 # Test code for DEF112831 - makesis crashes on .pkg containing non-existing embedded sis
       
   502 #
       
   503 
       
   504 sub TestDEF112831() {
       
   505 
       
   506 	my $expectedResult = 256;
       
   507 	$testmissingembeddedpkg = "missingembedded.pkg";
       
   508 	$testmissingembeddedsis = "missingembedded.sis";
       
   509 	$testmissingembeddedlog = "missingembedded.log";
       
   510 
       
   511 	WriteLog("Test for DEF112831 - makesis crashes on .pkg containing non-existing embedded sis\n");
       
   512 
       
   513 	# Generate test PKG file contents
       
   514 	$PkgFile = sprintf( $missingEmbed); 
       
   515 	# Create PKG file
       
   516 	CreateFile($testmissingembeddedpkg, $PkgFile);	
       
   517 
       
   518 	# Create a stub sis file
       
   519 	my $result = system("$makesisExeLocation -d/epoc32/winscw/c/tswi/ $testmissingembeddedpkg $testmissingembeddedsis > $testmissingembeddedlog");
       
   520 
       
   521 	$logMsg = sprintf "Expected code:%5d   result Code:%5d\n", $expectedResult, $?;
       
   522 	WriteLog( $logMsg);
       
   523 
       
   524 	$NumberOfTests++;
       
   525 
       
   526 	if ($result == 256) {
       
   527 		$NumberOfPassed++;
       
   528 		WriteLog("Passed\n\n");
       
   529 	}
       
   530 	else {
       
   531 		$NumberOfFailed++;
       
   532 		WriteLog("Failed\n\n");
       
   533 	}
       
   534 
       
   535 	unlink $testmissingembeddedpkg;
       
   536 	unlink $testmissingembeddedsis;
       
   537 	unlink $testmissingembeddedlog ;
       
   538 
       
   539 }
       
   540 
       
   541 # Windows Test
       
   542 # Test code for  DEF091942
       
   543 # Test case generates a SIS from a Japanese named pkg file. Checks to see if the SIS fle generated has the same name.
       
   544 # NOTE: Does not validate the console output.
       
   545  
       
   546 sub TestDEF091942 {
       
   547 
       
   548 	my $path = "\\epoc32\\winscw\\c\\tswi";
       
   549 	
       
   550 	$NumberOfTests++;
       
   551 	WriteLog("Test for DEF091942 - makesis can not handle package files names written with japanese symbols\n");
       
   552 	
       
   553 	# Generate Japanese pkg 
       
   554 	system("WScript.exe //B //Nologo $path\\displayjpn_1.vbs");
       
   555 
       
   556 	# Check to see if the sis file has been generated
       
   557 	system("WScript.exe //B //Nologo $path\\displayjpn_2.vbs");
       
   558 
       
   559 	if ( -f "$path\\passed.txt") {
       
   560 		$NumberOfPassed++;
       
   561 		WriteLog("Passed\n\n");
       
   562 	} else {
       
   563 		$NumberOfFailed++;
       
   564 		WriteLog("Failed\n\n");
       
   565 	}
       
   566 
       
   567 	# Tidy up
       
   568 	system("WScript.exe //B //Nologo $path\\displayjpn_3.vbs");
       
   569 }
       
   570 
       
   571 # Linux Test
       
   572 # Test code for  DEF091942 
       
   573 # Test case generates a SIS from a Japanese named pkg file. Checks to see if the SIS fle generated has the same name.
       
   574 # NOTE: Does not validate the console output.
       
   575  
       
   576 sub TestLDEF091942{
       
   577 
       
   578 	$pkgfile = "ゎわこんァア龐龑.pkg";
       
   579 	$sisfile = "ゎわこんァア龐龑.sis";
       
   580 	$logfile = "ゎわこんァア龐龑.log";
       
   581 
       
   582 	$NumberOfTests++;
       
   583 
       
   584 	my $file = "/epoc32/winscw/c/tswi/passed.txt";
       
   585 	
       
   586 	WriteLog("Test for DEF091942 - makesis can not handle package files names written with japanese symbols\n");
       
   587 	
       
   588 	# Generate test PKG file contents for japanese pkg file.
       
   589 	$PkgFile = sprintf( $JAPPkgFileTempl); 
       
   590 	# Create PKG file
       
   591 	CreateFile($pkgfile, $PkgFile);
       
   592 
       
   593 	# Do MAKESIS test
       
   594 	@retval = system("$makesisExeLocation -v $pkgfile > logfile");
       
   595 
       
   596 	$logMsg = sprintf "Expected code:%5d   result Code:%5d\n", $expectedResult, $?;
       
   597 	WriteLog( $logMsg);
       
   598 
       
   599 	if(-f $sisfile){
       
   600 		CreateFile($file,$TempData);
       
   601 	}
       
   602 
       
   603 	if( -f $file ) {
       
   604 		$NumberOfPassed++;
       
   605 		WriteLog("Passed\n\n");
       
   606 	}
       
   607 	else {
       
   608 		$NumberOfFailed++;
       
   609 		WriteLog("Failed\n\n");
       
   610 	}
       
   611 
       
   612 	unlink("$pkgfile.sis");
       
   613 	unlink("$pkgfile.log");
       
   614 	unlink("$pkgfile.pkg");
       
   615 }
       
   616 
       
   617 
       
   618  
       
   619 #
       
   620 # New test code for DEF091780 - Makesis have problems parsing IF-ENDIF block
       
   621 # test files are generated according to defect description, except that ALL files are located in current folder
       
   622 #
       
   623 sub TestDEF091780 {
       
   624 
       
   625 	my $ifendif = "ifendif.pkg";
       
   626 	my $expectedResult = 0;
       
   627 
       
   628 	WriteLog("Test for DEF091780 - Makesis have problems parsing IF-ENDIF block\n");
       
   629 
       
   630 	# Create PKG file
       
   631 	CreateFile($ifendif , $ifendifContent);
       
   632 	$ifendif =~ s/\.pkg//;
       
   633 	
       
   634 	# Create options-related files
       
   635 	CreateFile('osver1J.txt', "1J");
       
   636 	CreateFile('osver2J.txt', "2J");
       
   637 	CreateFile('osver1F.txt', "1F");
       
   638 	CreateFile('osver2F.txt', "2F");
       
   639 
       
   640 	# Do MAKESIS test
       
   641 	@retval = system("$makesisExeLocation $ifendif.pkg $ifendif-tmp.sis > $ifendif.log");
       
   642 	
       
   643 	$logMsg = sprintf "Expected code:%5d   result Code:%5d\n", $expectedResult, $?;
       
   644 	WriteLog( $logMsg);
       
   645 
       
   646 	$NumberOfTests++;
       
   647 	
       
   648 	if( $? == $expectedResult ) {
       
   649 		$NumberOfPassed++;
       
   650 		WriteLog("Passed\n\n");
       
   651 	}
       
   652 	else {
       
   653 		$NumberOfFailed++;
       
   654 		WriteLog("Failed\n\n");
       
   655 	}	
       
   656 	
       
   657 	# tidy up
       
   658 	unlink("$ifendif.pkg");
       
   659 	unlink("$ifendif-tmp.sis");
       
   660 	unlink("$ifendif.sis");
       
   661 	unlink("$ifendif.log");
       
   662 	unlink("osver1J.txt");
       
   663 	unlink("osver2J.txt");
       
   664 	unlink("osver1F.txt");
       
   665 	unlink("osver2F.txt");
       
   666 }
       
   667 
       
   668 #
       
   669 # Test code for SIS files with comma at the end of the file - DEF108815
       
   670 # 
       
   671 #
       
   672 sub TestEndFileComma {
       
   673 
       
   674 	my $pkgName = "endFileComma.pkg";
       
   675 	my $logName = "endFileComma.log";
       
   676 	my $sisName = "endFileComma.sis";
       
   677 	my $expectedResult = 256;
       
   678 	
       
   679 	WriteLog("Test for DEF108815 - makesis crashes if a trailing comma is present on an install-file \n");
       
   680 
       
   681 	# Create PKG file
       
   682 	CreateFile($pkgName, $endFileCommaContent);
       
   683 	$ifendif =~ s/\.pkg//;
       
   684 	
       
   685 	# Do MAKESIS test
       
   686 	@retval = system("$makesisExeLocation $pkgName $sisName > $logName");
       
   687 	
       
   688 	$logMsg = sprintf "Expected code:%5d   result Code:%5d\n", $expectedResult, $?;
       
   689 	WriteLog( $logMsg);
       
   690 
       
   691 	$NumberOfTests++;
       
   692 	
       
   693 	if( $? == $expectedResult ) {
       
   694 		$NumberOfPassed++;
       
   695 		WriteLog("Passed\n\n");
       
   696 	}
       
   697 	else {
       
   698 		$NumberOfFailed++;
       
   699 		WriteLog("Failed\n\n");
       
   700 	}	
       
   701 	
       
   702 	# tidy up
       
   703 	#unlink("$pkgName");
       
   704 	unlink("$sisName");
       
   705 	unlink("$logName");
       
   706 }
       
   707 
       
   708 #
       
   709 # Test code for package file containing very long destination folder name - DEF115795
       
   710 # 
       
   711 #
       
   712 sub TestLongFolderName {
       
   713 
       
   714 	my $pkgName = "longfolder.pkg";
       
   715 	my $logName = "longfolder.log";
       
   716 	my $sisName = "longfolder.sis";
       
   717 	my $expectedResult = 256;
       
   718 	
       
   719 	WriteLog("Test for DEF115795 - SWI completes the installation despite the files not being installed \n");
       
   720 
       
   721 	# Create PKG file
       
   722 	CreateFile($pkgName, $longfolder);
       
   723 	$ifendif =~ s/\.pkg//;
       
   724 	
       
   725 	# Do MAKESIS test
       
   726 	@retval = system("$makesisExeLocation $pkgName $sisName > $logName");
       
   727 	
       
   728 	$logMsg = sprintf "Expected code:%5d   result Code:%5d\n", $expectedResult, $?;
       
   729 	WriteLog( $logMsg);
       
   730 
       
   731 	$NumberOfTests++;
       
   732 	
       
   733 	if( $? == $expectedResult ) {
       
   734 		$NumberOfPassed++;
       
   735 		WriteLog("Passed\n\n");
       
   736 	}
       
   737 	else {
       
   738 		$NumberOfFailed++;
       
   739 		WriteLog("Failed\n\n");
       
   740 	}	
       
   741 	
       
   742 	# tidy up
       
   743 	unlink("$pkgName");
       
   744 	unlink("$sisName");
       
   745 	unlink("$logName");
       
   746 }
       
   747 
       
   748 #
       
   749 #  Test code for invalid version number in pkg file - DEF112718
       
   750 # 
       
   751 #
       
   752 sub TestInvalidVersion1 {
       
   753 
       
   754 	my $pkgName = "invalidVersion.pkg";
       
   755 	my $LogFile = "invalidVersion.log";
       
   756 	my $sisName = "invalidVersion.sis";
       
   757 	my $ExpectedLogFile = "InvalidVersionExpected.log";
       
   758 	
       
   759 	WriteLog("Test for DEF112718 - Invalid version number in pkg file \n");
       
   760 
       
   761 	# Create PKG file
       
   762 	CreateFile($pkgName, $invalidVersion1);
       
   763 	
       
   764 	my $trailingData = "Created  $sisName.";
       
   765 	my $OutputData = "Processing $pkgName...\n$DEF112718ExpectedOutput$trailingData";
       
   766 	
       
   767 	# Create expected log file
       
   768 	CreateFile($ExpectedLogFile ,$OutputData);
       
   769 
       
   770 	# Create a sis file
       
   771 	my $result = system("$makesisExeLocation $pkgName $sisName > $LogFile");
       
   772 	
       
   773 	use File::Compare;
       
   774 	my $result1;
       
   775 
       
   776 	if(compare($LogFile ,$ExpectedLogFile)== 0)
       
   777  		{ 
       
   778  		$result1 = 0;			
       
   779  		}
       
   780  	else
       
   781  		{
       
   782  		$result1 = 1;
       
   783  		}
       
   784 	$NumberOfTests++;
       
   785 
       
   786  	if ($result == 0 && $result1 == 0) 
       
   787  		{
       
   788  		$NumberOfPassed++;
       
   789  		WriteLog("Passed\n\n");
       
   790  		}
       
   791  	else 
       
   792  		{
       
   793  		$NumberOfFailed++;
       
   794  		WriteLog("Failed\n\n");
       
   795  		}
       
   796 
       
   797 	
       
   798 	# tidy up
       
   799 	unlink("$pkgName");
       
   800 	unlink("$sisName");
       
   801 	unlink("$logName");
       
   802 	unlink ("$LogFile");
       
   803 }
       
   804 
       
   805 #
       
   806 #  Test code for invalid version number in pkg file - DEF112718
       
   807 # 
       
   808 #
       
   809 
       
   810 sub TestInvalidVersion2 {
       
   811 
       
   812 	my $pkgName = "invalidVersion.pkg";
       
   813 	my $logName = "invalidVersion.log";
       
   814 	my $sisName = "invalidVersion.sis";
       
   815 	my $expectedResult = 256;
       
   816 	
       
   817 	WriteLog("Test for DEF112718 - Invalid version number in pkg file with negative values \n");
       
   818 
       
   819 	# Create PKG file
       
   820 	CreateFile($pkgName, $invalidVersion2);
       
   821 	
       
   822 	
       
   823 	# Do MAKESIS test
       
   824 	@retval = system("$makesisExeLocation $pkgName $sisName > $logName");
       
   825 	
       
   826 	$logMsg = sprintf "Expected code:%5d   result Code:%5d\n", $expectedResult, $?;
       
   827 	WriteLog( $logMsg);
       
   828 
       
   829 	$NumberOfTests++;
       
   830 	
       
   831 	if( $? == $expectedResult ) {
       
   832 		$NumberOfPassed++;
       
   833 		WriteLog("Passed\n\n");
       
   834 	}
       
   835 	else {
       
   836 		$NumberOfFailed++;
       
   837 		WriteLog("Failed\n\n");
       
   838 	}	
       
   839 	
       
   840 	# tidy up
       
   841 	unlink("$pkgName");
       
   842 	unlink("$sisName");
       
   843 	unlink("$logName");
       
   844 }
       
   845 
       
   846 
       
   847 #
       
   848 #  Test code for Preinstalled pkg files without having sourcefiles - DEF113569
       
   849 # 
       
   850 #
       
   851 sub TestPreInstalledWithoutSourceFiles {
       
   852 
       
   853 	my $pkgName = "preinstalledwithoutsourcefile.pkg";
       
   854 	my $logName = "preinstalledwithoutsourcefile.log";
       
   855 	my $sisName = "preinstalledwithoutsourcefile.sis";
       
   856 	my $ExpectedLogFile = "preinstalledwithoutsourcefileExpected.log";
       
   857 
       
   858 	WriteLog("Test for DEF113569 - Preinstalled pkg files without having sourcefiles \n");
       
   859 
       
   860 	# Create PKG file
       
   861 	CreateFile($pkgName, $PreinstalledPkgWithoutSourcefiles);
       
   862 
       
   863 	my $OutputData = "Processing $pkgName...\n$DEF113569ExpectedOutput";
       
   864 	
       
   865 	# Create expected log file
       
   866 	CreateFile($ExpectedLogFile ,$OutputData);
       
   867 
       
   868 	# Do MAKESIS test
       
   869 	@retval = system("$makesisExeLocation $pkgName $sisName > $logName");
       
   870 
       
   871 	use File::Compare;
       
   872 	my $result1;
       
   873 
       
   874 	if(compare($logName ,$ExpectedLogFile)== 0)
       
   875  		{ 
       
   876  		$result1 = 0;			
       
   877  		}
       
   878  	else
       
   879  		{
       
   880  		$result1 = 1;
       
   881  		}
       
   882 
       
   883 	$NumberOfTests++;
       
   884 
       
   885 	
       
   886 	if ($result == 0 && $result1 == 0) 
       
   887  		{
       
   888  		$NumberOfPassed++;
       
   889  		WriteLog("Passed\n\n");
       
   890  		}
       
   891  	else 
       
   892  		{
       
   893  		$NumberOfFailed++;
       
   894  		WriteLog("Failed\n\n");
       
   895  		}
       
   896 
       
   897 	# tidy up
       
   898 	unlink("$pkgName");
       
   899 	unlink("$sisName");
       
   900 	unlink("$logName");
       
   901 	unlink ("$ExpectedLogFile");
       
   902 }
       
   903 
       
   904 
       
   905 # New test code for DEF091860 - Quotes missing in reversed package produced by dumpsis for IF EXIST statement. 
       
   906 # This creates a DEF091860.sis file . This test checks whether the pkg file generated by dumpsis when reprocessed 
       
   907 # by makesis generates a sis file successfully.
       
   908 #
       
   909 sub TestDEF091860() {
       
   910 
       
   911 	$DEF091860pkg = "DEF091860.pkg";
       
   912 	$DEF091860sis = "DEF091860.sis";
       
   913 	$DumpsisGenPkgPath = "\/DEF091860";
       
   914 	$DEF091860Log = "DEF091860.log";
       
   915 
       
   916 				
       
   917 	WriteLog("Test for DEF091860 - Test for successful creation of a sis file when pkg file generated from dumpsis is used.\n");
       
   918 
       
   919 	# Generate test PKG file contents for embedding pkg file.
       
   920 	$PkgFile = sprintf( $DEF091860PkgContents, "-1,-1,-1"); 
       
   921 	# Create PKG file
       
   922 	CreateFile($DEF091860pkg, $PkgFile);	
       
   923 	
       
   924 	# Create DEF091860.sis file
       
   925 	my $result = system("$makesisExeLocation $DEF091860pkg $DEF091860sis > $DEF091860Log");
       
   926 	
       
   927 	WriteLog("result: $result\n");
       
   928 
       
   929 	# Execute DumpSIS on the created DEF091860.sis.
       
   930 	my $result1 = system("/epoc32/tools/DUMPSIS -x $DEF091860sis > $DEF091860Log");
       
   931 	
       
   932 	WriteLog("result1: $result1[0]\n");
       
   933 
       
   934 	use Cwd;
       
   935     $dir = cwd;
       
   936 	chdir $dir.$DumpsisGenPkgPath;
       
   937 	
       
   938 	#Regenerate DEF091860.sis from the dumpsis generated pkg file.
       
   939 	$result2  = system("$makesisExeLocation $DEF091860pkg $DEF091860sis > $DEF091860Log");
       
   940 	chdir $dir;
       
   941 	
       
   942 	WriteLog("result2: $result2\n");
       
   943 
       
   944 	$NumberOfTests++;
       
   945 	if ($result == 0 && $result1 == 0 && $result2 == 0) 
       
   946 		{
       
   947 		$NumberOfPassed++;
       
   948 		WriteLog("Passed\n\n");
       
   949 		}
       
   950 	else 
       
   951 		{
       
   952 		$NumberOfFailed++;
       
   953 		WriteLog("Failed\n\n");
       
   954 		}
       
   955 
       
   956 	unlink $DEF091860pkg;
       
   957 	unlink $DEF091860sis;
       
   958 	unlink $DEF091860Log;
       
   959 	use File::Path;
       
   960 	rmtree "$dir$DumpsisGenPkgPath";
       
   961 }
       
   962 
       
   963 #
       
   964 # New test code for DEF090912  makesis shows error: file I/O fault. for PC folder with unicode (katakana) UCS2 
       
   965 # NB: japanese source file is located in current folder instead of on folder tree for simplicity
       
   966 #
       
   967 sub TestDEF090912 {
       
   968 
       
   969 	my $path = "\\epoc32\\winscw\\c\\tswi";
       
   970 	my $ucs2 = "$path\\ucs2jpn";
       
   971 	my $expectedResult = 0;
       
   972 
       
   973 	WriteLog("Test for DEF090912: makesis shows error \"file I/O fault\" for PC folder with unicode (katakana) UCS2\n");
       
   974 	
       
   975 	# tricky thing to create file with Japanese  name on any locale
       
   976 	# use //B to launch script engine in batch mode
       
   977 	system("WScript.exe //B //Nologo $path\\ucs2jpn.vbs");
       
   978 
       
   979 	# Do MAKESIS test
       
   980 	@retval = system("$makesisExeLocation $ucs2.pkg $ucs2-tmp.sis > $ucs2.log");
       
   981 	
       
   982 	$logMsg = sprintf "Expected code:%5d   result Code:%5d\n", $expectedResult, $?;
       
   983 	WriteLog( $logMsg);
       
   984 
       
   985 	$NumberOfTests++;
       
   986 	
       
   987 	if( $? == $expectedResult ) {
       
   988 		$NumberOfPassed++;
       
   989 		WriteLog("Passed\n\n");
       
   990 	}
       
   991 	else {
       
   992 		$NumberOfFailed++;
       
   993 		WriteLog("Failed\n\n");
       
   994 	}	
       
   995 	
       
   996 	# tidy up
       
   997 	unlink("$ucs2-tmp.sis");
       
   998 	unlink("$ucs2.log");
       
   999 	system("WScript.exe //B //Nologo $path\\rmucs2jpn.vbs");
       
  1000 }
       
  1001 
       
  1002 
       
  1003 # Linux Test
       
  1004 # New test code for DEF090912  makesis shows error: file I/O fault. for PC folder with unicode (katakana) UCS2 
       
  1005 # NB: japanese source file is located in current folder instead of on folder tree for simplicity
       
  1006 #
       
  1007 sub TestLDEF090912 {
       
  1008 
       
  1009 	my $path = "/epoc32/winscw/c/tswi";
       
  1010 	my $ucs2 = "$path/ナソト.txt";
       
  1011 	my $pkgfile = "$path/ucs2jpn";
       
  1012 	my $expectedResult = 0;
       
  1013 
       
  1014 	WriteLog("Test for DEF090912: makesis shows error \"file I/O fault\" for PC folder with unicode (katakana) UCS2\n");
       
  1015 	
       
  1016 		
       
  1017 	# Create PKG file
       
  1018 	
       
  1019 	CreateFile($ucs2, $TempData);
       
  1020 
       
  1021 	# Do MAKESIS test
       
  1022 	@retval = system("$makesisExeLocation -v $pkgfile.pkg  > $pkgfile.log");
       
  1023 	
       
  1024 	$logMsg = sprintf "Expected code:%5d   result Code:%5d\n", $expectedResult, $?;
       
  1025 	WriteLog( $logMsg);
       
  1026 
       
  1027 	$NumberOfTests++;
       
  1028 	
       
  1029 	if( $? == $expectedResult ) {
       
  1030 		$NumberOfPassed++;
       
  1031 		WriteLog("Passed\n\n");
       
  1032 	}
       
  1033 	else {
       
  1034 		$NumberOfFailed++;
       
  1035 		WriteLog("Failed\n\n");
       
  1036 	}	
       
  1037 	
       
  1038 	# tidy up
       
  1039 	unlink("$pkgfile.log");
       
  1040 	unlink("$pkgfile.sis");
       
  1041 }
       
  1042 
       
  1043 
       
  1044 
       
  1045 
       
  1046 #
       
  1047 # New test code for DEF093400:  Temporary files are left undeleted after MakeSIS/SignSIS call 
       
  1048 # NB: japanese source file is located in current folder instead of on folder tree for simplicity
       
  1049 #
       
  1050 
       
  1051 sub TestDEF093400 
       
  1052 {
       
  1053 	WriteLog("Test for DEF093400: Temporary files are left undeleted after MakeSIS/SignSIS call\n");
       
  1054 	
       
  1055 	my $pkg = "temp.pkg";
       
  1056 	my $expectedResult = 0;
       
  1057 
       
  1058 	# Create PKG file
       
  1059 	chmod S_IWUSR | S_IWGRP | S_IWOTH, '$pkg';
       
  1060 	my $temp = sprintf $PkgFileTempl, "-1,-1,-1"; 
       
  1061 	CreateFile($pkg, $temp);
       
  1062 	$pkg =~ s/\.pkg//;
       
  1063 	
       
  1064 	# Create options-related files
       
  1065 	chmod S_IWUSR | S_IWGRP | S_IWOTH, '$pkg.txt';
       
  1066 	CreateFile("$pkg.txt", "temp file");
       
  1067 	chmod S_IRUSR | S_IRGRP | S_IROTH, '$pkg.txt';
       
  1068 
       
  1069 	my $TmpCountBefore = GetTmpFilesCount();
       
  1070 
       
  1071 	# Do MAKESIS test
       
  1072 	@retval = system("$makesisExeLocation $pkg.pkg $pkg-tmp.sis > $pkg.log");
       
  1073 
       
  1074 	my $TmpCountAfter = GetTmpFilesCount();
       
  1075 	
       
  1076 	$logMsg = sprintf "Expected code:%5d   result Code:%5d\n", $expectedResult, $?;
       
  1077 	WriteLog( $logMsg);
       
  1078 	$logMsg = sprintf "Temp Files detected - Before:%5d   After:%5d\n", $TmpCountBefore, $TmpCountAfter;
       
  1079 	WriteLog( $logMsg);
       
  1080 
       
  1081 	$NumberOfTests++;
       
  1082 	
       
  1083 	if(  $? == $expectedResult && $TmpCountBefore == $TmpCountAfter ) {
       
  1084 		$NumberOfPassed++;
       
  1085 		WriteLog("Passed\n\n");
       
  1086 	}
       
  1087 	else {
       
  1088 		$NumberOfFailed++;
       
  1089 		WriteLog("Failed\n\n");
       
  1090 	}	
       
  1091 	
       
  1092 	# tidy up
       
  1093 	unlink("$pkg.pkg");
       
  1094 	unlink("$pkg-tmp.sis");
       
  1095 	unlink("$pkg.txt");
       
  1096 	unlink("$pkg.log");
       
  1097 }
       
  1098 
       
  1099 
       
  1100 #
       
  1101 # New test code for DEF093156 - MAKEKEYS does not process correctly non European symbols in cmd line 
       
  1102 # This test checks whether the certificate and key files which have names with japanese symbols are created successfully .
       
  1103 #
       
  1104 sub TestDEF093156 {
       
  1105 
       
  1106 	my $path = "\\epoc32\\winscw\\c\\tswi";
       
  1107  	$DEF093156Log = "DEF093156.log";
       
  1108 	$ResFile1="ex.txt";
       
  1109 	$ResFile2="ResultMakeKeys.txt";
       
  1110  
       
  1111 	WriteLog("Test for DEF093156 - Makekeys test for successful creation of a certificate and key file with japanese symbols.\n");
       
  1112   
       
  1113  	# create a key file and a certificate file with japanese symbols
       
  1114 	system("WScript.exe //B //Nologo $path\\testmakekeys.vbs > $DEF093156Log");
       
  1115 
       
  1116  	$NumberOfTests++;
       
  1117 	if ( !-f $ResFile1 )
       
  1118 	{
       
  1119  		$NumberOfFailed++;
       
  1120  		WriteLog("Failed In Step 1\n\n");
       
  1121 		unlink $DEF093156Log;
       
  1122 		exit;
       
  1123 	}
       
  1124 	
       
  1125 	#Make sure that the DN in the created certificate with japanese symbols is encoded properly
       
  1126 	system("WScript.exe //B //Nologo $path\\testmakekeys2.vbs $path 1 > $DEF093156Log");
       
  1127 	
       
  1128 	if ( -f $ResFile2 )
       
  1129 	{
       
  1130 		$NumberOfPassed++;
       
  1131  		WriteLog("Passed\n\n");
       
  1132  	}
       
  1133 	else
       
  1134 	{
       
  1135  		$NumberOfFailed++;
       
  1136  		WriteLog("Failed In Step 2\n\n");
       
  1137 	}
       
  1138 
       
  1139  	unlink $DEF093156Log;
       
  1140 	unlink $ResFile1;
       
  1141 	unlink $ResFile2;
       
  1142 }
       
  1143 
       
  1144 #
       
  1145 # New test code for INC092755: Makesis includes the same file to the generated SIS file if the pkg file has IF-ELSE condition block where only the destination path changes
       
  1146 #
       
  1147 sub TestINC092755 {
       
  1148 
       
  1149 	WriteLog("Test for INC092755: Makesis includes the same file for IF-ELSE where only the dest path changes\n");
       
  1150 	
       
  1151 	my $path = "\\epoc32\\winscw\\c\\tswi";
       
  1152 	my $INC092755 = "INC092755";
       
  1153 	
       
  1154 	# Call DumpSIS to compare SIS file against expected result and number of files extracted
       
  1155 	WriteLog("Calling DumpSIS...\n");
       
  1156 	@retval = system("/epoc32/tools/DUMPSIS -x $path\\$INC092755.sis > $INC092755.log");
       
  1157 	
       
  1158 	use Cwd;
       
  1159     my $dir = cwd."/$INC092755";
       
  1160 	opendir ( DIR, "$dir" ) or die ( "Can't open dir: $dir" ); #!
       
  1161 	my @List = readdir DIR;
       
  1162 	closedir DIR;
       
  1163 	
       
  1164 	my @files = grep( /^file[0-9]*/ , @List );
       
  1165 	my $fileCount = @files;
       
  1166 	print "Extracted: $fileCount file(s)	Expected: 1 file(s)\n";
       
  1167 	
       
  1168 	$NumberOfTests++;
       
  1169 	if ( $fileCount == 1 )
       
  1170 	{
       
  1171 		$NumberOfPassed++;
       
  1172 		WriteLog("Passed\n\n");
       
  1173 	}
       
  1174 	else
       
  1175 	{
       
  1176 		$NumberOfFailed++;
       
  1177 		WriteLog("Failed\n\n");
       
  1178 	}
       
  1179 
       
  1180 	unlink("$INC092755.log");
       
  1181 	rmdir("$INC092755");
       
  1182 	unlink("$INC092755.sis");
       
  1183 }
       
  1184 
       
  1185 #
       
  1186 # New test code for CR904  
       
  1187 # This test checks for the successful creation of sis file when pkg file contains the parameter $ (which represents 
       
  1188 # system drive) in the destination file.
       
  1189 # 
       
  1190 
       
  1191 
       
  1192 sub TestsysDriveparameter {
       
  1193 
       
  1194 	$pkgFilewithsysDriveparameter = "testsysDrive.pkg";
       
  1195 	$sisFile = "testsysDrive.sis";
       
  1196 	$LogFile = "testsysDrive.log";
       
  1197 	
       
  1198 
       
  1199 	WriteLog("Test for successful creation of a sis file with $ parameter specified in pkg file to represent system drive.\n");
       
  1200 
       
  1201 	# Generate test PKG file contents for embedding pkg file.
       
  1202 	$PkgFile = sprintf( $PkgFileTemp2, "-1,-1,-1"); 
       
  1203 
       
  1204 	# Create PKG file
       
  1205 	CreateFile($pkgFilewithsysDriveparameter, $PkgFile);	
       
  1206 	
       
  1207 		
       
  1208 	# Create an embedding sis file
       
  1209 	my $result = system("$makesisExeLocation $pkgFilewithsysDriveparameter $sisFile > $LogFile");
       
  1210 	
       
  1211 	
       
  1212 	$NumberOfTests++;
       
  1213 	if ($result == 0 ) 
       
  1214 		{
       
  1215 		$NumberOfPassed++;
       
  1216 		WriteLog("Passed\n\n");
       
  1217 		}
       
  1218 	else 
       
  1219 		{
       
  1220 		$NumberOfFailed++;
       
  1221 		WriteLog("Failed\n\n");
       
  1222 		}
       
  1223 
       
  1224 	unlink $pkgFilewithsysDriveparameter;
       
  1225 	unlink $sisFile;
       
  1226 	unlink $LogFile
       
  1227 	
       
  1228 }
       
  1229 
       
  1230 
       
  1231 #
       
  1232 # New test code for CR1027 - SA ROM Upgrade  
       
  1233 # This test checks for the successful creation of sis file when PKG file contains the newly added ( as part of CR1027 ) 
       
  1234 # ROM upgrade capability install flag RU with one of the right install types SA ( only SA, PU & SP are valid with RU).
       
  1235 # 
       
  1236 
       
  1237 sub TestSisRUWithSA {
       
  1238 
       
  1239 	$pkgFilewithRUAndSA = "testsysRUWithSA.pkg";
       
  1240 	$sisFile = "testsysRUWithSA.sis";
       
  1241 	$LogFile = "testsysRUWithSA.log";
       
  1242 	
       
  1243 
       
  1244 	WriteLog("CR1027 - Test for successful creation of a sis file with the ROM Upgrade install flag RU with the right install type SA.\n");
       
  1245 
       
  1246 	# Generate test PKG file contents for embedding pkg file.
       
  1247 	$PkgFile = sprintf( $PkgFileRUWithSA, "-1,-1,-1"); 
       
  1248 
       
  1249 	# Create PKG file
       
  1250 	CreateFile($pkgFilewithRUAndSA, $PkgFile);	
       
  1251 	
       
  1252 		
       
  1253 	# Create an embedding sis file
       
  1254 	my $result = system("$makesisExeLocation $pkgFilewithRUAndSA  $sisFile > $LogFile");
       
  1255 	
       
  1256 	$NumberOfTests++;
       
  1257 	if ($result == 0 ) 
       
  1258 		{
       
  1259 		$NumberOfPassed++;
       
  1260 		WriteLog("Passed\n\n");
       
  1261 		}
       
  1262 	else 
       
  1263 		{
       
  1264 		$NumberOfFailed++;
       
  1265 		WriteLog("Failed\n\n");
       
  1266 		}
       
  1267 
       
  1268 	unlink $pkgFilewithRUAndSA;
       
  1269 	unlink $sisFile;
       
  1270 	unlink $LogFile	
       
  1271 }
       
  1272 
       
  1273 
       
  1274 
       
  1275 #
       
  1276 # New test code for CR1027 - SA ROM Upgrade  
       
  1277 # This test checks for the un-successful creation of sis file when PKG file contains the newly added ( as part of CR1027 ) 
       
  1278 # ROM upgrade capability install flag RU with the wrong install type other than SA, PU & SP (like PA & PP.).
       
  1279 # 
       
  1280 
       
  1281 sub TestSisRUWithNonSA {
       
  1282 
       
  1283 	$pkgFilewithRUAndNonSA = "testsysRUWithNonSA.pkg";
       
  1284 	$sisFile = "testsysRUWithNonSA.sis";
       
  1285 	$LogFile = "testsysRUWithNonSA.log";
       
  1286 	
       
  1287 
       
  1288 	WriteLog("CR1027 - Test for Un-successful creation of a sis file with the ROM Upgrade install flag RU with the wrong install type, anything other than SA.\n");
       
  1289 
       
  1290 	# Generate test PKG file contents for embedding pkg file.
       
  1291 	$PkgFile = sprintf( $PkgFileRUWithNonSA, "-1,-1,-1"); 
       
  1292 
       
  1293 	# Create PKG file
       
  1294 	CreateFile($pkgFilewithRUAndNonSA, $PkgFile);	
       
  1295 	
       
  1296 		
       
  1297 	# Create an embedding sis file
       
  1298 	my $result = system("$makesisExeLocation $pkgFilewithRUAndNonSA  $sisFile > $LogFile");
       
  1299 	
       
  1300 	
       
  1301 	$NumberOfTests++;
       
  1302 	if ($result != 0 ) 
       
  1303 		{
       
  1304 		$NumberOfPassed++;
       
  1305 		WriteLog("Passed\n\n");
       
  1306 		}
       
  1307 	else 
       
  1308 		{
       
  1309 		$NumberOfFailed++;
       
  1310 		WriteLog("Failed\n\n");
       
  1311 		}
       
  1312 
       
  1313 	unlink $pkgFilewithRUAndNonSA;
       
  1314 	unlink $sisFile;
       
  1315 	unlink $LogFile	
       
  1316 }
       
  1317 
       
  1318 #
       
  1319 # New test code for CR1122 - WildCard Support for ROM Stubs.
       
  1320 # This test checks for the successful creation of sis file when PKG file contains the wildcard charetors(? and *) in it. 
       
  1321 # These packages can be upgraded (eclipsed) in much wider way as per the wildcard charector's behaviour.
       
  1322 # 
       
  1323 
       
  1324 sub TestSISWithWildCards {
       
  1325 
       
  1326 	$pkgFilewithWildCards = "testSysWithWildCards.pkg";
       
  1327 	$sisFile = "testSysWithWildCards.sis";
       
  1328 	$LogFile = "testSysWithWildCards.log";
       
  1329 	
       
  1330 
       
  1331 	WriteLog("CR1122 - Test for successful creation of a sis file for wildcarded ROM stub package file.\n");
       
  1332 
       
  1333 	# Generate test PKG file contents for embedding pkg file.
       
  1334 	$PkgFile = sprintf( $WildCardedpkgFile, "-1,-1,-1"); 
       
  1335 
       
  1336 	# Create PKG file
       
  1337 	CreateFile($pkgFilewithWildCards, $PkgFile);	
       
  1338 	
       
  1339 		
       
  1340 	# Create an embedding sis file
       
  1341 	my $result = system("$makesisExeLocation -s $pkgFilewithWildCards  $sisFile > $LogFile");
       
  1342 	
       
  1343 	
       
  1344 	$NumberOfTests++;
       
  1345 	if ($result == 0 ) 
       
  1346 		{
       
  1347 		$NumberOfPassed++;
       
  1348 		WriteLog("Passed\n\n");
       
  1349 		}
       
  1350 	else 
       
  1351 		{
       
  1352 		$NumberOfFailed++;
       
  1353 		WriteLog("Failed\n\n");
       
  1354 		}
       
  1355 
       
  1356 	unlink $pkgFilewithWildCards;
       
  1357 	unlink $sisFile;
       
  1358 	unlink $LogFile;
       
  1359 }
       
  1360 
       
  1361 
       
  1362 #
       
  1363 # New test code for CR1122 - WildCard Support for ROM Stubs.
       
  1364 # This test checks for the Un-successful creation of sis file when PKG file contains the wildcard charetors(? and *) and PA install type in it.
       
  1365 # 
       
  1366 
       
  1367 sub TestSISWithWildCardsPA {
       
  1368 
       
  1369 	$pkgFilewithWildCards = "testSysWithWildCards.pkg";
       
  1370 	$sisFile = "testSysWithWildCards.sis";
       
  1371 	$LogFile = "testSysWithWildCards.log";
       
  1372 	
       
  1373 
       
  1374 	WriteLog("CR1122 - Test for un-successful creation of a SIS file for wildcarded PA package file.\n");
       
  1375 
       
  1376 	# Generate test PKG file contents for embedding pkg file.
       
  1377 	$PkgFile = sprintf( $WildCardedPApkgFile, "-1,-1,-1"); 
       
  1378 
       
  1379 	# Create PKG file
       
  1380 	CreateFile($pkgFilewithWildCards, $PkgFile);	
       
  1381 	
       
  1382 		
       
  1383 	# Create an embedding sis file
       
  1384 	my $result = system("$makesisExeLocation $pkgFilewithWildCards  $sisFile > $LogFile");
       
  1385 	
       
  1386 	
       
  1387 	$NumberOfTests++;
       
  1388 	if ($result != 0 ) 
       
  1389 		{
       
  1390 		$NumberOfPassed++;
       
  1391 		WriteLog("Passed\n\n");
       
  1392 		}
       
  1393 	else 
       
  1394 		{
       
  1395 		$NumberOfFailed++;
       
  1396 		WriteLog("Failed\n\n");
       
  1397 		}
       
  1398 
       
  1399 	unlink $pkgFilewithWildCards;
       
  1400 	unlink $sisFile;
       
  1401 	unlink $LogFile;
       
  1402 }
       
  1403 
       
  1404 
       
  1405 #
       
  1406 # New test code for CR1122 - WildCard Support for ROM Stubs.
       
  1407 # This test checks for the Un-successful creation of sis file when PKG file contains the wildcard charetors(? and *) and PP install type in it.
       
  1408 #
       
  1409 sub TestSISWithWildCardsPP {
       
  1410 
       
  1411 	$pkgFilewithWildCards = "testSysWithWildCards.pkg";
       
  1412 	$sisFile = "testSysWithWildCards.sis";
       
  1413 	$LogFile = "testSysWithWildCards.log";
       
  1414 	
       
  1415 
       
  1416 	WriteLog("CR1122 - Test for un-successful creation of a SIS file for wildcarded PA package file.\n");
       
  1417 
       
  1418 	# Generate test PKG file contents for embedding pkg file.
       
  1419 	$PkgFile = sprintf( $WildCardedPPpkgFile, "-1,-1,-1"); 
       
  1420 
       
  1421 	# Create PKG file
       
  1422 	CreateFile($pkgFilewithWildCards, $PkgFile);	
       
  1423 	
       
  1424 		
       
  1425 	# Create an embedding sis file
       
  1426 	my $result = system("$makesisExeLocation $pkgFilewithWildCards  $sisFile > $LogFile");
       
  1427 	
       
  1428 	
       
  1429 	$NumberOfTests++;
       
  1430 	if ($result != 0 ) 
       
  1431 		{
       
  1432 		$NumberOfPassed++;
       
  1433 		WriteLog("Passed\n\n");
       
  1434 		}
       
  1435 	else 
       
  1436 		{
       
  1437 		$NumberOfFailed++;
       
  1438 		WriteLog("Failed\n\n");
       
  1439 		}
       
  1440 
       
  1441 	unlink $pkgFilewithWildCards;
       
  1442 	unlink $sisFile;
       
  1443 	unlink $LogFile;
       
  1444 }
       
  1445 
       
  1446 
       
  1447 sub TestSingleCharFilename {
       
  1448 
       
  1449 	$pkgFileName = "temp.pkg";
       
  1450 	$sisFile = "t.sis";
       
  1451 	$LogFile = "singleCharFilename.log";
       
  1452 	
       
  1453 	WriteLog("Test for successful creation of a sis file with a single char in its filename.\n"); #DEF108728
       
  1454 
       
  1455 	# Generate test PKG file contents for embedding pkg file.
       
  1456 	$PkgFile = sprintf( $PkgFileTemp2, "-1,-1,-1"); 
       
  1457 
       
  1458 	# Create PKG file
       
  1459 	CreateFile($pkgFileName, $PkgFile);	
       
  1460 			
       
  1461 	# Create an embedding sis file
       
  1462 	my $result = system("$makesisExeLocation $pkgFileName $sisFile > $LogFile");
       
  1463 	
       
  1464 	
       
  1465 	$NumberOfTests++;
       
  1466 	if ($result == 0 ) 
       
  1467 		{
       
  1468 		$NumberOfPassed++;
       
  1469 		WriteLog("Passed\n\n");
       
  1470 		}
       
  1471 	else 
       
  1472 		{
       
  1473 		$NumberOfFailed++;
       
  1474 		WriteLog("Failed with result $result\n\n");
       
  1475 		}
       
  1476 
       
  1477 	unlink $pkgFileName;
       
  1478 	unlink $sisFile;
       
  1479 	unlink $LogFile
       
  1480 }
       
  1481 
       
  1482 
       
  1483 #
       
  1484 # Test code for DEF111264 - Makesis should warn if wildcards are used in the \sys\bin\ directory in ROM stubs .
       
  1485 # This test checks verifies that a warning is generated when a ROM Stub file contains an exe with wildcards(* or ?) specified . 
       
  1486 # 
       
  1487 
       
  1488 sub TestDEF111264 {
       
  1489 
       
  1490 	$pkgFile = "ROMStubWildCardWarning.pkg";
       
  1491 	$sisFile = "ROMStubWildCardWarning.sis";
       
  1492 	$LogFile = "ROMStubWildCardWarning.log";
       
  1493 	$ExpectedLogFile = "ROMStubWildCardExpected.log";
       
  1494 
       
  1495 	WriteLog("DEF111264 - Makesis should warn if wildcards are used in the \sys\bin\ directory in ROM stubs.\n");
       
  1496 
       
  1497 	# Generate test PKG file contents for pkg file.
       
  1498 	$PkgFile = sprintf( $ExeWithWildCardpkgFile, "-1,-1,-1"); 
       
  1499 	
       
  1500 	# Create PKG file
       
  1501 	CreateFile($pkgFile, $PkgFile);	
       
  1502 
       
  1503 	# Create expected log file
       
  1504 	my $trailingData = "Created  $sisFile.";
       
  1505 	my $OutputData = "Processing $pkgFile...\n$DEF111264ExpectedOutput$trailingData";
       
  1506 	
       
  1507 	CreateFile($ExpectedLogFile ,$OutputData);
       
  1508 
       
  1509 	# Create a sis file
       
  1510 	my $result = system("/epoc32/tools/makesis -s $pkgFile  $sisFile > $LogFile");
       
  1511 
       
  1512 	use File::Compare;
       
  1513 	my $result1;
       
  1514 	
       
  1515 	if(compare($LogFile ,$ExpectedLogFile)== 0)
       
  1516 		{ 
       
  1517 		$result1 = 0;			
       
  1518 		}
       
  1519 	else
       
  1520 		{
       
  1521 		$result1 = 1;
       
  1522 		}
       
  1523 
       
  1524 	$NumberOfTests++;
       
  1525 	
       
  1526 	if ($result == 0 && $result1 == 0) 
       
  1527 		{
       
  1528 		$NumberOfPassed++;
       
  1529 		WriteLog("Passed\n\n");
       
  1530 		}
       
  1531 	else 
       
  1532 		{
       
  1533 		$NumberOfFailed++;
       
  1534 		WriteLog("Failed\n\n");
       
  1535 		}
       
  1536 
       
  1537 	unlink $pkgFile; 
       
  1538 	unlink $sisFile;
       
  1539 	unlink $LogFile;
       
  1540 	unlink $ExpectedLogFile;
       
  1541 }
       
  1542 
       
  1543 
       
  1544 #
       
  1545 # Test code for DEF113349 - Attempting to embed a PP SIS file in an SA SIS file causes makesis to crash.
       
  1546 # This test checks verifies that a warning is generated when attempted to embed a PP/PA SIS file in an SA SIS. 
       
  1547 # 
       
  1548 
       
  1549 sub TestDEF113349 {
       
  1550 
       
  1551 	$pkgEmbeddedFile = "EmdeddedPA.pkg";
       
  1552 	$sisEmbeddedFile = "EmbeddedPA.sis";
       
  1553 	$pkgFile = "EmdeddingPA.pkg";
       
  1554 	$sisFile = "EmbeddingPA.sis";
       
  1555 	$LogFile = "DEF113349.log";
       
  1556 	$ExpectedLogFile = "DEF113349Expected.log";
       
  1557 
       
  1558 	WriteLog("DEF113349 - Attempting to embed a PP SIS file in an SA SIS file causes makesis to crash.\n");
       
  1559 
       
  1560 	# Generate test PKG file contents for the embedded pkg file.
       
  1561 	$PkgFile = sprintf( $EmbeddedPApkgFile, "-1,-1,-1"); 
       
  1562 	
       
  1563 	# Create PKG file
       
  1564 	CreateFile($pkgEmbeddedFile, $PkgFile);	
       
  1565 
       
  1566 	# Create SIS file for the embedded package of type = PA.
       
  1567 	my $result = system("/epoc32/tools/makesis $pkgEmbeddedFile $sisEmbeddedFile > $LogFile");
       
  1568 
       
  1569 	# Generate test PKG file contents for embedding pkg file.
       
  1570 	$PkgFile = sprintf( $EmbeddingPApkgFile, "-1,-1,-1"); 
       
  1571 	
       
  1572 	# Create PKG file
       
  1573 	CreateFile($pkgFile , $PkgFile);	
       
  1574 	
       
  1575 	# Create SIS file for the embedding package of type = SA.
       
  1576 	my $result1 = system("/epoc32/tools/makesis $pkgFile $sisFile > $LogFile");
       
  1577 	
       
  1578 	my $OutputData = "Processing $pkgFile...\n$DEF113349ExpectedOutput";
       
  1579 	
       
  1580 	# Create expected log file
       
  1581 	CreateFile($ExpectedLogFile ,$OutputData);
       
  1582 
       
  1583 	use File::Compare;
       
  1584 	my $result2;
       
  1585 	
       
  1586 	if(compare($LogFile ,$ExpectedLogFile)== 0)
       
  1587 		{ 
       
  1588 		$result2 = 0;			
       
  1589 		}
       
  1590 	else
       
  1591 		{
       
  1592 		$result2 = 1;
       
  1593 		}
       
  1594 
       
  1595 	$NumberOfTests++;
       
  1596 	
       
  1597 	if ($result == 0 && $result1 == 256 && $result2 == 0) 
       
  1598 		{
       
  1599 		$NumberOfPassed++;
       
  1600 		WriteLog("Passed\n\n");
       
  1601 		}
       
  1602 	else 
       
  1603 		{
       
  1604 		$NumberOfFailed++;
       
  1605 		WriteLog("Failed\n\n");
       
  1606 		}
       
  1607 	
       
  1608 	unlink $pkgEmbeddedFile;
       
  1609 	unlink $sisEmbeddedFile;
       
  1610 	unlink $pkgFile; 
       
  1611 	unlink $sisFile;
       
  1612 	unlink $LogFile;
       
  1613 	unlink $ExpectedLogFile;
       
  1614 }
       
  1615 
       
  1616 #
       
  1617 # Test code for DEF113116 : It is not possible to abort an installation without causing an error. 
       
  1618 # This test checks for the successful creation of sis file when pkg file contains a new display text option
       
  1619 # ForceAbort (FA).
       
  1620 # 
       
  1621 
       
  1622 
       
  1623 sub TestDEF113116 {
       
  1624 
       
  1625 	$pkgFile = "textoption_FA.pkg";
       
  1626 	$sisFile = "textoption_FA.sis";
       
  1627 	$LogFile = "textoption_FA.log";
       
  1628 	$DumpsisGenPkgPath = "\/textoption_FA";
       
  1629 
       
  1630 	WriteLog("DEF113116 : Test MakeSIS and DumpSIS support for ForceAbort (FA) text option.\n");
       
  1631 
       
  1632 	# Generate test PKG file contents for embedding pkg file.
       
  1633 	$PkgFile = sprintf( $PkgFileWithFAOption, "-1,-1,-1"); 
       
  1634 
       
  1635 	# Create PKG file
       
  1636 	CreateFile($pkgFile , $PkgFile);	
       
  1637 
       
  1638 	# Create sis file using MakeSIS
       
  1639 	my $result = system("$makesisExeLocation $pkgFile $sisFile > $LogFile");
       
  1640 
       
  1641 	# Recreate pkg file using DumpSIS.
       
  1642 	my $result1 = system("$dumpsisExeLocation $sisFile > $LogFile");
       
  1643 	
       
  1644 	$NumberOfTests++;
       
  1645 	if ($result == 0 && $result1 == 0) 
       
  1646 		{
       
  1647 		$NumberOfPassed++;
       
  1648 		WriteLog("Passed\n\n");
       
  1649 		}
       
  1650 	else 
       
  1651 		{
       
  1652 		$NumberOfFailed++;
       
  1653 		WriteLog("Failed\n\n");
       
  1654 		}
       
  1655 
       
  1656 	use cwd;
       
  1657 	$dir = cwd;
       
  1658 
       
  1659 	unlink $pkgFile;
       
  1660 	unlink $sisFile;
       
  1661 	unlink $LogFile;
       
  1662 
       
  1663 	use File::Path;
       
  1664 	rmtree "$dir$DumpsisGenPkgPath";
       
  1665 	
       
  1666 }
       
  1667 
       
  1668 #
       
  1669 # Test code for Makesis -c option.
       
  1670 # This test verifies that errors are reported where the SIS file being generated will not be installable by InterpretSIS.
       
  1671 # 
       
  1672 
       
  1673 sub TestInterpretsisReport {
       
  1674 
       
  1675 	$pkgEmbeddedFile = "Emdedded.pkg";
       
  1676 	$sisEmbeddedFile = "Embedded.sis";
       
  1677 	$pkgFile = "Interpretsis.pkg";
       
  1678 	$sisFile = "Interpretsis.sis";
       
  1679 	$LogFile = "Interpretsis.log";
       
  1680 	$ExpectedLogFile = "InterpretsisExpected.log";
       
  1681 
       
  1682 	WriteLog("Makesis -c\n");
       
  1683 
       
  1684 	# Generate test PKG file contents for the embedded pkg file.
       
  1685 	$PkgFile = sprintf( $PkgFileTempl, "-1,-1,-1"); 
       
  1686 	
       
  1687 	# Create PKG file
       
  1688 	CreateFile($pkgEmbeddedFile, $PkgFile);	
       
  1689 
       
  1690 	# Create SIS file for the embedded package.
       
  1691 	my $result = system("/epoc32/tools/makesis $pkgEmbeddedFile $sisEmbeddedFile > $LogFile");
       
  1692 
       
  1693 	# Generate test PKG file contents for embedding pkg file.
       
  1694 	$PkgFile = sprintf( $PkgFileInterpretsisVersionTemplate, "-1,-1,-1"); 
       
  1695 	
       
  1696 	# Create PKG file
       
  1697 	CreateFile($pkgFile , $PkgFile);	
       
  1698 	
       
  1699 	# Create SIS file for the embedding package of type = SA.
       
  1700 	my $result1 = system("/epoc32/tools/makesis -c $pkgFile $sisFile > $LogFile");
       
  1701 	
       
  1702 	# Create expected log file
       
  1703 	my $trailingData = "Created  $sisFile.";
       
  1704 	my $OutputData = "Processing $pkgFile...\n$InterpretsisExpectedOutput$trailingData";
       
  1705 	
       
  1706 	CreateFile($ExpectedLogFile ,$OutputData);
       
  1707 	
       
  1708 	use File::Compare;
       
  1709 	my $result2;
       
  1710 	
       
  1711 	if(compare($LogFile ,$ExpectedLogFile)== 0)
       
  1712 		{ 
       
  1713 		$result2 = 0;			
       
  1714 		}
       
  1715 	else
       
  1716 		{
       
  1717 		$result2 = 1;
       
  1718 		}
       
  1719 
       
  1720 	$NumberOfTests++;
       
  1721 	
       
  1722 	if ($result == 0 && $result1 == 256 && $result2 == 0) 
       
  1723 		{
       
  1724 		$NumberOfPassed++;
       
  1725 		WriteLog("Passed\n\n");
       
  1726 		}
       
  1727 	else 
       
  1728 		{
       
  1729 		$NumberOfFailed++;
       
  1730 		WriteLog("Failed\n\n");
       
  1731 		}
       
  1732 	
       
  1733 	unlink $pkgEmbeddedFile;
       
  1734 	unlink $sisEmbeddedFile;
       
  1735 	unlink $pkgFile; 
       
  1736 	unlink $sisFile;
       
  1737 	unlink $LogFile;
       
  1738 	unlink $ExpectedLogFile;
       
  1739 }
       
  1740 
       
  1741 #
       
  1742 # Main
       
  1743 #
       
  1744 # Create environment and control test flow to testing MAKESIS.EXE 
       
  1745 # (generate text.txt, pkg file, test makesis and check the result)
       
  1746 #
       
  1747 
       
  1748 unlink($logFile);
       
  1749 WriteLog("makesis test.\n\n");
       
  1750 
       
  1751 #
       
  1752 # Generate test.txt this is the only one element of every PKGs.
       
  1753 #
       
  1754 $contents = "This is a test text.";
       
  1755 CreateFile('TEST.txt', $contents);
       
  1756 
       
  1757 #
       
  1758 # Generate HelloApp.exe this is the only one element of every PKGs.
       
  1759 #
       
  1760 $contents = "This is a test exe.";
       
  1761 CreateFile('HelloApp.exe', $contents);
       
  1762 
       
  1763 #
       
  1764 # Counters for results
       
  1765 #
       
  1766 $NumberOfTests  = 0;
       
  1767 $NUmberOfPassed = 0;
       
  1768 $NumberOfFailed = 0;
       
  1769 
       
  1770 #
       
  1771 # Array of contents of test pkgs and expected results
       
  1772 #
       
  1773 #                file name,            	range,      		expected, expected log,            		Title
       
  1774 #                                	(from)      (to)   	result    message
       
  1775 #               ----------------------------------------------------------------------------------------------------------------------------------------- 
       
  1776 @TestItems = (	["test01.pkg", 		"-1,-1,-1",		0,	"Generating SIS installation file...",	"Range not specified 1."],
       
  1777 		["test02.pkg", 		"-1,-1,-1 ~ -1,-1,-1",	0,	"Generating SIS installation file...",	"Range not specified 2."],
       
  1778 		["test03.pkg", 		"1, 0, 0",		0,	"Generating SIS installation file...",	"Only from specified 1."],
       
  1779 		["test04.pkg", 		"1,-1,-1 ~ -1,-1,-1",	0,	"Generating SIS installation file...",	"Only from specified 2."],
       
  1780 		["test05.pkg", 		"1,-1,-1 ~  2,-1,-1",	0,	"Generating SIS installation file...",	"Correct from and to specified."],
       
  1781 		["test06.pkg", 		"-1,-1,-1 ~  2,-1,-1",	0,	"Generating SIS installation file...",	"Only to specified."],
       
  1782 		["test07.pkg", 		"1,-1,-1 ~  1,-1,-1",	0,	"Generating SIS installation file...", 	"Correct. Same Major, not minor specified."],
       
  1783 		["test08.pkg", 		"1, 1,-1 ~  1, 1,-1",	0,	"Generating SIS installation file...", 	"Correct. Same Major, minor and not build specified."],		
       
  1784 		["test09.pkg", 		"1, 1,-1 ~  1, 2,-1",	0,	"Generating SIS installation file...",	"Correct. Same Major and differ minor specified."],
       
  1785 		["test10.pkg", 		"1, 1, 1 ~  1, 1, 2",	0,	"Generating SIS installation file...",	"Correct. Same Major, Minor and differ build specified."],
       
  1786 		["test11.pkg", 		"1, 1,-1 ~  1, 1, 2",	0,	"Generating SIS installation file...",	"Correct. Same Major, Minor and differ build specified."],
       
  1787 		["test12.pkg", 		"1, 1, 1 ~  1, 1, 1",	0,	"Generating SIS installation file...",	"Correct. Same Major, minor and build specified."],
       
  1788 		["test13.pkg", 		"4,-1,-1 ~  2,-1,-1",	256,	"verification failure",			"Wrong range of major of from and to."],
       
  1789 		["test14.pkg", 		"1, 2,-1 ~  1, 1,-1",	256,	"verification failure",			"Wrong range of minor of from and to."],
       
  1790 		["test15.pkg", 		"1, 2, 2 ~  1, 2, 1", 	256,	"verification failure",			"Wrong range of build of from and to."],
       
  1791 		["test16.pkg", 		"1,-1,-1 ~  2,1,1 ",	256,	"invalid destination path or syntax",	"exe name contains non ascii characters."],
       
  1792 		["test17.pkg", 		"1,-1,-1 ~  2,1,1 ",	256,	"invalid destination path or syntax",	"package file encoding is not supported."],
       
  1793 		["testForward.pkg", 	"1,-1,-1 ~  2,1,1 ",	0,	"Generating SIS installation file...",	"package file can have forward slash."],
       
  1794 		["testFN_RI.pkg", 	"1,0,0 ~ 1,0,0", 0, "Generating SIS installation file...", "DEF126367: Check interaction between FN and RI."]
       
  1795 	     );
       
  1796 
       
  1797 
       
  1798 # For DEF92320
       
  1799 # Test for filename & Dir name, should not contain symbols like |,/,<,>,:,?,*
       
  1800 # Array of contents of test pkgs 
       
  1801 #
       
  1802 #              	file name,     		symbols ,  	expected , 	expected log,            		Title
       
  1803 #                                			result     	message
       
  1804 #               -------------------------------------------------------------------------------------------------------------------------- 
       
  1805 @TestItems1 = (	["test01.pkg", 		"*", 		256,		"invalid destination path or syntax", 	"File paths should not contain *,:,<,>"],
       
  1806 		["test02.pkg", 		"\"<42>\"", 	256,		"invalid destination path or syntax",	"File paths should not contain *,:,<,>"],
       
  1807 		["test03.pkg", 		"?", 		256,		"invalid destination path or syntax",	"File paths should not contain *,:,<,>"],
       
  1808 		["test05.pkg", 		" \"", 		256,		"error: unknown line",			"File paths should not contain *,:,<,>"],
       
  1809 		["test06.pkg", 		"<", 		256,		"invalid destination path or syntax",	"File paths should not contain *,:,<,>"],
       
  1810 		["test07.pkg", 		">",  		256,		"invalid destination path or syntax",	"File paths should not contain *,:,<,>"],
       
  1811 		["test08.pkg", 		"|",  		256,		"invalid destination path or syntax",	"File paths should not contain *,:,<,>"],
       
  1812 		["test11.pkg",  	"\"<58>\"",	256,		"invalid destination path or syntax",	"File paths should not contain *,:,<,>"],
       
  1813 		["test12.pkg", 		":",		256,		"invalid destination path or syntax",	"File paths should not contain *,:,<,>"],
       
  1814 		["test13.pkg",   	"\"<63>\"",	256,		"invalid destination path or syntax",	"File paths should not contain *,:,<,>"],
       
  1815 		["test14.pkg", 		"\"<34>\"", 	256,		"invalid destination path or syntax",	"File paths should not contain *,:,<,>"],
       
  1816 		["test15.pkg", 		"\"<62>\"", 	256,		"invalid destination path or syntax",	"File paths should not contain *,:,<,>"],
       
  1817 		["test16.pkg", 		"\"<124>\"", 	256,	 	"invalid destination path or syntax",	"File paths should not contain *,:,<,>"],
       
  1818 		["test17.pkg", 		"\"<60>\"", 	256,		"invalid destination path or syntax",	"File paths should not contain *,:,<,>"],
       
  1819 		["test18.pkg", 		"\"<92>\"", 	0,		"Generating SIS installation file...",	"contain \\"],
       
  1820 		["test19.pkg", 		"*", 		256,		"invalid destination path or syntax",	"DIR paths should not contain *,:,<,>"],
       
  1821 		["test20.pkg", 		"\"<42>\"", 	256,		"invalid destination path or syntax",	"DIR paths should not contain *,:,<,>"],
       
  1822 		["test21.pkg", 		"?", 		256,		"invalid destination path or syntax",	"DIR paths should not contain *,:,<,>"],
       
  1823 		["test23.pkg", 		" \"", 		256,		"error: unknown line",			"DIR paths should not contain *,:,<,>"],
       
  1824 		["test24.pkg", 		"<", 		256,		"invalid destination path or syntax",	"DIR paths should not contain *,:,<,>"],
       
  1825 		["test25.pkg", 		">",  		256,		"invalid destination path or syntax",	"DIR paths should not contain *,:,<,>"],
       
  1826 		["test26.pkg", 		"|",  		256,		"invalid destination path or syntax",	"DIR paths should not contain *,:,<,>"],
       
  1827 		["test28.pkg", 		"\"<58>\"",	256,		"invalid destination path or syntax",	"DIR paths should not contain *,:,<,>"],
       
  1828 		["test29.pkg", 		":",		256,		"invalid destination path or syntax",	"DIR paths should not contain *,:,<,>"],
       
  1829 		["test30.pkg", 		"\"<63>\"",	256,		"invalid destination path or syntax",	"DIR paths should not contain *,:,<,>"],
       
  1830 		["test31.pkg", 		"\"<34>\"", 	256,		"invalid destination path or syntax",	"DIR paths should not contain *,:,<,>"],
       
  1831 		["test32.pkg", 		"\"<62>\"", 	256,		"invalid destination path or syntax",	"DIR paths should not contain *,:,<,>"],
       
  1832 		["test33.pkg", 		"\"<124>\"", 	256,		"invalid destination path or syntax",	"DIR paths should not contain *,:,<,>"],
       
  1833 		["test34.pkg", 		"\"<60>\"", 	256,		"invalid destination path or syntax",	"DIR paths should not contain *,:,<,>"],
       
  1834 		["test35.pkg", 		"\"<92>\"", 	0,		"Generating SIS installation file...",	"DIR pcontain\\"],
       
  1835 	    );
       
  1836 
       
  1837 
       
  1838 
       
  1839 # CR1125 - Add Package Versions to SIS File Conditionals Test Cases
       
  1840 # Array of test PKG data and expected results for each test case and associated itterations
       
  1841 #
       
  1842 #              	file name,	conditional statement,			Expected,	Expected					Test Case ID
       
  1843 #									result		log
       
  1844 #               ------------------------------------------------------------------------------------------------------------------------------------ 
       
  1845 @TestItems2 = (	["test01.pkg", "VERSION(0xE1000001,=,1,2,3)",		0,		"Generating SIS installation file...",		"CR1125 SEC-SWI-PKGVER-A001 : A"],
       
  1846 		["test02.pkg", "VERSION(0xE1000001,<>,1,2,3)",		0,		"Generating SIS installation file...",		"CR1125 SEC-SWI-PKGVER-A001 : B"],
       
  1847 		["test03.pkg", "VERSION(0xE1000001,>,1,2,3)",		0,		"Generating SIS installation file...",		"CR1125 SEC-SWI-PKGVER-A001 : C"],
       
  1848 		["test04.pkg", "VERSION(0xE1000001,>=,1,2,3)",		0,		"Generating SIS installation file...",		"CR1125 SEC-SWI-PKGVER-A001 : D"],
       
  1849 		["test05.pkg", "VERSION(0xE1000001,<,1,2,3)",		0,		"Generating SIS installation file...",		"CR1125 SEC-SWI-PKGVER-A001 : E"],
       
  1850 		["test06.pkg", "VERSION(0xE1000001,<=,1,2,3)",		0,		"Generating SIS installation file...",		"CR1125 SEC-SWI-PKGVER-A001 : F"],
       
  1851 		["test07.pkg", "VERSION(test,=,1,2,3)",			256,		"Expected numeric value read alphanumeric value",	"CR1125 SEC-SWI-PKGVER-A002 : A"],
       
  1852 		["test08.pkg", "VERSION(0xE1000001,test,1,2,3)",	256,		"Invalid Relational Operator",			"CR1125 SEC-SWI-PKGVER-A002 : B"],
       
  1853 		["test09.pkg", "VERSION(0xE1000001,=,test,2,3)",	256,		"Expected numeric value read alphanumeric value",	"CR1125 SEC-SWI-PKGVER-A002 : C"],
       
  1854 		["test10.pkg", "VERSION(0xE1000001,=,1,test,3)",	256,		"Expected numeric value read alphanumeric value",	"CR1125 SEC-SWI-PKGVER-A002 : D"],
       
  1855 		["test11.pkg", "VERSION(0xE1000001,=,1,2,test)",	256,		"Expected numeric value read alphanumeric value",	"CR1125 SEC-SWI-PKGVER-A002 : E"],
       
  1856 		["test12.pkg", "VERSION(0xE1000001,=,-2,2,3)",		256,		"Negative version components are not supported",	"CR1125 SEC-SWI-PKGVER-A003 : A"],
       
  1857 		["test13.pkg", "VERSION(0xE1000001,=,-1,2,3)",		256,		"Wildcards are not supported",			"CR1125 SEC-SWI-PKGVER-A003 : B"],
       
  1858 		["test14.pkg", "VERSION(0xE1000001,=,0,2,3)",		0,		"Generating SIS installation file...",		"CR1125 SEC-SWI-PKGVER-A003 : C"],
       
  1859 		["test15.pkg", "VERSION(0xE1000001,=,1,2,3)",		0,		"Generating SIS installation file...",		"CR1125 SEC-SWI-PKGVER-A003 : D"],
       
  1860 		["test16.pkg", "VERSION(0xE1000001,=,126,2,3)",		0,		"Generating SIS installation file...",		"CR1125 SEC-SWI-PKGVER-A003 : E"],
       
  1861 		["test17.pkg", "VERSION(0xE1000001,=,127,2,3)",		0,		"Generating SIS installation file...",		"CR1125 SEC-SWI-PKGVER-A003 : F"],
       
  1862 		["test18.pkg", "VERSION(0xE1000001,=,128,2,3)",		0,		"Warning : The valid version number ranges are :",		"CR1125 SEC-SWI-PKGVER-A003 : G"],
       
  1863 		["test19.pkg", "VERSION(0xE1000001,=,1,-2,3)",		256,		"Negative version components are not supported",	"CR1125 SEC-SWI-PKGVER-A003 : H"],
       
  1864 		["test20.pkg", "VERSION(0xE1000001,=,1,-1,3)",		256,		"Wildcards are not supported",			"CR1125 SEC-SWI-PKGVER-A003 : I"],
       
  1865 		["test21.pkg", "VERSION(0xE1000001,=,1,0,3)",		0,		"Generating SIS installation file...",		"CR1125 SEC-SWI-PKGVER-A003 : J"],
       
  1866 		["test22.pkg", "VERSION(0xE1000001,=,1,1,3)",		0,		"Generating SIS installation file...",		"CR1125 SEC-SWI-PKGVER-A003 : K"],
       
  1867 		["test23.pkg", "VERSION(0xE1000001,=,1,98,3)",		0,		"Generating SIS installation file...",		"CR1125 SEC-SWI-PKGVER-A003 : L"],
       
  1868 		["test24.pkg", "VERSION(0xE1000001,=,1,99,3)",		0,		"Generating SIS installation file...",		"CR1125 SEC-SWI-PKGVER-A003 : M"],
       
  1869 		["test25.pkg", "VERSION(0xE1000001,=,1,100,3)",		0,		"Warning : The valid version number ranges are :",		"CR1125 SEC-SWI-PKGVER-A003 : N"],
       
  1870 		["test26.pkg", "VERSION(0xE1000001,=,1,2,-2)",		256,		"Negative version components are not supported",	"CR1125 SEC-SWI-PKGVER-A003 : O"],
       
  1871 		["test27.pkg", "VERSION(0xE1000001,=,1,2,-1)",		256,		"Wildcards are not supported",			"CR1125 SEC-SWI-PKGVER-A003 : P"],
       
  1872 		["test28.pkg", "VERSION(0xE1000001,=,1,2,0)",		0,		"Generating SIS installation file...",		"CR1125 SEC-SWI-PKGVER-A003 : Q"],
       
  1873 		["test29.pkg", "VERSION(0xE1000001,=,1,2,1)",		0,		"Generating SIS installation file...",		"CR1125 SEC-SWI-PKGVER-A003 : R"],
       
  1874 		["test30.pkg", "VERSION(0xE1000001,=,1,2,32766)",	0,		"Generating SIS installation file...",		"CR1125 SEC-SWI-PKGVER-A003 : S"],
       
  1875 		["test31.pkg", "VERSION(0xE1000001,=,1,2,32767)",	0,		"Generating SIS installation file...",		"CR1125 SEC-SWI-PKGVER-A003 : T"],
       
  1876 		["test32.pkg", "VERSION(0xE1000001,=,1,2,32768)",	0,		"Warning : The valid version number ranges are :",		"CR1125 SEC-SWI-PKGVER-A003 : U"],
       
  1877 		["test33.pkg", "VERSION(0xE1000001,=,*,2,3)",		256,		"Wildcards are not supported",	"CR1125 SEC-SWI-PKGVER-A004 : A"],
       
  1878 		["test34.pkg", "VERSION(0xE1000001,=,1,*,3)",		256,		"Wildcards are not supported",	"CR1125 SEC-SWI-PKGVER-A004 : B"],
       
  1879 		["test35.pkg", "VERSION(0xE1000001,=,1,2,*)",		256,		"Wildcards are not supported",	"CR1125 SEC-SWI-PKGVER-A004 : C"],
       
  1880 		["test36.pkg", "VERSION(0xE1000001,=,1,2,)",		256,		"Expected numeric value read ",	"CR1125 SEC-SWI-PKGVER-A005 : A"],
       
  1881 		["test37.pkg", "VERSION(0xE1000001,=,1,)",		256,		"Expected numeric value read ",	"CR1125 SEC-SWI-PKGVER-A005 : B"],
       
  1882 		["test38.pkg", "VERSION(0xE1000001,=,)",		256,		"Expected numeric value read ",	"CR1125 SEC-SWI-PKGVER-A005 : C"],
       
  1883 		["test39.pkg", "VERSION(0xE1000001,)",			256,		"Invalid Relational Operator",	"CR1125 SEC-SWI-PKGVER-A005 : D"],
       
  1884 		["test40.pkg", "VERSION()",				256,		"Expected numeric value read ",	"CR1125 SEC-SWI-PKGVER-A005 : E"],
       
  1885 		["testinterpretflag.pkg", "VERSION(0x11113011,=,1,2,3)",		0,		"SIS installation file VALID for InterpretSis",	"CR1125 SEC-SWI-PKGVER-A006"],
       
  1886 	     );
       
  1887 
       
  1888 
       
  1889 #
       
  1890 # Template string to generate PKG file
       
  1891 #
       
  1892 $AnotherPkgFileTempl = "
       
  1893 ;
       
  1894 ; Autogenerated test install file
       
  1895 ;
       
  1896 &EN
       
  1897 ;
       
  1898 #{\"my test\"}, (0x80002233), 1, 2, 3, TYPE=SA
       
  1899 ;
       
  1900 %%{\"Vendor\"}
       
  1901 ;
       
  1902 ;Installation name and header data
       
  1903 (0x101f74aa),%s,{\"test\"}
       
  1904 ;
       
  1905 ;Made up files to install
       
  1906 \"HelloApp.exe\"-\"c:\\sys\\bin\\multiŞсEEžÑEE”Ê.exe\"
       
  1907 ;
       
  1908 ";
       
  1909 
       
  1910 
       
  1911 #
       
  1912 # Template string to generate PKG file
       
  1913 #
       
  1914 $PkgFileTempl = "
       
  1915 ;
       
  1916 ; Autogenerated test install file
       
  1917 ;
       
  1918 &EN
       
  1919 ;
       
  1920 #{\"test\"}, (0x101f74aa), 1, 0, 0, TYPE=SA
       
  1921 ;
       
  1922 %%{\"Ati\"}
       
  1923 ;
       
  1924 ;Installation name and header data
       
  1925 (0x101f74aa),%s,{\"test\"}
       
  1926 ;
       
  1927 ;Made up files to install
       
  1928 \"TEST.txt\"-\"!:\\System\\Apps\\TEST.txt\"
       
  1929 ;
       
  1930 
       
  1931 ";
       
  1932 
       
  1933 #
       
  1934 #
       
  1935 # Pkg file can have forward slashes for source and destination file
       
  1936 $ForwardSlash = "
       
  1937 ;
       
  1938 ; Autogenerated test install file
       
  1939 ;
       
  1940 &EN
       
  1941 ;
       
  1942 #{\"test\"}, (0x101f74aa), 1, 0, 0, TYPE=SA
       
  1943 ;
       
  1944 %{\"Ati\"}
       
  1945 ;
       
  1946 
       
  1947 ;Made up files to install
       
  1948 
       
  1949 \"TEST.txt\"-\"!:/Documents/InstTest/file1.txt\" 
       
  1950 ;
       
  1951 ";
       
  1952 
       
  1953 #
       
  1954 #
       
  1955 # Package file contains a FileNull followed by a RunInstall. The wildcard in the FN should be allowed and 
       
  1956 # makesis should not be confused by the flags in the RI
       
  1957 $FN_RI =" 
       
  1958 &EN
       
  1959 #{\"Symbian Email\"}, (0x800126e5), 1, 0, 0, TYPE=SA
       
  1960 %{\"Symbian\"}
       
  1961 :\"Symbian\"
       
  1962 
       
  1963 \"\"- \"C:/private/80009b91/temp/*.*\", FN
       
  1964 \"HelloApp.exe\"-\"C:/sys/bin/postinstall.exe\", FR, RI
       
  1965 ";
       
  1966 
       
  1967 #
       
  1968 #
       
  1969 # Pkg file can have forward slashes for source and destination file
       
  1970 $ForwardSlash = "
       
  1971 ;
       
  1972 ; Autogenerated test install file
       
  1973 ;
       
  1974 &EN
       
  1975 ;
       
  1976 #{\"test\"}, (0x101f74aa), 1, 0, 0, TYPE=SA
       
  1977 ;
       
  1978 %{\"Ati\"}
       
  1979 ;
       
  1980 
       
  1981 ;Made up files to install
       
  1982 
       
  1983 \"TEST.txt\"-\"!:/Documents/InstTest/file1.txt\" 
       
  1984 ;
       
  1985 ";
       
  1986 
       
  1987 
       
  1988 #
       
  1989 # Template string to generate PKG file
       
  1990 #
       
  1991 $PkgFileTemp2 = "
       
  1992 ;
       
  1993 ; Autogenerated test install file
       
  1994 ;
       
  1995 &EN
       
  1996 ;
       
  1997 #{\"test\"}, (0x101f74aa), 1, 0, 0, TYPE=SA
       
  1998 ;
       
  1999 %%{\"Ati\"}
       
  2000 ;
       
  2001 ;Installation name and header data
       
  2002 (0x101f74aa),%s,{\"test\"}
       
  2003 ;
       
  2004 ;Made up files to install
       
  2005 \"TEST.txt\"-\"\$\:\\System\\Apps\\TEST.txt\"
       
  2006 ;
       
  2007 ";
       
  2008 
       
  2009 #
       
  2010 # Template string to generate embedded package (testembedded.pkg).This is used for testing -d option of makesis .
       
  2011 #
       
  2012 $embedContents = "
       
  2013 ;
       
  2014 ; Autogenerated test install file for testing -d option.
       
  2015 ;
       
  2016 &EN
       
  2017 ;
       
  2018 #{\"embed\"}, (0x101f74a0), 1, 0, 0, TYPE=SA
       
  2019 ;
       
  2020 %{\"Ati\"}
       
  2021 ;
       
  2022 ;Installation name and header data
       
  2023 (0x101f74a0),%s,{\"embed\"}
       
  2024 ;
       
  2025 ;embedded sis file
       
  2026 \@\"testembedding.sis\",(0x101f74aa)
       
  2027 
       
  2028 ;Made up files to install
       
  2029 \"TEST.txt\"-\"!:\\System\\Apps\\TEST.txt\"
       
  2030 ;
       
  2031 ";
       
  2032 
       
  2033 #
       
  2034 # Template string to generate a package with 0xA0 chars (No-Break Space) inside
       
  2035 #
       
  2036 $ifendifContent = "
       
  2037 ;
       
  2038 ; Autogenerated test install file for testing DEF091780: Makesis have problems parsing IF-ENDIF block
       
  2039 ;
       
  2040 
       
  2041 ;Languages
       
  2042 &JA,FR
       
  2043 
       
  2044 ;Header
       
  2045 #{\"JA hira UCS2\",\"FR hira UCS2\" }, (0x80000003), 1, 2, 3, TYPE=SA
       
  2046 %{\"AA-JA\",\"CC-FR\"}
       
  2047 :\"venDor\"
       
  2048 
       
  2049 !({\"JAOpt1\",\"FROpt1\"},{\"JAOpt3\",\"FROpt3\"})
       
  2050 
       
  2051 if option1 
       
  2052 \xA0\xA0\xA0{\"osver1J.txt\" \"osver1F.txt\"}-\"!:\\documents\\hello.txt\"; 
       
  2053 endif
       
  2054 
       
  2055 if option2 
       
  2056 \xA0\xA0\xA0{\"osver2J.txt\" \"osver2F.txt\"}-\"!:\\documents\\hello.txt\"; 
       
  2057 endif
       
  2058 ";
       
  2059 
       
  2060 #
       
  2061 #
       
  2062 # A string to generate a package with Japanese JIS 0208-1990 encoding
       
  2063 $unsupportedEncContent = "
       
  2064 ;Languages
       
  2065 &JA
       
  2066 
       
  2067 ;Header
       
  2068 #{\"PC Japanese JIS 0208-1990 encoding\"}, (0xA2000222), 1, 2, 3, TYPE=SA
       
  2069 
       
  2070 %{\"Vendor\"}
       
  2071 :\"Vendor\"
       
  2072 
       
  2073 \"TEST.txt\"-\"!:\Documents\InstTest\ñÏñ┘ñ━Etxt\" 
       
  2074 ";
       
  2075 
       
  2076 
       
  2077 #
       
  2078 # Template string to generate PKG file with If Exist statement for DEF091860.
       
  2079 #
       
  2080 $DEF091860PkgContents = "
       
  2081 ;
       
  2082 ; PKG file designed to test conditional installation.
       
  2083 ; Autogenerated test install file
       
  2084 ;
       
  2085 &EN
       
  2086 ;
       
  2087 #{\"test\"}, (0x101f74aa), 1, 0, 0, TYPE=SA
       
  2088 ;
       
  2089 %{\"Ati\"}
       
  2090 ;
       
  2091 ;Installation name and header data
       
  2092 (0x101f74aa),%s,{\"test\"}
       
  2093 ;
       
  2094 ;Made up files to install
       
  2095 \"TEST.txt\"-\"!:\\System\\Apps\\TEST.txt\"
       
  2096 ;
       
  2097 ; The file “test1.txt Eis expected to exist.
       
  2098 if exists(\"test1.txt\")
       
  2099 \"TEST.txt\"-\"!:\\System\\Apps\\TEST1.txt\"
       
  2100 else
       
  2101 \"TEST.txt\"-\"!:\\System\\Apps\\TEST2.txt\"
       
  2102 endif
       
  2103 
       
  2104 ; The file “test2.txt Eis not expected to exist.
       
  2105 if exists(\"test2.txt\")
       
  2106 \"TEST.txt\"-\"!:\\System\\Apps\\TEST3.txt\"
       
  2107 else
       
  2108 \"TEST.txt\"-\"!:\\System\\Apps\\TEST4.txt\"
       
  2109 endif
       
  2110 ;
       
  2111 ";
       
  2112 
       
  2113 #
       
  2114 # Template string to generate PKG file for language dependent files
       
  2115 #
       
  2116 $PkgLanguageFileTemp = "
       
  2117 ;
       
  2118 ;
       
  2119 &EN,FR,98
       
  2120 ;
       
  2121 #{\"Language-EN\",\"Langauge-FR\",\"Language-Zulu\"}, (0x101f74aa), 1, 0, 0, TYPE=SA
       
  2122 ;
       
  2123 %%{\"Vendor\",\"Vendour\",\"Verkoper\"}
       
  2124 ;
       
  2125 ;
       
  2126 ;Made up files to install
       
  2127 {\"englishfile.txt\" \"frenchfile.txt\" \"germanfile.txt\"}  -\"!:\\System\\Apps\\TEST.txt\"
       
  2128 ;
       
  2129 ";
       
  2130 
       
  2131 
       
  2132 
       
  2133 # For DEF92320
       
  2134 # Template string to generate PKG file,File name contain symbols like |,/,<,>,:,?,*
       
  2135 #
       
  2136 $PkgFileWithSymbol = "
       
  2137 ;
       
  2138 ; Autogenerated test install file
       
  2139 ;
       
  2140 &EN
       
  2141 ;
       
  2142 #{\"test\"}, (0x101f74aa), 1, 2, 3, TYPE=SA
       
  2143 ;
       
  2144 %%{\"Ati\"}
       
  2145 ;
       
  2146 ;Made up files to install
       
  2147 \"TEST.txt\"-\"!:\\System\\Apps\\TEST%s.txt\"
       
  2148 ;
       
  2149 ";
       
  2150 
       
  2151 # For DEF92320
       
  2152 # Template string to generate PKG file, DIR path contain symbols like |,/,<,>,:,?,*
       
  2153 #
       
  2154 $PkgFileWithSymbol1 = "
       
  2155 ;
       
  2156 ; Autogenerated test install file
       
  2157 ;
       
  2158 &EN
       
  2159 ;
       
  2160 #{\"test\"}, (0x101f74aa), 1, 2, 3, TYPE=SA
       
  2161 ;
       
  2162 %%{\"Ati\"}
       
  2163 ;
       
  2164 ;Made up files to install
       
  2165 \"TEST.txt\"-\"!:\\System\\Ap%sps\\TEST.txt\"
       
  2166 ;
       
  2167 ";
       
  2168 
       
  2169 # For DEF115795
       
  2170 # Template string to generate a package with very long destination folder
       
  2171 #
       
  2172 $longfolder = "
       
  2173 ;
       
  2174 &EN
       
  2175 ;
       
  2176 #{\"STSisapt444\"},(0x88900000),1,1,1,NOCOMPRESS,TYPE= SA
       
  2177 ;
       
  2178 %{\"Test\"}
       
  2179 ;
       
  2180 ;
       
  2181 \"TEST.txt\"-\"!:\siv1aaa\\10003a3f\\import\\apps\\siv2aa\\10003a3f\\import\\apps\\siv3aa\\10003a3f\\import\\apps\\siv4aa\\10003a3f\\import\\apps\\siv5aa\\10003a3f\\import\\apps\\siv6aa\\10003a3f\\import\\apps\\siv7aa\\10003a3f\\import\\apps\\siv8aa\\10003a3f\\import\\apps\\siv9aa\\10003a3f\\import\\apps\\siv10a\\10003a3f\\import\\apps\\siv11a\\10003a3f\\import\\appspp\\file1.txt\"
       
  2182 ;
       
  2183 ";	
       
  2184 
       
  2185 #
       
  2186 # Template string to generate a package with comma at the end
       
  2187 #
       
  2188 $endFileCommaContent = "
       
  2189 ; A simple SIS file
       
  2190 
       
  2191 ;Languages
       
  2192 &EN,FR
       
  2193 
       
  2194 ;Header
       
  2195 #{\"Simple\",\"Simple-FR\"}, (0x80000001), 4, 5, 6
       
  2196 
       
  2197 %{\"Simple-Vendor\",\"Simple-Vendor-FR\"}
       
  2198 :\"Unique Vendor Name\"
       
  2199 	
       
  2200 ;Ordinary file to selected drive
       
  2201 \"TEST.txt\"-\"!:/Documents/InstTest/file1.txt\",
       
  2202 ";
       
  2203 	
       
  2204 
       
  2205 # Data to write in the created file for Linux test 
       
  2206 $TempData = "Osver";
       
  2207 
       
  2208 #
       
  2209 # Template string to generate PKG file
       
  2210 #
       
  2211 $JAPPkgFileTempl = "
       
  2212 ;
       
  2213 ; Autogenerated test install file
       
  2214 ;
       
  2215 &JA
       
  2216 ;
       
  2217 #{\"names large sample UTF8\"}, (0xA2000222), 1, 2, 3, TYPE=SA
       
  2218 ;
       
  2219 %%{\"Vendor\"}
       
  2220 ;
       
  2221 
       
  2222 ;Made up files to install
       
  2223 \"\\epoc32\\winscw\\c\\tswi\\utf8.txt\"-\"!:\\utf8.txt\"
       
  2224 ;
       
  2225 
       
  2226 ";
       
  2227 
       
  2228 
       
  2229 #
       
  2230 # Package template string to generate PKG file with RU and SA
       
  2231 #
       
  2232 $PkgFileRUWithSA = "
       
  2233 ;
       
  2234 ; Autogenerated test install file
       
  2235 ;
       
  2236 &EN
       
  2237 ;
       
  2238 #{\"SA ROM Upgrade\"}, (0x802730A2), 1, 0, 0, TYPE=SA, RU
       
  2239 ;
       
  2240 %%{\"Security Services\"}
       
  2241 ;
       
  2242 ;Installation name and header data
       
  2243 (0x802730A2),%s,{\"SA ROM Upgrade\"}
       
  2244 ;
       
  2245 ;Made up files to install
       
  2246 \"TEST.txt\"-\"\$\:\\System\\Apps\\TEST.txt\"
       
  2247 ;
       
  2248 ";
       
  2249 
       
  2250 #
       
  2251 # Package template string to generate PKG file with RU and non SA or PU or SP
       
  2252 #
       
  2253 $PkgFileRUWithNonSA = "
       
  2254 ;
       
  2255 ; Autogenerated test install file
       
  2256 ;
       
  2257 &EN
       
  2258 ;
       
  2259 #{\"SA ROM Upgrade\"}, (0x802730A2), 1, 0, 0, TYPE=PP, RU
       
  2260 ;
       
  2261 %%{\"Security Services\"}
       
  2262 ;
       
  2263 ;Installation name and header data
       
  2264 (0x802730A2),%s,{\"SA ROM Upgrade\"}
       
  2265 ;
       
  2266 ;Made up files to install
       
  2267 \"TEST.txt\"-\"\$\:\\System\\Apps\\TEST.txt\"
       
  2268 ;
       
  2269 ";
       
  2270 
       
  2271 #
       
  2272 # Package template string to generate PKG file with wildcards for ROM Stub.
       
  2273 #
       
  2274 $WildCardedpkgFile = "
       
  2275 ;
       
  2276 ; Autogenerated test install file
       
  2277 ;
       
  2278 &EN
       
  2279 ;
       
  2280 #{\"Wildcard Suported ROM App\"}, (0x802730B1), 1, 2, 3
       
  2281 ;
       
  2282 %%{\"Security Services\"}
       
  2283 ;
       
  2284 ;Installation name and header data
       
  2285 (0x802730B1),%s,{\"Wildcard Suported ROM App\"}
       
  2286 ;
       
  2287 ;Made up files to install
       
  2288 \"\"-\"z:\\sys\\bin\\wildcard_rom_stub_lib?.dll\"
       
  2289 ;
       
  2290 \"\"-\"z:\\sys\\bin\\*.exe\"
       
  2291 ;
       
  2292 
       
  2293 ; Misc data files for baseline eclipsing test
       
  2294 \"\"-\"z:\\cr1122test\\*.txt\"
       
  2295 ;
       
  2296 \"\"-\"z:\\cr1122etst\\wildcard_config?.cnf\"
       
  2297 ;
       
  2298 ";
       
  2299 
       
  2300 
       
  2301 #
       
  2302 # Package template string to generate PKG file with wildcards for PA package
       
  2303 #
       
  2304 $WildCardedPApkgFile = "
       
  2305 ;
       
  2306 ; Autogenerated test install file
       
  2307 ;
       
  2308 &EN
       
  2309 ;
       
  2310 #{\"Wildcarded PA\"}, (0x802730B1), 1, 2, 3, TYPE = PA
       
  2311 ;
       
  2312 %%{\"Security Services\"}
       
  2313 ;
       
  2314 ;Installation name and header data
       
  2315 (0x802730B1),%s,{\"wildcarded PA\"}
       
  2316 ;
       
  2317 ;Made up files to install
       
  2318 \"\\epoc32\\release\\<PLATFORM>\\<CONFIGURATION>\\tsaromupgradeexe.exe\"-\"c:\\sys\\bin\\*exe_PA?.exe\"
       
  2319 ;
       
  2320 ";
       
  2321 
       
  2322 #
       
  2323 # Package template string to generate PKG file with wildcards for PP package
       
  2324 #
       
  2325 $WildCardedPApkgFile = "
       
  2326 ;
       
  2327 ; Autogenerated test install file
       
  2328 ;
       
  2329 &EN
       
  2330 ;
       
  2331 #{\"Wildcarded PP\"}, (0x802730B1), 1, 2, 3, TYPE = PP
       
  2332 ;
       
  2333 %%{\"Security Services\"}
       
  2334 ;
       
  2335 ;Installation name and header data
       
  2336 (0x802730B1),%s,{\"Wildcarded PP\"}
       
  2337 ;
       
  2338 ;Made up files to install
       
  2339 \"\\epoc32\\release\\<PLATFORM>\\<CONFIGURATION>\\tsaromupgradeexe.exe\"-\"c:\\sys\\bin\\*exe_PA?.exe\"
       
  2340 ;
       
  2341 ";
       
  2342 
       
  2343 #
       
  2344 # Package template string to generate PKG file having wildcards specified in the executable filename.
       
  2345 #
       
  2346 $ExeWithWildCardpkgFile = "
       
  2347 ;
       
  2348 ; Autogenerated test install file
       
  2349 ;
       
  2350 &EN
       
  2351 ;
       
  2352 #{\"Wildcard in Exe Name\"}, (0x801130c1), 1, 2, 3
       
  2353 ;
       
  2354 %%{\"Security Services\"}
       
  2355 ;
       
  2356 ;Installation name and header data
       
  2357 (0x801130c1),%s,{\"Wildcard in Exe Name\"}
       
  2358 ;
       
  2359 ;Made up files to install
       
  2360 \"\"-\"z:\\sys\\bin\\wildcard_rom_stub.*\"
       
  2361 ;
       
  2362 \"\"-\"z:\\sys\\bin\\wildcard_rom_stub?.dll\"
       
  2363 ;
       
  2364 ";
       
  2365 
       
  2366 #
       
  2367 # Template string to generate a package with invalid version
       
  2368 #
       
  2369 $invalidVersion1 = "
       
  2370 ; A simple SIS file
       
  2371 
       
  2372 ;Languages
       
  2373 &EN,FR
       
  2374 
       
  2375 ;Header
       
  2376 #{\"Simple\",\"Simple-FR\"}, (0x80000001), 32767, 32767, 32767
       
  2377 
       
  2378 %{\"Simple-Vendor\",\"Simple-Vendor-FR\"}
       
  2379 :\"Unique Vendor Name\"
       
  2380 	
       
  2381 ;Ordinary file to selected drive
       
  2382 \"TEST.txt\"-\"!:/Documents/InstTest/file1.txt\"
       
  2383 ";
       
  2384 
       
  2385 
       
  2386 #
       
  2387 # Template string to generate a package with invalid version number for negative values
       
  2388 #
       
  2389 $invalidVersion2 = "
       
  2390 ; A simple SIS file
       
  2391 
       
  2392 ;Languages
       
  2393 &EN,FR
       
  2394 
       
  2395 ;Header
       
  2396 #{\"Simple\",\"Simple-FR\"}, (0x80000001), -26, -1, -3245
       
  2397 
       
  2398 %{\"Simple-Vendor\",\"Simple-Vendor-FR\"}
       
  2399 :\"Unique Vendor Name\"
       
  2400 	
       
  2401 ;Ordinary file to selected drive
       
  2402 \"TEST.txt\"-\"!:/Documents/InstTest/file1.txt\"
       
  2403 ";
       
  2404 
       
  2405 #
       
  2406 # Template string to generate a pkg with an embedded sis file. The embedded sis file is missing on the computer.
       
  2407 #
       
  2408 $missingEmbed = "
       
  2409 ;
       
  2410 ; Pkg referencing missing embedded package.
       
  2411 ;
       
  2412 &EN
       
  2413 ;
       
  2414 #{\"missing embedded\"}, (0x80000001), 1, 0, 0, TYPE=SA
       
  2415 ;
       
  2416 ;missing embedded sis file
       
  2417 \@\"missingembedded.sis\",(0x80000002)
       
  2418 ;
       
  2419 ";
       
  2420 
       
  2421 # Package template string to generate PKG file with ForceAbort (FA) text option.
       
  2422 #
       
  2423 $PkgFileWithFAOption = "
       
  2424 ;
       
  2425 ; Autogenerated test install file
       
  2426 ;
       
  2427 &EN
       
  2428 ;
       
  2429 #{\"Force Abort Text Option\"}, (0x8072302A), 1, 0, 0, TYPE=SA
       
  2430 ;
       
  2431 %%{\"Security Services\"}
       
  2432 ;
       
  2433 ;Installation name and header data
       
  2434 (0x802730A2),%s,{\"SA ROM Upgrade\"}
       
  2435 ;
       
  2436 ;Made up files to install
       
  2437 \"TEST.txt\"-\"\", FT , FA
       
  2438 ;
       
  2439 ";
       
  2440 
       
  2441 #
       
  2442 #Test code for Preinstalled pkg files without having sourcefiles
       
  2443 #
       
  2444 $PreinstalledPkgWithoutSourcefiles = "
       
  2445 ;A preinstalled SIS file
       
  2446 
       
  2447 ;Languages
       
  2448 &EN,FR
       
  2449 
       
  2450 ;Header
       
  2451 #{\"Simple\",\"Simple-FR\"}, (0x80000001), 1, 2, 3, TYPE = PA
       
  2452 
       
  2453 %{\"Simple-Vendor\",\"Simple-Vendor-FR\"}
       
  2454 :\"Unique Vendor Name\"
       
  2455 	
       
  2456 ;Ordinary file to selected drive
       
  2457 \"\"-\"!:/Documents/InstTest/file1.txt\"
       
  2458 ";
       
  2459 
       
  2460 
       
  2461 
       
  2462 #
       
  2463 # Template string to generate Expected output file for ROM stub file (containing exe with wildcards) created by makesis for DEF111264.
       
  2464 #
       
  2465 $DEF111264ExpectedOutput= "Unique vendor name not found.
       
  2466 
       
  2467 Warning: Executables should be included explicitly (without wildcards),to enable SID checks to work as expected.
       
  2468 ";
       
  2469 
       
  2470 #
       
  2471 # Template string to generate Expected output file for Preinstalled APP package having no source files specified.
       
  2472 #
       
  2473 $DEF113569ExpectedOutput= " Error : Source file is missing for PreInstalled APP : 
       
  2474 (14) : error: file I/O fault, Source file is missing for PreInstalled APP 
       
  2475 ";
       
  2476 
       
  2477 
       
  2478 #
       
  2479 # Template string to generate Expected output file when the version range is invalid.
       
  2480 
       
  2481 $DEF112718ExpectedOutput= "Warning : The valid version number ranges are : (Major: 0..127) (Minor: 0..99 ) (Build: 0..32,767).\n";
       
  2482  
       
  2483 #
       
  2484 # Package template string to generate an embedded PKG file of type PA.
       
  2485 #
       
  2486 $EmbeddedPApkgFile = "
       
  2487 ;
       
  2488 ; Autogenerated test install file
       
  2489 ;
       
  2490 &EN
       
  2491 ;
       
  2492 #{\"Test Embedded PA\"}, (0x01101335), 1, 1, 1, TYPE=PA
       
  2493 ;
       
  2494 %{\"Symbian Software Ltd\"}
       
  2495 :\"Symbian Software Ltd\"
       
  2496 ;
       
  2497 ;Installation name and header data
       
  2498 (0x01101335),%s,{\"Test Embedded PA\"}
       
  2499 ;
       
  2500 ";
       
  2501 
       
  2502 #
       
  2503 # Package template string to generate an embedding PKG file whose embedded pkg is of type=PA.
       
  2504 #
       
  2505 $EmbeddingPApkgFile = "
       
  2506 ;
       
  2507 ; Autogenerated test install file
       
  2508 ;
       
  2509 &EN
       
  2510 ;
       
  2511 #{\"Test Embedding PA\"}, (0x01011243), 1, 0, 1, TYPE=SA
       
  2512 ;
       
  2513 %{\"Symbian Software Ltd\"}
       
  2514 :\"Symbian Software Ltd\"
       
  2515 ;
       
  2516 ;Installation name and header data
       
  2517 (0x01011243),%s,{\"Test Embedding PA\"}
       
  2518 ;
       
  2519 \@\"embeddedPA.sis\" , (0x01101335)
       
  2520 ;
       
  2521 ";
       
  2522 
       
  2523 #
       
  2524 # CR1125 VERSION Condition Package template string to generate PKG files
       
  2525 #
       
  2526 $PkgFileCR1125VersionTemplate = "
       
  2527 ;
       
  2528 ; Auto Generated Template PKG File
       
  2529 ; VERSION Conditional Testing
       
  2530 ;
       
  2531 &EN
       
  2532 ;
       
  2533 #{\"CR1125 SEC-SWI-PKGVER\"}, (0xEA001000), 1, 0, 2, TYPE=SA
       
  2534 %{\"Symbian Software Ltd.\"}
       
  2535 : \"Symbian Software Ltd.\"
       
  2536 ;
       
  2537 ; Version Conditional Block
       
  2538 IF %s
       
  2539     {
       
  2540     \"TEST.txt\"
       
  2541     }-\"C:\\tswi\\tpkgver\\test_result_etrue.txt\"
       
  2542 ENDIF
       
  2543 ;
       
  2544 ";
       
  2545 
       
  2546 #
       
  2547 # Package template string to generate a PKG with features not installable by InterpretSIS
       
  2548 #
       
  2549 $PkgFileInterpretsisVersionTemplate = "
       
  2550 ;
       
  2551 ; Autogenerated test install file
       
  2552 ;
       
  2553 &EN
       
  2554 ;
       
  2555 #{\"Test Makesis -c\"}, (0x01011243), 1, 0, 1, TYPE=PP
       
  2556 ;
       
  2557 %{\"Symbian Software Ltd\"}
       
  2558 :\"Symbian Software Ltd\"
       
  2559 ;
       
  2560 !({\"Add-on 1 (20KB)\"},{\"Add-on 2 (75KB)\"},{\"Add-on 3 (80KB)\"}) 
       
  2561 ;
       
  2562 \@\"Embedded.sis\" , (0x101f74aa)
       
  2563 ;
       
  2564 ";
       
  2565 
       
  2566 #
       
  2567 # Template string to generate Expected output file for DEF113349.
       
  2568 #
       
  2569 $DEF113349ExpectedOutput= "embeddedPA.sis is a stub.	 
       
  2570 WARNING : Embedded Preinstalled Stub (PA/PP type) SIS file is not supported.
       
  2571 (16) : error: SISfile error, Stub File
       
  2572 ";
       
  2573 
       
  2574 #
       
  2575 # 
       
  2576 #
       
  2577 $InterpretsisExpectedOutput= "*** SIS installation file INVALID for InterpretSis ***
       
  2578 (8) : Invalid Application Type. Package type PP not supported
       
  2579 (12) : User options are not supported
       
  2580 (14) : Embedded SIS file will not be installed by InterpretSis
       
  2581 ";
       
  2582 
       
  2583 #
       
  2584 # Do test for each elements of TestItems array
       
  2585 #
       
  2586 for my $Test ( @TestItems )  {
       
  2587 
       
  2588 	# Generating PKG file contents
       
  2589 	if( $Test->[0] eq  "test16.pkg" )
       
  2590 		{
       
  2591 		$PkgFile = sprintf( $AnotherPkgFileTempl, $Test->[1]);
       
  2592 		}
       
  2593 	elsif ( $Test->[0] eq  "test17.pkg" )
       
  2594 		{
       
  2595 		$PkgFile = $unsupportedEncContent;
       
  2596 		}
       
  2597 	elsif ( $Test->[0] eq  "testForward.pkg" )
       
  2598 		{
       
  2599 		$PkgFile = $ForwardSlash;
       
  2600 		}
       
  2601 	elsif ( $Test->[0] eq  "testFN_RI.pkg" )
       
  2602 		{
       
  2603 		$PkgFile = $FN_RI;
       
  2604 		}
       
  2605 	else
       
  2606 		{
       
  2607  		$PkgFile = sprintf( $PkgFileTempl, $Test->[1]); 
       
  2608 		}
       
  2609 	
       
  2610 	# Create PKG file
       
  2611 	CreateFile($Test->[0], $PkgFile);	
       
  2612 
       
  2613 	# Do MAKESIS test
       
  2614 
       
  2615 	$logMsg = sprintf "%s\n (symbol:%s)\n", $Test->[4], $Test->[1];
       
  2616 	WriteLog($logMsg);
       
  2617 
       
  2618 	MakeSISFile($Test->[0], $Test->[2], $Test->[3]);
       
  2619 
       
  2620 }
       
  2621 
       
  2622 #
       
  2623 # Do test for each elements of TestItems1 array
       
  2624 #
       
  2625  $Count = 1;
       
  2626 for my $Test1 ( @TestItems1 )  {
       
  2627 
       
  2628 	# Generating PKG file contents
       
  2629 	if( $Count >= 19 )
       
  2630 		{
       
  2631 		$PkgFile = sprintf( $PkgFileWithSymbol1 , $Test1->[1]);
       
  2632 		$Count ++  ;
       
  2633 		}
       
  2634 	else
       
  2635 		{
       
  2636 		$PkgFile = sprintf( $PkgFileWithSymbol , $Test1->[1]);
       
  2637 		$Count++ ;
       
  2638 		}
       
  2639 
       
  2640 	# Create PKG file
       
  2641 	CreateFile($Test1->[0], $PkgFile);	
       
  2642 
       
  2643 	# Do MAKESIS test
       
  2644 
       
  2645 	$logMsg1 = sprintf "%s\n (Symbol:%s)\n", $Test1->[4], $Test1->[1];
       
  2646 	WriteLog($logMsg1);
       
  2647 
       
  2648 	MakeSISFile($Test1->[0], $Test1->[2], $Test1->[3]);
       
  2649 
       
  2650 }
       
  2651 
       
  2652 
       
  2653 #
       
  2654 # Run CR1125 MakeSIS Tests (TestItems2 array)
       
  2655 #
       
  2656 for my $Test2 ( @TestItems2 )  {
       
  2657 
       
  2658 	# Generating PKG file contents
       
  2659 	$PkgFile = sprintf( $PkgFileCR1125VersionTemplate , $Test2->[1]);
       
  2660 
       
  2661 	# Create PKG file
       
  2662 	CreateFile($Test2->[0], $PkgFile);	
       
  2663 
       
  2664 	# Do MAKESIS test
       
  2665 	$logMsg1 = sprintf "%s\n (Condition: %s)\n", $Test2->[4], $Test2->[1];
       
  2666 	WriteLog($logMsg1);
       
  2667 
       
  2668 	MakeSISFile($Test2->[0], $Test2->[2], $Test2->[3]);
       
  2669 }
       
  2670 
       
  2671 
       
  2672 #
       
  2673 # Additional test to check that stub files don't change every time 
       
  2674 # they are built.
       
  2675 #
       
  2676 TestSISStubFile();
       
  2677 
       
  2678 #
       
  2679 # Test for Test$parameter()
       
  2680 #
       
  2681 TestsysDriveparameter();
       
  2682 
       
  2683 # Call the tests for CR1027 - ROM Upgrade with SA SIS package.
       
  2684 TestSisRUWithSA();
       
  2685 TestSisRUWithNonSA();
       
  2686 
       
  2687 # Call the test for CR1122 - Wildcard support for ROM stub.
       
  2688 TestSISWithWildCards();
       
  2689 TestSISWithWildCardsPA();
       
  2690 TestSISWithWildCardsPP();
       
  2691 
       
  2692 #
       
  2693 # Test for DEF111264.Verifying that warnings are generated by Makesis 
       
  2694 # when wildcards are used in \sys\bin directory in ROM stubs. 
       
  2695 #
       
  2696 
       
  2697 TestDEF111264();
       
  2698 
       
  2699 #
       
  2700 # Test for DEF113116.
       
  2701 #  
       
  2702 TestDEF113116();
       
  2703 
       
  2704 #
       
  2705 # Test for DEF083525
       
  2706 #
       
  2707 TestDEF083525();
       
  2708 
       
  2709 #
       
  2710 # Test for PDEF081989.Testing the working of Makesis -d option .
       
  2711 #
       
  2712 
       
  2713 TestPDEF081989();
       
  2714 
       
  2715 
       
  2716 #
       
  2717 # Test for DEF093400
       
  2718 #
       
  2719 TestDEF093400();
       
  2720 
       
  2721 #
       
  2722 # Test for DEF090878
       
  2723 #
       
  2724 TestDEF090878();
       
  2725 
       
  2726 #
       
  2727 # Test for DEF107033.Testing the working of Makesis -d option with language dependent files.
       
  2728 #
       
  2729 
       
  2730 TestDEF107033();
       
  2731 
       
  2732 # Test for an output filename with a single char - DEF108728
       
  2733 TestSingleCharFilename();
       
  2734 
       
  2735 # Test for DEF108815
       
  2736 TestEndFileComma();
       
  2737 
       
  2738 
       
  2739 # Test for DEF115795
       
  2740 TestLongFolderName();
       
  2741 
       
  2742 # Test for DEF112718-1
       
  2743 TestInvalidVersion1();
       
  2744  
       
  2745 # Test for DEF112718-2
       
  2746 TestInvalidVersion2();
       
  2747 
       
  2748 # Test for DEF112831
       
  2749 TestDEF112831();
       
  2750 
       
  2751 #
       
  2752 # Test for DEF113349.
       
  2753 #
       
  2754 
       
  2755 TestDEF113349();
       
  2756 
       
  2757 # Test for DEF113569
       
  2758 TestPreInstalledWithoutSourceFiles();
       
  2759 
       
  2760 #
       
  2761 # Test for Makesis -c option. Added as part of the fix for DEF126467.
       
  2762 #
       
  2763 TestInterpretsisReport();
       
  2764 
       
  2765 #
       
  2766 # These tests are very specific to windows OS only
       
  2767 #
       
  2768 #
       
  2769 
       
  2770 if ($^O =~ /^MSWIN32$/i)
       
  2771 {
       
  2772 #
       
  2773 # Test for DEF091860
       
  2774 #
       
  2775 TestDEF091860();
       
  2776 
       
  2777 #
       
  2778 # Test for DEF091942.
       
  2779 #
       
  2780 TestDEF091942();
       
  2781 
       
  2782 #
       
  2783 # Test for INC092755
       
  2784 #
       
  2785 TestINC092755();
       
  2786 
       
  2787 #
       
  2788 # Test for DEF090912
       
  2789 #
       
  2790 TestDEF090912();
       
  2791 
       
  2792 #
       
  2793 # Test for DEF093156
       
  2794 #
       
  2795 TestDEF093156();
       
  2796 
       
  2797 #
       
  2798 # Test for TestDEF091780
       
  2799 #
       
  2800 TestDEF091780();
       
  2801 
       
  2802 #
       
  2803 # Test for DEF104895.Testing the working of Makesis -d option with 
       
  2804 # embedding sis file in path containing backward slasesh.
       
  2805 #
       
  2806 
       
  2807 TestDEF104895();
       
  2808 }
       
  2809 
       
  2810 #
       
  2811 # These tests are very specific to Linux OS only
       
  2812 #
       
  2813 #
       
  2814 if ($^O =~ /^LINUX$/i)
       
  2815 {
       
  2816 
       
  2817 #
       
  2818 # Test for DEF091942.
       
  2819 #
       
  2820 TestLDEF091942();
       
  2821 
       
  2822 
       
  2823 #
       
  2824 # Test for DEF090912
       
  2825 #
       
  2826 TestLDEF090912();
       
  2827 
       
  2828 #
       
  2829 # Test for DEF104895.Testing the working of Makesis -d option with 
       
  2830 # embedding sis file in path containing backward slasesh.
       
  2831 #
       
  2832 
       
  2833 TestLDEF104895();
       
  2834 
       
  2835 }
       
  2836 
       
  2837 
       
  2838 unlink("Test.txt");
       
  2839 unlink("HelloApp.exe");
       
  2840 unlink("test1.txt");
       
  2841 unlink("test2.txt");
       
  2842 
       
  2843 #
       
  2844 # Display the result
       
  2845 #
       
  2846 WriteLog("\n\nTests completed OK\n");
       
  2847 WriteLog(sprintf "Run: %d\n", $NumberOfTests );
       
  2848 WriteLog(sprintf "Passed: %d\n", $NumberOfPassed );
       
  2849 WriteLog(sprintf "%d tests failed out of %d\n", $NumberOfFailed, $NumberOfTests ); 
       
  2850