os/mm/mmtestenv/mmtesttools/Scripts/TestResultsComparisonTool/TestScriptResults.pm
Update contrib.
     1 # Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 
     3 # This component and the accompanying materials are made available
 
     4 # under the terms of "Eclipse Public License v1.0"
 
     5 # which accompanies this distribution, and is available
 
     6 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
 
     8 # Initial Contributors:
 
     9 # Nokia Corporation - initial contribution.
 
    16 package TestScriptResults;
 
    22 my $KTestDidNotCrash = 0;
 
    26 our $KCoreConfTest = "CoreConf";
 
    27 our $KTEFTest = "TEF";
 
    28 our $KTEFNoTestcasesTest = "TEFNoTestcases";	# Some of the older MM TEF tests were implemented without using testcases, in these cases we use the test steps in their place
 
    29 our $KTestFrameworkTest = "TF";
 
    31 our @EXPORT = qw($KCoreConfTest, $KTEFTest, $KTEFNoTestcasesTest, $KTestFrameworkTest);
 
    37 	$this->{ScriptName} = undef;
 
    38 	$this->{FilePath} = undef;
 
    39 	$this->{DidItCrash} = $KTestDidNotCrash;
 
    40 	$this->{TotalNumberTestCases} = undef;
 
    41 	$this->{Inconclusives} = [1];	# First entry gives the next free index
 
    42 	$this->{Fails} = [1];	# First entry gives the next free index
 
    43 	$this->{TestHarness} = undef;
 
    51 	$this->{ScriptName} = shift;
 
    57 	return $this->{ScriptName};
 
    63 	$this->{FilePath} = shift;
 
    69 	return $this->{FilePath};
 
    75 	$this->{TestHarness} = $KCoreConfTest;	
 
    81 	$this->{TestHarness} = $KTEFTest;
 
    84 sub TEFNoTestcasesTest
 
    87 	$this->{TestHarness} = $KTEFNoTestcasesTest;
 
    93 	$this->{TestHarness} = $KTestFrameworkTest;
 
    99 	return $this->{TestHarness};	
 
   102 sub AddInconclusiveResult
 
   105 	my $currentFreeIndex = $this->{Inconclusives}[0];
 
   106 	$this->{Inconclusives}[$currentFreeIndex] = shift;
 
   108 	$this->{Inconclusives}[0] = $currentFreeIndex;
 
   111 sub ResetInconclusives
 
   114 	$this->{Inconclusives}[0] = 1;	
 
   120 	my @inconList = @{$this->{Inconclusives}};	
 
   121 	my $finalIndex = $inconList[0] - 1;
 
   122 	return @inconList[1 .. $finalIndex];	
 
   128 	my $currentFreeIndex = $this->{Fails}[0];
 
   129 	$this->{Fails}[$currentFreeIndex] = shift;
 
   131 	$this->{Fails}[0] = $currentFreeIndex;
 
   137 	$this->{Fails}[0] = 1;	
 
   143 	my @failureList = @{$this->{Fails}};	
 
   144 	my $finalIndex = $failureList[0] - 1;
 
   145 	return @failureList[1 .. $finalIndex];
 
   148 sub SetTotalTestCount
 
   151 	$this->{TotalNumberTestCases} = shift;
 
   157 	return $this->{TotalNumberTestCases};
 
   163 	$this->{DidItCrash} = $KTestCrashed;
 
   169 	$this->{DidItCrash} = $KTestDidNotCrash;
 
   175 	return $this->{DidItCrash};
 
   181 	if (($this->{Fails}[0] > 1) || ($this->{Inconclusives}[0] > 1) || ($this->DidItCrash()))
 
   191 	print "\nTest script: $this->{ScriptName}\n$this->{FilePath}\n";
 
   192 	if ($this->{DidItCrash} == $KTestCrashed)
 
   194 		print "It CRASHED\n";
 
   196 	print "Test cases run: $this->{TotalNumberTestCases}\n";
 
   198 	my $lastIndex = $this->{Inconclusives}[0] - 1;
 
   201 		print "INCONCLUSIVES:\n";
 
   202 		foreach my $inconclusiveResult (@{$this->{Inconclusives}}[1 .. $lastIndex])
 
   204 			print "$inconclusiveResult\n";
 
   208 	$lastIndex = $this->{Fails}[0] - 1;
 
   212 		foreach my $failResult (@{$this->{Fails}}[1 .. $lastIndex])
 
   214 			print "$failResult\n";