secureswitools/swisistools/test/tdumpsis/testdumpsis.pl
branchRCL_3
changeset 24 5cc91383ab1e
parent 0 ba25891c3a9e
child 25 7333d7932ef7
equal deleted inserted replaced
23:cd189dac02f7 24:5cc91383ab1e
     1 #
     1 #
     2 # Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 # Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 # All rights reserved.
     3 # All rights reserved.
     4 # This component and the accompanying materials are made available
     4 # This component and the accompanying materials are made available
     5 # under the terms of the License "Eclipse Public License v1.0"
     5 # under the terms of the License "Eclipse Public License v1.0"
     6 # which accompanies this distribution, and is available
     6 # which accompanies this distribution, and is available
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
   343 ; Option List 
   343 ; Option List 
   344 
   344 
   345 %s
   345 %s
   346 ;
   346 ;
   347 ";
   347 ";
       
   348 
       
   349 #
       
   350 # Template string to generate PKG file for TestNRFlag.
       
   351 #
       
   352 $PkgFileWithNRflag = "	
       
   353 ; File to verify NR flag is dumped correctly.
       
   354 ;
       
   355 ;Languages
       
   356 &EN
       
   357 ;
       
   358 #{\"TestPacakge\"}, (0x80000077), 1, 0, 0, TYPE=SA, RU, NR
       
   359 ;
       
   360 %{\"Vendor\"}
       
   361 :\"Vendor\"
       
   362 ";
       
   363 
   348 #
   364 #
   349 # Do test for each elements of TestItems array
   365 # Do test for each elements of TestItems array
   350 #
   366 #
   351 sub CreateMakeSIS
   367 sub CreateMakeSIS
   352 	{
   368 	{
   533 }
   549 }
   534 
   550 
   535 SatisfyCoverage();
   551 SatisfyCoverage();
   536 
   552 
   537 VerifyErroneousCommandLineArg();
   553 VerifyErroneousCommandLineArg();
       
   554 
       
   555 TestNRFlag();
       
   556 
   538 #
   557 #
   539 # Display the result
   558 # Display the result
   540 #
   559 #
   541 WriteLog("\n\nTests completed OK\n");
   560 WriteLog("\n\nTests completed OK\n");
   542 WriteLog(sprintf "Run: %d\n", $NumberOfTests );
   561 WriteLog(sprintf "Run: %d\n", $NumberOfTests );
  1479 	unlink $ErrFile;
  1498 	unlink $ErrFile;
  1480 	unlink $ErrOutputFile;
  1499 	unlink $ErrOutputFile;
  1481 	unlink $TestLogFile;
  1500 	unlink $TestLogFile;
  1482 	}
  1501 	}
  1483 
  1502 
       
  1503 sub TestNRFlag
       
  1504 	{
       
  1505 	$TestNRflagsis = "test_nr_flag.sis";
       
  1506 	$TestNRflagLog = "test_nr_flag.Log";
       
  1507 	$TestNRflagpkg = "test_nr_flag.pkg";
       
  1508 	$DumpsisGenPkgPath = "\/test_nr_flag";
       
  1509 	$ExpectedStringInDumpedPackage = "NR";
       
  1510 	WriteLog("Test if the NR flag, in the original package file, is present in the dumped package file \n");
       
  1511 
       
  1512 	CreateFile('test_nr_flag.pkg', $PkgFileWithNRflag);
       
  1513 	# Create a sis file
       
  1514 	my $result = system("/epoc32/tools/MAKESIS -v $TestNRflagpkg $TestNRflagsis > $TestNRflagLog ");
       
  1515 	
       
  1516 	# Execute DumpSIS on the created sis file.
       
  1517 	my $result1 = system("/epoc32/tools/DUMPSIS $TestNRflagsis > $TestNRflagLog");
       
  1518 	
       
  1519 	use Cwd;
       
  1520 	$dir = cwd;
       
  1521 	chdir $dir.$DumpsisGenPkgPath;
       
  1522 	
       
  1523 	open($pkgcontent,$TestNRflagpkg);
       
  1524 	foreach (<$pkgcontent>) 
       
  1525 	{
       
  1526 		$_ =~ tr/\000//d;
       
  1527 		if ($_ =~ m/$ExpectedStringInDumpedPackage/) 
       
  1528 		{
       
  1529 			$result2 = 1;
       
  1530 		}
       
  1531 	}
       
  1532 	close($pkgcontent);
       
  1533 	
       
  1534 	chdir $dir;
       
  1535 	$NumberOfTests++;
       
  1536 	if ($result == 0 && $result1 == 0 && $result2 == 1) 
       
  1537 		{
       
  1538 		$NumberOfPassed++;
       
  1539 		WriteLog("Passed\n\n");
       
  1540 		}
       
  1541 	else 
       
  1542 		{
       
  1543 		$NumberOfFailed++;
       
  1544 		WriteLog("Failed\n\n");
       
  1545 		}
       
  1546 		
       
  1547 	unlink $TestNRflagpkg;
       
  1548 	unlink $TestNRflagsis;
       
  1549 	unlink $TestNRflagLog;
       
  1550 	use File::Path;
       
  1551 	rmtree "$dir$DumpsisGenPkgPath";
       
  1552 	}