#!/perl # # The contents of this file are subject to the Mozilla Public # License Version 1.1 (the "License"); you may not use this file # except in compliance with the License. You may obtain a copy of # the License at http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or # implied. See the License for the specific language governing # rights and limitations under the License. # # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is Sun Microsystems, # Inc. Portions created by Sun are # Copyright (C) 1999 Sun Microsystems, Inc. All # Rights Reserved. # # Contributor(s): # Client QA Team, St. Petersburg, Russia use CGI; $LogPath = "/log"; $URLRoot = ""; $LST_FILE = ""; $RESULT_FILE = ""; $CURRENT_LOG = ""; $CGI_BIN_ROOT_DIR = ""; $TEMP_LST_FILE = ""; $LogNPath = ""; $query = new CGI; @testsToRun = $query->param('TestsToRun'); $continue = $query->param('continue'); $stage = $query->param('stage'); open(LST,">$LST_FILE"); print LST join("\n",@testsToRun); close(LST); MakeLogDir(); if($stage == 1){ if($continue =~ /Continue/){ ContinueTesting($testsToRun[0]); }else{ StartTesting($testsToRun[0]); } }else{ StartTesting($testsToRun[0]); } exit 0; sub MakeLogDir{ #Open current log if(-e "$LogPath/$CURRENT_LOG"){ if(-e "$LogPath/$CURRENT_LOG/$RESULT_FILE"){ if($continue!~/Continue/){ unlink("$LogPath/$CURRENT_LOG/$RESULT_FILE"); } } }else{ mkdir("$LogPath/$CURRENT_LOG", 0777); } } ####################################################################### sub StartTesting { my $value = shift(@_); $value=~s/%2F/\//g; print "Content-type:text/html\n\n"; print ""; #print " print ""; print "First test page: $URLRoot/$value.html
"; print "

\n"; print "All logs will be temporary placed to the $LogPath/$CURRENT_LOG/$RESULT_FILE.
"; print "At the end of testing the unique directory will be created in the $LogPath/
"; print "and all log entries will be copied to this unique directory."; print "


"; print "The following tests selected:
"; print "
    "; print join("
    \n",@testsToRun); print "
"; print ""; } sub ContinueTesting { my $value = shift(@_); $value=~s/%2F/\//g; if(-e ("$LogPath/$CURRENT_LOG/$RESULT_FILE") && ("$CGI_BIN_ROOT_DIR/$TEMP_LST_FILE")){ open(RES_FILE, "$LogPath/$CURRENT_LOG/$RESULT_FILE"); open(LST_TEMP, "$CGI_BIN_ROOT_DIR/$TEMP_LST_FILE"); @LINES_RES = ; @LINES_LST = ; close(RES_FILE); close(LST_TEMP); @LINES_RES = sort(@LINES_RES); @LINES_LST = sort(@LINES_LST); $SIZE_RES = @LINES_RES; $SIZE_LST = @LINES_LST; print "Content-type:text/html\n\n"; print "\n\nSelect / Unselect tests"; print "\n"; print "Unselected tests were done in previous session.
Please review/correct checked/unchecked checkboxes and press Continue button.
\n"; print "
/start.cgi\" method=post>\n"; $i1 = 0; for($i=0; $i<$SIZE_LST; $i++){ ($line, $tmp) = split(/=/, $LINES_RES[$i1]); #print "$line
$LINES_LST[$i]
i1=$i1"; if($LINES_LST[$i] =~ /$line/){ $curID = $LINES_LST[$i] ; print "$curID
\n"; $i1++; }else{ $curID = $LINES_LST[$i] ; print "$curID
\n"; } } print "\n

\n"; print "
\n\n"; }else{ print "Content-type:text/html\n\n"; print "Error: previous session not exist or corrupted"; #print " print "\n"; print "

Error: previous session not exist or corrupted

\n"; print ""; print ""; } }