1*cdf0e10cSrcweir#!/bin/ksh 2*cdf0e10cSrcweir######################################################################### 3*cdf0e10cSrcweir 4*cdf0e10cSrcweir #************************************************************************* 5*cdf0e10cSrcweir # 6*cdf0e10cSrcweir# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7*cdf0e10cSrcweir# 8*cdf0e10cSrcweir# Copyright 2000, 2010 Oracle and/or its affiliates. 9*cdf0e10cSrcweir# 10*cdf0e10cSrcweir# OpenOffice.org - a multi-platform office productivity suite 11*cdf0e10cSrcweir# 12*cdf0e10cSrcweir# This file is part of OpenOffice.org. 13*cdf0e10cSrcweir# 14*cdf0e10cSrcweir# OpenOffice.org is free software: you can redistribute it and/or modify 15*cdf0e10cSrcweir# it under the terms of the GNU Lesser General Public License version 3 16*cdf0e10cSrcweir# only, as published by the Free Software Foundation. 17*cdf0e10cSrcweir# 18*cdf0e10cSrcweir# OpenOffice.org is distributed in the hope that it will be useful, 19*cdf0e10cSrcweir# but WITHOUT ANY WARRANTY; without even the implied warranty of 20*cdf0e10cSrcweir# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21*cdf0e10cSrcweir# GNU Lesser General Public License version 3 for more details 22*cdf0e10cSrcweir# (a copy is included in the LICENSE file that accompanied this code). 23*cdf0e10cSrcweir# 24*cdf0e10cSrcweir# You should have received a copy of the GNU Lesser General Public License 25*cdf0e10cSrcweir# version 3 along with OpenOffice.org. If not, see 26*cdf0e10cSrcweir# <http://www.openoffice.org/license.html> 27*cdf0e10cSrcweir# for a copy of the LGPLv3 License. 28*cdf0e10cSrcweir# 29*cdf0e10cSrcweir #************************************************************************* 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir#set -x 32*cdf0e10cSrcweirumask 0 33*cdf0e10cSrcweir 34*cdf0e10cSrcweirinteger TOTAL_PASS=0 35*cdf0e10cSrcweirinteger TOTAL_FAIL=0 36*cdf0e10cSrcweirinteger TOTAL_RUN=0 37*cdf0e10cSrcweirinteger MAX_RETRIES=5 38*cdf0e10cSrcweirtypeset RUNNAME=`date +%Y%m%d%H%M%S` 39*cdf0e10cSrcweirtypeset PRINTDATE=`date` 40*cdf0e10cSrcweirtypeset PDB_INFILE_DIR 41*cdf0e10cSrcweirtypeset PDB_OUTFILE_DIR 42*cdf0e10cSrcweirtypeset XML_OUTFILE_DIR 43*cdf0e10cSrcweirtypeset REPORT 44*cdf0e10cSrcweirtypeset RESDIR 45*cdf0e10cSrcweirtypeset LOGFILE 46*cdf0e10cSrcweirtypeset COMPLOG 47*cdf0e10cSrcweirtypeset TEST_COMMENTS 48*cdf0e10cSrcweirtypeset BGCOLOR 49*cdf0e10cSrcweirtypeset ODD_BGCOLOR='#BBBBBB' 50*cdf0e10cSrcweirtypeset EVEN_BGCOLOR='#DCDCDC' 51*cdf0e10cSrcweirtypeset PASS_COLOR='#00ff00' 52*cdf0e10cSrcweirtypeset FAIL_COLOR='#ff4040' 53*cdf0e10cSrcweir 54*cdf0e10cSrcweirtypeset ENVFILE="" 55*cdf0e10cSrcweir# The following variables should be set in the env file 56*cdf0e10cSrcweirtypeset MASTERLIST="" 57*cdf0e10cSrcweirtypeset TESTCASEDIR="" 58*cdf0e10cSrcweirtypeset RESULTSBASE="" 59*cdf0e10cSrcweirtypeset XMERGE_JAR="" 60*cdf0e10cSrcweirtypeset APORTIS_JAR="" 61*cdf0e10cSrcweirtypeset WORDSMITH_JAR="" 62*cdf0e10cSrcweirtypeset MINICALC_JAR="" 63*cdf0e10cSrcweirtypeset PERL5LIB="" 64*cdf0e10cSrcweirtypeset POSE_EXE="" 65*cdf0e10cSrcweirtypeset POSE_PRC="" 66*cdf0e10cSrcweirtypeset TEST_DRIVER_PL="" 67*cdf0e10cSrcweirtypeset COMPARATOR_PL="" 68*cdf0e10cSrcweirtypeset COMPLIST="" 69*cdf0e10cSrcweirtypeset XML_INFILE_DIR="" 70*cdf0e10cSrcweirtypeset PDB_BASELINE_DIR="" 71*cdf0e10cSrcweirtypeset XML_BASELINE_DIR="" 72*cdf0e10cSrcweirtypeset EM_SCRIPT_HOME="" 73*cdf0e10cSrcweirtypeset QAWRAPPER_SCRIPT_HOME="" 74*cdf0e10cSrcweirtypeset EM_ROM_FILE="" 75*cdf0e10cSrcweirtypeset EM_SESSION_FILE="" 76*cdf0e10cSrcweirtypeset QA_LIB_HOME="" 77*cdf0e10cSrcweirtypeset QA_COMPARATOR_HOME="" 78*cdf0e10cSrcweirtypeset CLASSES_DIR="" 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir################################################################################ 83*cdf0e10cSrcweirUsage() { 84*cdf0e10cSrcweir echo "Usage: run-convtest -env <ENVFILE> [-name RUNNAME]" 85*cdf0e10cSrcweir exit 1 86*cdf0e10cSrcweir} 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir################################################################################ 90*cdf0e10cSrcweirStartReportFile() { 91*cdf0e10cSrcweir typeset line=`date` 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir ReportLine "<HTML>" 94*cdf0e10cSrcweir ReportLine "<HEAD>" 95*cdf0e10cSrcweir ReportLine "<TITLE>XMerge Converters Test Results - ${RUNNAME}</TITLE>" 96*cdf0e10cSrcweir ReportLine "</HEAD>" 97*cdf0e10cSrcweir ReportLine "<BODY BGCOLOR=#ffffff>" 98*cdf0e10cSrcweir ReportLine "<H1 align=center>XMerge Converters Test Results - ${RUNNAME}</H1>" 99*cdf0e10cSrcweir ReportLine "<P>" 100*cdf0e10cSrcweir ReportLine "Test run on: ${PRINTDATE}" 101*cdf0e10cSrcweir ReportLine "<P>" 102*cdf0e10cSrcweir ReportLine "<CENTER>" 103*cdf0e10cSrcweir ReportLine "<TABLE WIDTH='100%' BORDER=1 CELLSPACING=0 CELLPADDING=2>" 104*cdf0e10cSrcweir ReportLine "<TR BGCOLOR='#9999CC'>" 105*cdf0e10cSrcweir ReportLine "<TH>Test Name</TH>" 106*cdf0e10cSrcweir ReportLine "<TH>Test File</TH>" 107*cdf0e10cSrcweir ReportLine "<TH>.ext</TH>" 108*cdf0e10cSrcweir ReportLine "<TH>Result</TH>" 109*cdf0e10cSrcweir ReportLine "<TH>Comments</TH>" 110*cdf0e10cSrcweir ReportLine "</TR>" 111*cdf0e10cSrcweir} 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir################################################################################ 115*cdf0e10cSrcweirEndReportFile() { 116*cdf0e10cSrcweir # remove full path from LOGFILE (link will be to current dir) 117*cdf0e10cSrcweir typeset loglink=${LOGFILE##*/} 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir ReportLine "<P>" 120*cdf0e10cSrcweir ReportLine "<CENTER>" 121*cdf0e10cSrcweir ReportLine "<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=2>" 122*cdf0e10cSrcweir ReportLine "<TR>" 123*cdf0e10cSrcweir ReportLine "<TH>Total Tests PASSED</TH>" 124*cdf0e10cSrcweir ReportLine "<TH>${TOTAL_PASS}</TH>" 125*cdf0e10cSrcweir ReportLine "</TR>" 126*cdf0e10cSrcweir ReportLine "<TR>" 127*cdf0e10cSrcweir ReportLine "<TH>Total Tests FAILED</TH>" 128*cdf0e10cSrcweir ReportLine "<TH>${TOTAL_FAIL}</TH>" 129*cdf0e10cSrcweir ReportLine "</TR>" 130*cdf0e10cSrcweir ReportLine "<TR>" 131*cdf0e10cSrcweir ReportLine "<TH>Total Tests Run</TH>" 132*cdf0e10cSrcweir ReportLine "<TH>${TOTAL_RUN}</TH>" 133*cdf0e10cSrcweir ReportLine "</TR>" 134*cdf0e10cSrcweir ReportLine "</TABLE>" 135*cdf0e10cSrcweir ReportLine "</CENTER>" 136*cdf0e10cSrcweir ReportLine "<P>" 137*cdf0e10cSrcweir ReportLine "<A HREF=${loglink}>Full logfile for test run</A>" 138*cdf0e10cSrcweir ReportLine "<P>" 139*cdf0e10cSrcweir ReportLine "<CENTER>" 140*cdf0e10cSrcweir ReportLine "</BODY>" 141*cdf0e10cSrcweir ReportLine "</HTML>" 142*cdf0e10cSrcweir} 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir################################################################################ 145*cdf0e10cSrcweirReportLine() { 146*cdf0e10cSrcweir echo $1 >> $REPORT 147*cdf0e10cSrcweir} 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir################################################################################ 150*cdf0e10cSrcweirLogLine() { 151*cdf0e10cSrcweir echo $1 >> $LOGFILE 152*cdf0e10cSrcweir} 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir################################################################################ 155*cdf0e10cSrcweirReportTestComments() { 156*cdf0e10cSrcweir if [[ $TEST_COMMENTS == "" ]] ; then 157*cdf0e10cSrcweir TEST_COMMENTS=" " 158*cdf0e10cSrcweir fi 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir ReportLine "<TD>${TEST_COMMENTS}</TD>" 161*cdf0e10cSrcweir} 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir################################################################################ 164*cdf0e10cSrcweirGetParams() { 165*cdf0e10cSrcweir integer argc=$# 166*cdf0e10cSrcweir integer i=0 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir if [[ $argc -lt 1 ]] ; then 169*cdf0e10cSrcweir Usage 170*cdf0e10cSrcweir fi 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir while (($i < $argc)) ; do 173*cdf0e10cSrcweir arg=$1 174*cdf0e10cSrcweir shift 175*cdf0e10cSrcweir i=i+1 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir if [[ $arg == '-name' ]] ; then 178*cdf0e10cSrcweir if (( $i < $argc )) ; then 179*cdf0e10cSrcweir RUNNAME=$1 180*cdf0e10cSrcweir echo "RUNNAME=[$RUNNAME]" 181*cdf0e10cSrcweir shift 182*cdf0e10cSrcweir i=i+1 183*cdf0e10cSrcweir else 184*cdf0e10cSrcweir Usage 185*cdf0e10cSrcweir fi 186*cdf0e10cSrcweir elif [[ $arg == '-env' ]] ; then 187*cdf0e10cSrcweir if (( $i < $argc )) ; then 188*cdf0e10cSrcweir ENVFILE=$1 189*cdf0e10cSrcweir shift 190*cdf0e10cSrcweir i=i+1 191*cdf0e10cSrcweir else 192*cdf0e10cSrcweir Usage 193*cdf0e10cSrcweir fi 194*cdf0e10cSrcweir else 195*cdf0e10cSrcweir Usage 196*cdf0e10cSrcweir fi 197*cdf0e10cSrcweir done 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir if [[ $ENVFILE == "" ]] ; then 200*cdf0e10cSrcweir Usage 201*cdf0e10cSrcweir fi 202*cdf0e10cSrcweir} 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir################################################################################ 206*cdf0e10cSrcweirReadEnvFile() { 207*cdf0e10cSrcweir . $ENVFILE 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir echo "" 211*cdf0e10cSrcweir echo "The following values have been set from $ENVFILE:" 212*cdf0e10cSrcweir echo "MASTERLIST=$MASTERLIST" 213*cdf0e10cSrcweir echo "TESTCASEDIR=$TESTCASEDIR" 214*cdf0e10cSrcweir echo "XMERGE_JAR=$XMERGE_JAR" 215*cdf0e10cSrcweir echo "APORTIS_JAR=$APORTIS_JAR" 216*cdf0e10cSrcweir echo "WORDSMITH_JAR=$WORDSMITH_JAR" 217*cdf0e10cSrcweir echo "MINICALC_JAR=$MINICALC_JAR" 218*cdf0e10cSrcweir echo "RESULTSBASE=$RESULTSBASE" 219*cdf0e10cSrcweir echo "PERL5LIB=$PERL5LIB" 220*cdf0e10cSrcweir echo "POSE_EXE=$POSE_EXE" 221*cdf0e10cSrcweir echo "POSE_PRC=$POSE_PRC" 222*cdf0e10cSrcweir echo "TEST_DRIVER_PL=$TEST_DRIVER_PL" 223*cdf0e10cSrcweir echo "COMPARATOR_PL=$COMPARATOR_PL" 224*cdf0e10cSrcweir echo "XML_INFILE_DIR=$XML_INFILE_DIR" 225*cdf0e10cSrcweir echo "PDB_BASELINE_DIR=$PDB_BASELINE_DIR" 226*cdf0e10cSrcweir echo "XML_BASELINE_DIR=$XML_BASELINE_DIR" 227*cdf0e10cSrcweir echo "EM_SCRIPT_HOME=$EM_SCRIPT_HOME" 228*cdf0e10cSrcweir echo "QAWRAPPER_SCRIPT_HOME=$QAWRAPPER_SCRIPT_HOME" 229*cdf0e10cSrcweir echo "EM_ROM_FILE=$EM_ROM_FILE" 230*cdf0e10cSrcweir echo "EM_SESSION_FILE=$EM_SESSION_FILE" 231*cdf0e10cSrcweir echo "QA_LIB_HOME=$QA_LIB_HOME" 232*cdf0e10cSrcweir echo "QA_COMPARATOR_HOME=$QA_COMPARATOR_HOME" 233*cdf0e10cSrcweir echo "CLASSES_DIR=$CLASSES_DIR" 234*cdf0e10cSrcweir echo "COMPLIST=$COMPLIST" 235*cdf0e10cSrcweir} 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir################################################################################ 238*cdf0e10cSrcweirPOSESetup() { 239*cdf0e10cSrcweir export PERL5LIB 240*cdf0e10cSrcweir export EM_SCRIPT_HOME 241*cdf0e10cSrcweir export QAWRAPPER_SCRIPT_HOME 242*cdf0e10cSrcweir export EM_ROM_FILE 243*cdf0e10cSrcweir export EM_SESSION_FILE 244*cdf0e10cSrcweir export QA_LIB_HOME 245*cdf0e10cSrcweir export QA_COMPARATOR_HOME 246*cdf0e10cSrcweir export CLASSES_DIR 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir} 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir################################################################################ 251*cdf0e10cSrcweirTestSetup() { 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir POSESetup 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir export ZENDEBUG=1 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir COMPLIST="${COMPLIST}/tempcomp.${RUNNAME}.list" 259*cdf0e10cSrcweir # create the directories for the results of this test run 260*cdf0e10cSrcweir RESDIR="${RESULTSBASE}/${RUNNAME}" 261*cdf0e10cSrcweir \rm -Rf $RESDIR 262*cdf0e10cSrcweir mkdir $RESDIR 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir # Define the directories for the test input files, 265*cdf0e10cSrcweir # test output files, working directories and baseline files 266*cdf0e10cSrcweir PDB_INFILE_DIR="${RESDIR}/pdb-orig" 267*cdf0e10cSrcweir mkdir "${PDB_INFILE_DIR}" 268*cdf0e10cSrcweir PDB_OUTFILE_DIR="${RESDIR}/pdb-new" 269*cdf0e10cSrcweir mkdir "${PDB_OUTFILE_DIR}" 270*cdf0e10cSrcweir XML_OUTFILE_DIR="${RESDIR}/xml-new" 271*cdf0e10cSrcweir mkdir "${XML_OUTFILE_DIR}" 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir LOGFILE="${RESDIR}/logfile" 274*cdf0e10cSrcweir COMPLOG="${RESDIR}/complog" 275*cdf0e10cSrcweir REPORT="${RESDIR}/report.html" 276*cdf0e10cSrcweir StartReportFile 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir echo "Results in: $RESDIR" 279*cdf0e10cSrcweir echo "Report file: $REPORT" 280*cdf0e10cSrcweir} 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir################################################################################ 283*cdf0e10cSrcweirTestCleanup() { 284*cdf0e10cSrcweir EndReportFile 285*cdf0e10cSrcweir} 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir################################################################################ 288*cdf0e10cSrcweirTestCaseSetup() { 289*cdf0e10cSrcweir # where to pick up converter classes 290*cdf0e10cSrcweir export CLASSPATH="" 291*cdf0e10cSrcweir export CLASSPATH=$CLASSPATH:$XMERGE_JAR 292*cdf0e10cSrcweir export CLASSPATH=$CLASSPATH:$APORTIS_JAR 293*cdf0e10cSrcweir export CLASSPATH=$CLASSPATH:$WORDSMITH_JAR 294*cdf0e10cSrcweir export CLASSPATH=$CLASSPATH:$MINICALC_JAR 295*cdf0e10cSrcweir} 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir################################################################################ 298*cdf0e10cSrcweirTestCaseCleanup() { 299*cdf0e10cSrcweir # empty function 300*cdf0e10cSrcweir a=42 301*cdf0e10cSrcweir} 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir################################################################################ 304*cdf0e10cSrcweirRunTestCase() { 305*cdf0e10cSrcweir testcase=$1 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir LogLine "" 308*cdf0e10cSrcweir LogLine "test_driver output:" 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir # run test_driver in foreground 311*cdf0e10cSrcweir $TEST_DRIVER_PL\ 312*cdf0e10cSrcweir -pose-prc=${POSE_PRC}\ 313*cdf0e10cSrcweir -pose-exe=${POSE_EXE}\ 314*cdf0e10cSrcweir -xml-orig=${XML_INFILE_DIR}\ 315*cdf0e10cSrcweir -pdb-orig=${PDB_INFILE_DIR}\ 316*cdf0e10cSrcweir -pdb-new=${PDB_OUTFILE_DIR}\ 317*cdf0e10cSrcweir -xml-new=${XML_OUTFILE_DIR}\ 318*cdf0e10cSrcweir -test=$testcase -merge >> $LOGFILE 2>&1 319*cdf0e10cSrcweir 320*cdf0e10cSrcweir # cleanup in case zombie POSE processes are hanging around 321*cdf0e10cSrcweir pkill pose 322*cdf0e10cSrcweir pkill -9 pose 323*cdf0e10cSrcweir} 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir################################################################################ 327*cdf0e10cSrcweirComparisonSetup() { 328*cdf0e10cSrcweir typeset file=$1 329*cdf0e10cSrcweir 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir export CLASSPATH="$CLASSES_DIR/xerces.jar" 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir # create temporary comparator list file for this test case 334*cdf0e10cSrcweir echo $file > $COMPLIST 335*cdf0e10cSrcweir} 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir################################################################################ 338*cdf0e10cSrcweirComparisonCleanup() { 339*cdf0e10cSrcweir # remove temporary comparator list file used for this test case 340*cdf0e10cSrcweir \rm -f $COMPLIST 341*cdf0e10cSrcweir} 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir################################################################################ 344*cdf0e10cSrcweirRunComparison() { 345*cdf0e10cSrcweir typeset type=$1 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir LogLine "" 348*cdf0e10cSrcweir LogLine "Comparator output:" 349*cdf0e10cSrcweir $COMPARATOR_PL\ 350*cdf0e10cSrcweir -xml-orig=${XML_BASELINE_DIR}\ 351*cdf0e10cSrcweir -pdb-orig=${PDB_BASELINE_DIR}\ 352*cdf0e10cSrcweir -pdb-new=${PDB_INFILE_DIR}\ 353*cdf0e10cSrcweir -xml-new=${XML_OUTFILE_DIR}\ 354*cdf0e10cSrcweir -list=$COMPLIST -log=$COMPLOG -type=$type >> $LOGFILE 2>&1 355*cdf0e10cSrcweir# -list=$COMPLIST -log=$COMPLOG -type=$type | tee -a $LOGFILE 2>&1 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir pass=`grep TRUE $COMPLOG | wc -l` 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir LogLine "" 360*cdf0e10cSrcweir LogLine "COMPLIST file:" 361*cdf0e10cSrcweir cat $COMPLIST >> $LOGFILE 362*cdf0e10cSrcweir LogLine "" 363*cdf0e10cSrcweir LogLine "Comparator logfile:" 364*cdf0e10cSrcweir cat $COMPLOG >> $LOGFILE 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir if [ $pass -eq 0 ] 367*cdf0e10cSrcweir then 368*cdf0e10cSrcweir TEST_COMMENTS="${TEST_COMMENTS}$type comparison ERROR<BR>" 369*cdf0e10cSrcweir echo "$type comparison ERROR" 370*cdf0e10cSrcweir return 0 371*cdf0e10cSrcweir fi 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir echo "$type comparison OK" 374*cdf0e10cSrcweir return 1 375*cdf0e10cSrcweir} 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir################################################################################ 378*cdf0e10cSrcweirCheckOutput() { 379*cdf0e10cSrcweir typeset xmlfile="${XML_OUTFILE_DIR}/$1" 380*cdf0e10cSrcweir typeset pdbfile="${PDB_INFILE_DIR}/$2" 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir if [ ! -f $pdbfile ] ; then 383*cdf0e10cSrcweir TEST_COMMENTS="${TEST_COMMENTS}[$pdbfile] does not exist<BR>" 384*cdf0e10cSrcweir LogLine "ERROR: $pdbfile does not exist" 385*cdf0e10cSrcweir echo "ERROR: $pdbfile does not exist" 386*cdf0e10cSrcweir return 0 387*cdf0e10cSrcweir fi 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir if [ ! -f $xmlfile ] ; then 390*cdf0e10cSrcweir TEST_COMMENTS="${TEST_COMMENTS}[$xmlfile] does not exist<BR>" 391*cdf0e10cSrcweir LogLine "ERROR: $xmlfile does not exist" 392*cdf0e10cSrcweir echo "ERROR: $xmlfile does not exist" 393*cdf0e10cSrcweir return 0 394*cdf0e10cSrcweir fi 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir return 1 397*cdf0e10cSrcweir} 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir################################################################################ 400*cdf0e10cSrcweirRunTest() { 401*cdf0e10cSrcweir typeset testcasename 402*cdf0e10cSrcweir typeset testcase 403*cdf0e10cSrcweir typeset testfile 404*cdf0e10cSrcweir typeset pdbfile 405*cdf0e10cSrcweir typeset xmlfile 406*cdf0e10cSrcweir typeset ext 407*cdf0e10cSrcweir integer try 408*cdf0e10cSrcweir integer finished_with_test 409*cdf0e10cSrcweir integer test_pass 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir TestSetup 412*cdf0e10cSrcweir 413*cdf0e10cSrcweir BGCOLOR=$ODD_BGCOLOR 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir while read line ; do 416*cdf0e10cSrcweir # get chars up to 1st space 417*cdf0e10cSrcweir testcasename=${line%% *} 418*cdf0e10cSrcweir testcase="${TESTCASEDIR}/$testcasename" 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir # get 2nd word 421*cdf0e10cSrcweir testfile=${line#* } 422*cdf0e10cSrcweir testfile=${testfile%% *} 423*cdf0e10cSrcweir 424*cdf0e10cSrcweir # get last word 425*cdf0e10cSrcweir ext=${line##* } 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir LogLine "############################################" 428*cdf0e10cSrcweir LogLine "Starting the following testcase" 429*cdf0e10cSrcweir LogLine "testcase = $testcase" 430*cdf0e10cSrcweir LogLine "testfile = $testfile" 431*cdf0e10cSrcweir LogLine "ext = $ext" 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir ReportLine "<TR BGCOLOR='${BGCOLOR}'>" 434*cdf0e10cSrcweir ReportLine "<TD valign=top>$testcasename</TD>" 435*cdf0e10cSrcweir ReportLine "<TD valign=top>$testfile</TD>" 436*cdf0e10cSrcweir ReportLine "<TD valign=top>$ext</TD>" 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir echo "" 439*cdf0e10cSrcweir echo "testcase = $testcase" 440*cdf0e10cSrcweir echo "testfile = $testfile" 441*cdf0e10cSrcweir echo "ext = $ext" 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir try=1 444*cdf0e10cSrcweir finished_with_test=0 445*cdf0e10cSrcweir TEST_COMMENTS="" 446*cdf0e10cSrcweir 447*cdf0e10cSrcweir while (($finished_with_test == 0)) ; do 448*cdf0e10cSrcweir 449*cdf0e10cSrcweir TestCaseSetup 450*cdf0e10cSrcweir RunTestCase $testcase 451*cdf0e10cSrcweir TestCaseCleanup 452*cdf0e10cSrcweir 453*cdf0e10cSrcweir xmlfile="${testfile}.${ext}" 454*cdf0e10cSrcweir 455*cdf0e10cSrcweir if [[ $ext == "sxc" ]] ; then 456*cdf0e10cSrcweir pdbfile="${testfile}-Sheet1.pdb" 457*cdf0e10cSrcweir else 458*cdf0e10cSrcweir pdbfile="${testfile}.pdb" 459*cdf0e10cSrcweir fi 460*cdf0e10cSrcweir 461*cdf0e10cSrcweir CheckOutput $xmlfile $pdbfile 462*cdf0e10cSrcweir res=$? 463*cdf0e10cSrcweir 464*cdf0e10cSrcweir if [[ $res -eq 1 ]] ; then 465*cdf0e10cSrcweir ComparisonSetup $pdbfile 466*cdf0e10cSrcweir RunComparison pdb 467*cdf0e10cSrcweir res=$? 468*cdf0e10cSrcweir# ignore result until pdb comparator is fixed... 469*cdf0e10cSrcweirres=1 470*cdf0e10cSrcweir ComparisonCleanup 471*cdf0e10cSrcweir fi 472*cdf0e10cSrcweir 473*cdf0e10cSrcweir if [[ $res -eq 1 ]] ; then 474*cdf0e10cSrcweir ComparisonSetup $xmlfile 475*cdf0e10cSrcweir RunComparison xml 476*cdf0e10cSrcweir res=$? 477*cdf0e10cSrcweir ComparisonCleanup 478*cdf0e10cSrcweir fi 479*cdf0e10cSrcweir 480*cdf0e10cSrcweir if [[ $res -eq 1 ]] ; then 481*cdf0e10cSrcweir TOTAL_PASS=TOTAL_PASS+1 482*cdf0e10cSrcweir ReportLine "<TD valign=top BGCOLOR='${PASS_COLOR}'>PASS</TD>" 483*cdf0e10cSrcweir ReportTestComments 484*cdf0e10cSrcweir ReportLine "</TR>" 485*cdf0e10cSrcweir LogLine "Test PASSED (on try $try)" 486*cdf0e10cSrcweir echo "Test PASSED (on try $try)" 487*cdf0e10cSrcweir finished_with_test=1 488*cdf0e10cSrcweir else 489*cdf0e10cSrcweir TEST_COMMENTS="${TEST_COMMENTS}error on try ${try}<BR>" 490*cdf0e10cSrcweir LogLine "TEST FAILED (on try $try)" 491*cdf0e10cSrcweir echo "TEST FAILED (on try $try)" 492*cdf0e10cSrcweir 493*cdf0e10cSrcweir if [[ $try -eq $MAX_RETRIES ]] ; then 494*cdf0e10cSrcweir TOTAL_FAIL=TOTAL_FAIL+1 495*cdf0e10cSrcweir ReportLine "<TD valign=top BGCOLOR='${FAIL_COLOR}'>FAIL</TD>" 496*cdf0e10cSrcweir ReportTestComments 497*cdf0e10cSrcweir ReportLine "</TR>" 498*cdf0e10cSrcweir finished_with_test=1 499*cdf0e10cSrcweir fi 500*cdf0e10cSrcweir fi 501*cdf0e10cSrcweir 502*cdf0e10cSrcweir try=try+1 503*cdf0e10cSrcweir done 504*cdf0e10cSrcweir 505*cdf0e10cSrcweir TOTAL_RUN=TOTAL_RUN+1 506*cdf0e10cSrcweir 507*cdf0e10cSrcweir # toggle BGCOLOR for next report line 508*cdf0e10cSrcweir if [[ $BGCOLOR == $ODD_BGCOLOR ]] ; then 509*cdf0e10cSrcweir BGCOLOR=$EVEN_BGCOLOR 510*cdf0e10cSrcweir else 511*cdf0e10cSrcweir BGCOLOR=$ODD_BGCOLOR 512*cdf0e10cSrcweir fi 513*cdf0e10cSrcweir 514*cdf0e10cSrcweir done < $MASTERLIST 515*cdf0e10cSrcweir 516*cdf0e10cSrcweir ReportLine "</TABLE>" 517*cdf0e10cSrcweir ReportLine "</CENTER>" 518*cdf0e10cSrcweir 519*cdf0e10cSrcweir TestCleanup 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir echo "Total Tests PASSED: "${TOTAL_PASS} 522*cdf0e10cSrcweir echo "Total Tests FAILED: "${TOTAL_FAIL} 523*cdf0e10cSrcweir echo "Total Tests RUN: "${TOTAL_RUN} 524*cdf0e10cSrcweir echo "Results in: $RESDIR" 525*cdf0e10cSrcweir echo "Report file: $REPORT" 526*cdf0e10cSrcweir} 527*cdf0e10cSrcweir 528*cdf0e10cSrcweir################################################################################ 529*cdf0e10cSrcweir################################################################################ 530*cdf0e10cSrcweir# main 531*cdf0e10cSrcweir################################################################################ 532*cdf0e10cSrcweir################################################################################ 533*cdf0e10cSrcweir 534*cdf0e10cSrcweirGetParams $@ 535*cdf0e10cSrcweirReadEnvFile 536*cdf0e10cSrcweirRunTest 537*cdf0e10cSrcweir 538*cdf0e10cSrcweirexit 0 539