diff -r 000000000000 -r 60b4b6493d7b tsrc/testing/tools/rerunsubs.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tsrc/testing/tools/rerunsubs.pl Thu Nov 04 11:16:56 2010 +0200 @@ -0,0 +1,369 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +my $regexpCaseName = '[<>\x3C\x3E\(\)\w.,\/:_\-&\' ]+'; + +{ # No globals. + # Solve where the script is located. + $0=~/^(.+[\\\/])[^\\\/]+[\\\/]*$/; + my $cgidir= $1 || "./"; + + # And try to solve relative path. + if( index( $cgidir, "..\\" ) != -1 ) + { + my $p = cwd; + $p =~ s/\//\\/g; + $cgidir =~ s/\//\\/g; + while(1) + { + my $pos = index( $cgidir, "..\\" ); + last if( $pos == -1 ); + $cgidir = substr( $cgidir, $pos+3 ); + + $pos = rindex( $p, "\\" ); + last if( $pos == -1 ); + $p = substr( $p, 0, $pos); + } + $cgidir = $p . "\\" . $cgidir; + } + + if ( ! -e( $cgidir . "rerunsubs.pl" ) ) + { + $cgidir = cwd; + my $domain = "VideoApp_Domain"; + my $pos = index( $cgidir, $domain ); + if( $pos != -1 ) + { + $cgidir = substr( $cgidir, 0, $pos + length( $domain ) ) . "\\videoplayer\\tsrc\\testing\\tools\\"; + + } + } + + require( $cgidir . "utils.pl" ); +} + +#------------------------------------------------------------------------------------ +# Rerun_ReadFailedCases +# Parameters: +# $filename, filename of the result IPTV_Engine testreport. +# $refCfgs, reference to array which contains failed cases as a result +# +# array +# { +# array { $cfgFilename, @cases }, +# array { $cfgFilename, @cases }, +# ... +# } +# +# returns 1 if something fails, otherwise 0 +#------------------------------------------------------------------------------------ + +sub Rerun_ReadFailedCases +{ + my( $filename, $refCfgs ) = @_; + + if( !open(FILE_HANDLE, $filename) ) + { + print("ERROR! Could not open file '" . $filename . "'\n"); + return 1; + } + my @array = ; + close(FILE_HANDLE); + + my $refCfg; + my $cfgHasFailedCases = 0; + + my $lineCount = scalar(@array); + for($i=0; $i<$lineCount; $i++ ) + { + $line = $array[$i]; + XmlToText(\$line); + $line =~ s/\'/\"/g; + + # Read the name of cfg + if($line =~ m/Cell ss:MergeAcross=\"11\" ss:StyleID=\"/ ) + { + #IptvEpgEngineTest.cfg + if($line =~ m/>([a-z0-9_\-]+).cfg<\/Data>/i) + { + # Add cfg to cfg list if it has failed cases. + if( defined( @$refCfg ) and $cfgHasFailedCases ) + { + push @$refCfgs, [ @$refCfg ]; + } + + # Initialize new array for new cfg, if the cfg exists. + $cfgHasFailedCases = 0; + + my $cfgFilename = $1 . ".cfg"; + + my @cfg; + $refCfg = \@cfg; + push @cfg, $cfgFilename; + my @cases; + push @cfg, [@cases]; + } + } + + #ET17099 <not a test> Setup EPG tests + #ET17001 Update EPG 3G + #PASSED + + # Read case and the result + if( defined( @$refCfg ) && $line =~ m/Cell ss:MergeAcross=\"5\" ss:StyleID=\"/ ) + { + if($line =~ m/>($regexpCaseName)<\/Data><\/Cell>/i) + { + my $caseName = $1; + my $saveCase = 0; + + $line2 = $array[$i+1]; + XmlToText(\$line2); + + #print("Found case: $caseName\n"); + + if( $line =~ m/Setup/i or $line =~ m/not a test/i or $line =~ m/set up/i or $line =~m/not test/i or $line =~m/cleanup/i) + { + #print(" - is for setup\n"); + $saveCase = 1; + } + + # If case has failed. + if($line2 =~ m/>CRASHEDFAILED$destFile"); + close(FILE_HANDLE); + + return 0; + } + + my @foundFailedCases; + + my @lines; + + if( open(FILE_HANDLE, $srcFile) ) + { + @lines = ; + close(FILE_HANDLE); + } + else + { + print("ERROR: could not read file: $srcFile\n"); + return 0; + } + + print("Writing cfg $destFile\n"); + if( !open(FILE_HANDLE, ">$destFile") ) + { + print("ERROR: could not write to file: $destFile\n"); + return 0; + } + + my $lastLineBeforeCases = 0; + for( my $i=0; $i