From 252a214c3b9bdc6e620790f11705b391c7d1a860 Mon Sep 17 00:00:00 2001 From: "leila.garin%eng.sun.com" Date: Tue, 19 Oct 1999 18:48:53 +0000 Subject: [PATCH] New perl automated script. --- java/dom/tests/src/BWProperties | 5 +- java/dom/tests/src/BWTestThread.java | 106 ++++ java/dom/tests/src/README | 73 ++- java/dom/tests/src/README.html | 201 ++++++++ java/dom/tests/src/TestLoader.java | 43 +- ...CharacterDataImpl_appendData_String_0.java | 5 + ...CharacterDataImpl_appendData_String_1.java | 5 + ...haracterDataImpl_deleteData_int_int_0.java | 5 + ...haracterDataImpl_deleteData_int_int_1.java | 5 + ...haracterDataImpl_deleteData_int_int_2.java | 5 + ...haracterDataImpl_deleteData_int_int_3.java | 5 + ...haracterDataImpl_deleteData_int_int_4.java | 5 + ...haracterDataImpl_deleteData_int_int_5.java | 5 + ...haracterDataImpl_deleteData_int_int_6.java | 5 + ...haracterDataImpl_deleteData_int_int_7.java | 5 + ...haracterDataImpl_deleteData_int_int_8.java | 5 + .../src/api/CharacterDataImpl_getData.java | 5 + ...acterDataImpl_insertData_int_String_0.java | 5 + ...acterDataImpl_insertData_int_String_1.java | 5 + ...acterDataImpl_insertData_int_String_2.java | 5 + ...acterDataImpl_insertData_int_String_3.java | 5 + ...acterDataImpl_insertData_int_String_4.java | 5 + ...acterDataImpl_insertData_int_String_5.java | 5 + ...DataImpl_replaceData_int_int_String_0.java | 5 + ...DataImpl_replaceData_int_int_String_1.java | 5 + ...ataImpl_replaceData_int_int_String_10.java | 5 + ...ataImpl_replaceData_int_int_String_11.java | 5 + ...ataImpl_replaceData_int_int_String_12.java | 5 + ...ataImpl_replaceData_int_int_String_13.java | 5 + ...ataImpl_replaceData_int_int_String_14.java | 5 + ...ataImpl_replaceData_int_int_String_15.java | 5 + ...ataImpl_replaceData_int_int_String_16.java | 5 + ...ataImpl_replaceData_int_int_String_17.java | 5 + ...DataImpl_replaceData_int_int_String_2.java | 5 + ...DataImpl_replaceData_int_int_String_3.java | 5 + ...DataImpl_replaceData_int_int_String_4.java | 5 + ...DataImpl_replaceData_int_int_String_5.java | 5 + ...DataImpl_replaceData_int_int_String_6.java | 5 + ...DataImpl_replaceData_int_int_String_7.java | 5 + ...DataImpl_replaceData_int_int_String_8.java | 5 + ...DataImpl_replaceData_int_int_String_9.java | 5 + .../CharacterDataImpl_setData_String_0.java | 5 + .../CharacterDataImpl_setData_String_1.java | 7 +- ...acterDataImpl_substringData_int_int_0.java | 5 + ...acterDataImpl_substringData_int_int_1.java | 5 + ...acterDataImpl_substringData_int_int_2.java | 5 + ...acterDataImpl_substringData_int_int_3.java | 5 + ...acterDataImpl_substringData_int_int_4.java | 5 + ...acterDataImpl_substringData_int_int_5.java | 5 + ...acterDataImpl_substringData_int_int_6.java | 5 + ...acterDataImpl_substringData_int_int_7.java | 5 + ...acterDataImpl_substringData_int_int_8.java | 5 + .../DocumentImpl_createElement_String_1.java | 5 + ...ntImpl_createEntityReference_String_1.java | 5 + ...lementImpl_removeAttributeNode_Attr_0.java | 5 + ...lementImpl_removeAttributeNode_Attr_1.java | 5 + .../ElementImpl_removeAttribute_String_0.java | 5 + .../ElementImpl_removeAttribute_String_1.java | 5 + .../ElementImpl_setAttributeNode_Attr_0.java | 5 + .../ElementImpl_setAttributeNode_Attr_1.java | 5 + ...mentImpl_setAttribute_String_String_0.java | 5 + ...mentImpl_setAttribute_String_String_1.java | 5 + ...mentImpl_setAttribute_String_String_2.java | 7 +- ...mentImpl_setAttribute_String_String_3.java | 5 + ...dNodeMapImpl_removeNamedItem_String_0.java | 5 + ...dNodeMapImpl_removeNamedItem_String_1.java | 5 + .../NamedNodeMapImpl_setNamedItem_Node_0.java | 5 + .../NamedNodeMapImpl_setNamedItem_Node_1.java | 5 + .../NodeImpl_insertBefore_Node_Node_0.java | 5 + .../NodeImpl_insertBefore_Node_Node_1.java | 5 + .../NodeImpl_insertBefore_Node_Node_2.java | 5 + .../NodeImpl_insertBefore_Node_Node_3.java | 5 + .../api/NodeImpl_setNodeValue_String_0.java | 5 + .../api/NodeImpl_setNodeValue_String_1.java | 5 + ...ssingInstructionImpl_setData_String_0.java | 5 + ...ssingInstructionImpl_setData_String_1.java | 5 + .../src/api/TextImpl_splitText_int_0.java | 5 + .../src/api/TextImpl_splitText_int_1.java | 5 + .../src/api/TextImpl_splitText_int_2.java | 5 + java/dom/tests/src/autorun.pl | 483 ++++++++++++++++++ java/dom/tests/src/autorun.sh | 76 ++- java/dom/tests/src/mozilla.bat | 12 + java/dom/tests/src/mozilla.csh | 10 +- 83 files changed, 1346 insertions(+), 37 deletions(-) create mode 100644 java/dom/tests/src/BWTestThread.java create mode 100644 java/dom/tests/src/README.html create mode 100644 java/dom/tests/src/autorun.pl create mode 100644 java/dom/tests/src/mozilla.bat diff --git a/java/dom/tests/src/BWProperties b/java/dom/tests/src/BWProperties index 115f4b521849..df794794903a 100755 --- a/java/dom/tests/src/BWProperties +++ b/java/dom/tests/src/BWProperties @@ -1,4 +1,5 @@ -BW_TESTDIR=/workspace/mozilla/java/dom/tests/src +BW_TESTDIR=/home/user/Blackwood/src/JavaDOM/CoreLevel1/src BW_TESTFILE=BWTestClass.lst -BW_LOGDIR=/workspace/mozilla/java/dom/tests/src/log +BW_LOGDIR=/home/user/Blackwood/src/JavaDOM/CoreLevel1/src/log BW_LOGFILE=BWTest.log +BW_THREADMODE=S diff --git a/java/dom/tests/src/BWTestThread.java b/java/dom/tests/src/BWTestThread.java new file mode 100644 index 000000000000..9150ea76e276 --- /dev/null +++ b/java/dom/tests/src/BWTestThread.java @@ -0,0 +1,106 @@ +/** + * @author Raju Pallath + * @version 1.0 + * + * This class is the Base Thread Class for all test cases. + * Using this, we can run test cases ina multi threaded fashion. + * + */ + +package org.mozilla.dom.test; + +public class BWTestThread extends Thread +{ + + /** + * Constructor + * + * @param str Thread Name + * + * @return + * + */ + public BWTestThread (String astr) + { + + super(astr); + threadName = astr; + if (threadName == null) + threadName = "defaultThread"; + } + + + /** + * Set the Test Case ClassObject which has to be launched by this thread. + * and the Base Document Object. + * all these objects extend from BWBaseTest class. + * + * @param aobj Test Class Object reference + * (subclassed from BWBaseTest). + * @param atargetObj Base Document Object Reference + * + * + * @return + * + */ + public void setTestObject(Object aobj, Object atargetObj) + { + classObj = aobj; + targetObj = atargetObj; + } + + + /** + * Get the Test Case Object Reference. + * + * @return Test Object Reference + * + */ + public Object getTestObject() + { + return classObj; + } + + + /** + * Get the Thread Name + * + * @return thread name string + * + */ + public String getThreadName() + { + return threadName; + } + + /** + * Thread Run Method + * + * @return + * + */ + public void run() + { + if (classObj == null) return; + if (targetObj == null) return; + try { + Thread.sleep (10); + } catch (Exception e) { + } + execute(); + + } + + public synchronized void execute() + { + if (((BWBaseTest)classObj).execute(targetObj)) { + TestLoader.txtPrint(threadName, "PASSED"); + } else { + TestLoader.txtPrint(threadName, "FAILED"); + } + } + + private Object classObj=null; + private Object targetObj=null; + private String threadName=null; +} diff --git a/java/dom/tests/src/README b/java/dom/tests/src/README index 309c48006e34..7ed5e60eca41 100755 --- a/java/dom/tests/src/README +++ b/java/dom/tests/src/README @@ -1,4 +1,7 @@ +This document describes steps required to run the Test Suite for JavaDOM API. +For Solaris +=========== 1) open mozilla.csh 2) make changes to variables @@ -11,21 +14,23 @@ this will set up the environment 4) Edit BWProperties file and change the locations for variables - BW_TESTDIR - BW_LOGDIR + BW_TESTDIR (Absolute Directory Path where file BWTestClass.lst is + located) + BW_LOGDIR (Absolute Directory Path where log files need to be + created) + BW_THREADMODE (Execute tests in single thread [S] or + multi-thread [M] mode. Takes values S/M.) - 5) Run the Makefile - - 6) Copy test.html and test.xml files to your Web-Servers DOCUMENT_ROOT + 5) Copy test.html and test.xml files to your Web-Servers DOCUMENT_ROOT (By default it is assumed that they can be accessed as http:///text.html). or http:///~/text.html). - 7) Invoke autorun.sh from command prompt. + 6) Invoke autorun.sh from command prompt. sh autorun.sh - 8) The results are recorded in HTML file BWTest.html + 7) The results are recorded in HTML file BWTest.html and in log file BWTest.log Individual test Log files are also found in 'log' directory. @@ -35,10 +40,7 @@ To Invoke a specific test case sh autorun.sh -t org.mozilla.dom.test.AttrImpl_getName -NOTE: All Test Cases are recorded in file BWTestClass.lst.ORIG - ---------------------------------------------------------------------------- - +NOTE: All Test Cases are reocorded in file BWTestClass.lst.ORIG Assumption: @@ -51,3 +53,52 @@ Assumption: +============================================================================= + +For WIN32 +=========== +Assumes you have installed PERL + + 1) open mozilla.bat + + 2) make changes to variables + BLACKWOOD_HOME - the path to the parent directory of this one + MOZILLA_FIVE_HOME + JAVA_HOME + TEST_PATH + TEST_URL- as explained below + + 3) execute mozilla.bat from command prompt + this will set up the environment for this command prompt + + 4) Edit BWProperties file and change the locations for variables + BW_TESTDIR (Absolute Directory Path where file BWTestClass.lst is + located) + BW_LOGDIR (Absolute Directory Path where log files need to be + created) + BW_THREADMODE (Execute tests in single thread [S] or + multi-thread [M] mode. Takes values S/M.) + + 5) Copy files test.html and test.xml into + some document directory of HTTP server. TEST_URL environment + variable should contain the URL of this directory. + For example, if you placed the files in the root directory of + HTTP server "myserver", then value of TEST_URL should be + "http://myserver". + + 6) Invoke autorun.pl from command prompt. + perl autorun.pl + + 7) The results are recorded in HTML file BWTest.html + and in log file BWTest.log + Individual test Log files are also found in 'log' directory. + + +--------------------------------------------------------------------------- + +To Invoke a specific test case + perl autorun.pl -t org.mozilla.dom.test.AttrImpl_getName + +NOTE: All Test Cases are recorded in file BWTestClass.lst.ORIG + +--------------------------------------------------------------------------- diff --git a/java/dom/tests/src/README.html b/java/dom/tests/src/README.html new file mode 100644 index 000000000000..bc79d8ac500c --- /dev/null +++ b/java/dom/tests/src/README.html @@ -0,0 +1,201 @@ + + + + + + + + +
+

+README for DOM API Test Execution

+ +
+
+Solaris +
    +
  • +open mozilla.csh
  • +
+ +
    +
  • +make changes to variables
  • + +
      +
    • +BLACKWOOD_HOME
    • + +
    • +MOZILLA_FIVE_HOME
    • + +
    • +JAVA_HOME
    • + +
    • +TEST_PATH
    • +
    +
+ +
    +
  • +source mozilla.csh this will set up the environment
  • +
+ +
    +
  • +Edit BWProperties file and change the locations for variables
  • +
+ +
+ + + + + + + + + + + + + + + + + +
BW_TESTDIRAbsolute Directory Path where file BWTestClass.lst is located.
BW_LOGDIRAbsolute D.irectory  Path where log files need to be created.
BW_THREADMODEIndicates whether to execute tests in single-thread mode[S]     +or multi-thread mode[M].  Takes values S/M .
+ +
     
+ +
    +
  • +Copy test.html and test.xml +files to your web-servers DOCUMENT_ROOT ( By default it is assumed that +they can be  accessed as http://[server name]/text.html  +or http://[servername]/~[username]/text.html).
  • +
+ +
    +
  • +Invoke autorun.sh from command prompt.
  • + +
      +
    • +sh autorun.sh
    • +
    +
+ +
    +
  • +The results are recorded in HTML file BWTest.html +and in log file BWTest.log Individual test +Log files are also found in 'log' directory.
  • +
+ +
 To Invoke a specific test +case +
sh autorun.sh -t org.mozilla.dom.test.AttrImpl_getName
+NOTE:All Test Cases +are recorded in file BWTestClass.lst.ORIG +

ASSUMPTION: I assume +that u have copied the files test.xml and test.html to your DOCUMENT_ROOT +of your WebServer. +
The URL it tries to load is http://[servername]/test.html. +
If it is set in users public_html then open file autorun.sh +and change DOCROOT accordingly. +

+


+
Windows NT +
    +
  • +open mozilla.bat
  • +
+ +
    +
  • +make changes to variables
  • + +
      +
    • +BLACKWOOD_HOME
    • + +
    • +MOZILLA_FIVE_HOME
    • + +
    • +JAVA_HOME
    • + +
    • +TEST_PATH
    • + +
    • +TEST_URL
    • +
    +
+ +
    +
  • +execute  mozilla.bat from command prompt.
  • + +
     this will set up the environment for this command +prompt.
+ +
    +
  • +Edit BWProperties file and change the locations for variables
  • +
+ +
+ + + + + + + + + + + + + + + + + +
BW_TESTDIRAbsolute Directory Path where file BWTestClass.lst is located.
BW_LOGDIRAbsolute D.irectory  Path where log files need to be created.
BW_THREADMODEIndicates whether to execute tests in single-thread mode[S]     +or multi-thread mode[M].  Takes values S/M .
+ +
     
+ +
    +
  • +Copy files test.htmland test.xml +into some document directory of HTTP server. TEST_URL environment variable +should contain the URL of this directory.
  • + +
     For example, if you placed the files in the +root directory of   HTTP server "myserver", +then value of TEST_URL should be  "http://myserver".
+ +
    +
  • +Invoke autorun.pl from command prompt.
  • + +
      +
    • +perl autorun.pl
    • +
    +
+ +
    The results are recorded in HTML file BWTest.html +and in log file BWTest.log Individual test +Log files are also found in 'log' directory.
+ +
+
  + + diff --git a/java/dom/tests/src/TestLoader.java b/java/dom/tests/src/TestLoader.java index 990a30512431..57435b1d260d 100755 --- a/java/dom/tests/src/TestLoader.java +++ b/java/dom/tests/src/TestLoader.java @@ -108,7 +108,7 @@ public class TestLoader } } } catch (Exception e) { - System.out.println("could not read Line from file fname..."); + System.out.println("could not read Line from file " + fname); line=null; } @@ -119,6 +119,13 @@ public class TestLoader return null; } + // check if test have to be run in single Thread mode(S) or + // multi Thread mode (M) + // + String threadMode = propTable.getProperty("BW_THREADMODE"); + if (threadMode == null) + threadMode = "S"; + for (int i=0; i ]\n"; + print "\n"; + print " where is one of the test cases prefixed with package\n"; + print " name ex: org.mozilla.dom.AttrImpl_getSpecified\n"; + print "\n"; + print "##################################################################\n"; + print "\n"; + +} + +################################################################## +# Title display +################################################################## +sub title() { + + print "\n"; + print "################################################\n"; + print " Automated Execution of DOM API TestSuite\n"; + print "################################################\n"; + print "\n"; + print "NOTE: You need to copy files test.html and test.xml into \n"; + print " some document directory of HTTP server. TEST_URL environment \n"; + print " variable should contain the URL of this directory.\n"; + print "\n"; + print "\n"; + +} + +################################################################## +# +# check which tests to run. XML/HTML or both +# +################################################################## +sub checkRun() { + $runtype = "0"; + while( true ) { + print "Run 1) HTML Test suite.\n"; + print " 2) XML Test suite.\n"; + print " 3) BOTH HTML and XML.\n"; + print "Enter choice (1-3) :\n"; + $runtype = getc; + + if(( $runtype ne "1" ) && + ( $runtype ne "2" ) && + ( $runtype ne "3" ) ) + { + print "Invaid choice. Range is from 1-3...\n"; + print "\n"; + next; + } else { + last; + } + } +} + + +######################################################################### +# +# Append table entries to Output HTML File +# +######################################################################### +sub appendEntries() { + print LOGHTML "\n"; + print LOGHTML "\n"; + print LOGHTML "Test Status (XML)Result\n"; + +} + +######################################################################### +# +# Construct Output HTML file Header +# +######################################################################### +sub constructHTMLHeader() { + print LOGHTML "\n"; + print LOGHTML "DOMAPI Core Level 1 Test Status\n"; + print LOGHTML "\n"; + print LOGHTML "

\n"; + print LOGHTML "DOM API Automated TestRun Results\n"; + $date = localtime; + print LOGHTML "

", $date; + print LOGHTML "

\n"; + print LOGHTML "
"; + print LOGHTML "\n"; + print LOGHTML "\n"; + print LOGHTML "\n"; + print LOGHTML "\n"; + print LOGHTML "\n"; +} + +######################################################################### +# +# Construct Output HTML file indicating status of each run +# +######################################################################### +sub constructHTMLBody() { + + open( MYLOG, $LOGTXT ); + @all_lines = ; + close( MYLOG ); + + my $line; + foreach $line ( sort @all_lines ) { + # avoid linebreaks + chop $line; + # assuming that all lines are kind'of 'aaa=bbb' + ($class, $status) = split /=/, $line; + + print LOGHTML "\n"; + } +} + +######################################################################### +# +# Construct Output HTML file Footer +# +######################################################################### +sub constructHTMLFooter() { + print LOGHTML "
Test CaseResult
",$class,"",$status,"
\n"; +} + +######################################################################### +# +# Construct Output HTML file indicating status of each run +# +######################################################################### +sub constructHTML() { + constructHTMLHeader; + constructHTMLBody; +} + +######################################################################### +# +# Construct LogFile Header. The Log file is always appended with entries +# +######################################################################### +sub constructLogHeader() { + print LOGFILE "\n"; + print LOGFILE "\n"; + print LOGFILE $delimiter; + $date = localtime; + print LOGFILE "Logging Test Run on $date ...\n"; + print LOGFILE $delimiter; + print LOGFILE "\n"; + + print "All Log Entries are maintained in LogFile $LOGFILE\n"; + print "\n"; +} + +######################################################################### +# +# Construct LogFile Footer. +# +######################################################################### +sub constructLogFooter() { + print "\n"; + print LOGFILE $delimiter; + $date = localtime; + print LOGFILE "End of Logging Test $date ...\n"; + print LOGFILE $delimiter; + print "\n"; +} + +######################################################################## +# +# Construct Log String +# +######################################################################## +sub constructLogString { + my $logstring = shift(@_); + print LOGFILE "$logstring\n"; + +} + +######################################################################## +# +# Safely append to file : open, append, close. +# +######################################################################## +sub safeAppend { + my $file = shift(@_); + my $line = shift(@_); + open (FILE, ">>$file") or die ("Cann't open $file"); + print FILE $line; + close FILE; +} + + + +################################################################## +# main +################################################################## +title; + +$curdir = cwd(); + +# Prepare file names +$LOGFILE = "$curdir/log/BWTestRun.log"; +$LOGTXT = "$curdir/log/BWTest.txt"; +$LOGHTML = "$curdir/log/BWTest.html"; + +# process command-line parameters +# and check for valid usage + +$testparam = ""; + +if ( $#ARGV > 1 ) { + usage; + die; +} + +if ( $#ARGV > 0 ) { + if ( $ARGV[0] != "-t" ) { + usage; + die; + } else { + $testparam = $ARGV[1]; + } +} + +if ( $testparam eq "" ) { + print "WARNING: Your are going to execute the whole test suite....\n"; + checkRun; +} + +$mozhome = @ENV{"MOZILLA_FIVE_HOME"}; +if ( $mozhome eq "" ) { + print "MOZILLA_FIVE_HOME is not set. Please set it and rerun this script....\n"; + die; +} + +if ( ! -f "$mozhome/apprunner.exe" ) { + print "Could not find 'apprunner.exe' in MOZILLA_FIVE_HOME.\n"; + print "Please check your setting...\n"; + die; +} + +# Here must come a piece of code, that determinates +# apprunner instance, removes core, but there's no +# core under win32 + +# Backup existing .lst file +if ( -f "$curdir/BWTestClass.lst" ) { + rename "$curdir/BWTestClass.lst", "$curdir/BWTestClass.lst.bak"; +} + +# Check if ORIG list file is present +# this file contains all test cases +if ( ! -f "$curdir/BWTestClass.lst.ORIG" ) { + print "\n"; + print "File BWTestClass.lst.ORIG not found ...\n"; + print "Check Mozilla Source base and bringover this file....\n"; + print "\n"; +} + +$id=$$; +# Check if BWProperties file exists +# +if ( -f "$mozhome/BWProperties" ) { + $newfile="$mozhome/BWProperties.$id"; + rename "$mozhome/BWProperties", $newfile; +} +copy "$curdir/BWProperties", "$mozhome/BWProperties"; + +# check if output text file of previous run exists. +# if so, then save it as .bak +# +if ( -f "$LOGTXT" ) { + $newfile="$LOGTXT.bak"; + rename $LOGTXT, $newfile; +} + +# check if output html file of previous run exists. +# if so, then save it as .bak +# +if ( -f "$LOGHTML" ) { + $newfile="$LOGHTML.bak"; + rename $LOGHTML, $newfile; +} + +# construct DOCFILE +$DOCFILE = "$DOCROOT/test.html"; +$runcnt = 1; +$filename = "$curdir/BWTestClass.lst.ORIG"; + +if ($runtype == 1) { + $DOCFILE = "$DOCROOT/test.html"; + $filename = "$curdir/BWTestClass.lst.html.ORIG"; + $runcnt = 1; +} + +if ($runtype == 2) { + $DOCFILE = "$DOCROOT/test.xml"; + $filename = "$curdir/BWTestClass.lst.xml.ORIG"; + $runcnt = 1; +} + +if ($runtype == 3) { + $DOCFILE = "$DOCROOT/test.html"; + $filename = "$curdir/BWTestClass.lst.html.ORIG"; + $runcnt = 2; +} + +# Prepare log streams +open( LOGFILE, ">>$LOGFILE" ) or die("Can't open LOG file...\n"); +select LOGFILE; $| = 1; select STDOUT; +open( LOGHTML, ">$LOGHTML" ) or die("Can't open HTML file...\n"); + +print "Runtype is $runtype \n"; +constructLogHeader(); + +$ENV{"CLASSPATH"} = "$curdir/../classes".$path_separator.$ENV{"CLASSPATH"}; + +$LST_OUT = "$curdir/BWTestClass.lst"; + + +$currcnt = 0; +while (true) { + open( file, $filename ) or die("Can't open $filename...\n"); + while( $line = ) { + chop $line; + if ( $testparam ne "" ) { + $testcase = $testparam; + } else { + $testcase = $line; + } + + if ( $testcase =~ /^\s*#/ ) { + next; + } + + open(LST_OUT, ">$LST_OUT") or die ("Can't open LST_OUT file...\n"); + print LST_OUT $testcase; + close(LST_OUT); + + chdir( $mozhome ); + print "========================================\n"; + $logstr="Running TestCase $testcase...."; + print "$logstr\n"; + constructLogString "$logstr"; + + ($nom) = ($testcase =~ /([^\.]*)$/); + $testlog = "$curdir/log/$nom.$id.log"; + + open( SAVEOUT, ">&STDOUT" ); + open( SAVEERR, ">&STDERR" ); + open( STDOUT, ">$testlog" ) or die "Can't redirect stdout"; + open( STDERR, ">&STDOUT" ); + Win32::Process::Create($ProcessObj, + "$mozhome/apprunner.exe", + "$mozhome/apprunner.exe $DOCFILE ", + 1, + NORMAL_PRIORITY_CLASS, + "$mozhome" ) || die "cann't start apprunner"; + close( STDOUT ); + close( STDERR ); + open( STDOUT, ">&SAVEOUT" ); + open( STDERR, ">&SAVEERR" ); + + $flag = 0; + $cnt = 0; + while (true) { + sleep($DELAY_OF_CYCLE); + + $ProcessObj->GetExitCode($exit_code); + if ( $exit_code != $STILL_ALIVE ) { + + $logstr = "Test terminated with exit code $exit_code."; + constructLogString "$logstr"; + if ( $exit_code != 0 ) { + safeAppend $LOGTXT, "$testcase=FAILED\n"; + $logstr = "Test FAILED..."; + constructLogString "$logstr"; + } + $logstr = "Check ErrorLog File $testlog "; + constructLogString "$logstr"; + constructLogString ""; + constructLogString ""; + + $flag = 1; + last; + } + + $cnt += $DELAY_OF_CYCLE; + if ( $cnt >= $DELAY_FACTOR ) { + $flag = 0; + $ProcessObj->Kill(0); + last; + } + } # while with sleep + + ( $testparam eq "" ) || last; + + } # while ( $line + + ( ++$currcnt < $runcnt ) || last; + + if ( $runtype == 3 ) { + $DOCFILE="$DOCROOT/test.xml"; + $filename="$curdir/BWTestClass.lst.xml.ORIG"; + constructHTML; + appendEntries; + if ( -f "$LOGTXT" ) { + $newfile = "$LOGTXT.bak"; + rename ($LOGTXT, $newfile) or die( "Cann't clear LOGTXT..." ) ; + } + } + +} # while(true) + +constructLogFooter; +if ( $runtype == 3 ) { + constructHTMLBody; +} else { + constructHTML; +} +constructHTMLFooter; + +$newfile="$mozhome/BWProperties.$id"; +rename "$newfile", "$mozhome/BWProperties"; +chdir($curdir); + + + + + + + + + + + diff --git a/java/dom/tests/src/autorun.sh b/java/dom/tests/src/autorun.sh index 4d7574d14f46..8ca08f4b84fb 100755 --- a/java/dom/tests/src/autorun.sh +++ b/java/dom/tests/src/autorun.sh @@ -19,6 +19,7 @@ USER=`logname` DOCROOT="http://$SERVER/~$USER" + ################################################################## # Usage ################################################################## @@ -53,6 +54,34 @@ title() echo } +################################################################## +# +# check whether to run tests in single threaded or multi threaded +# mode +# +################################################################## +checkExecutionMode() +{ + executionMode="" + propnom="$curdir/BWProperties" + executionMode=`grep THREADMODE $propnom | cut -d"=" -f2` + + if [ "$executionMode" != "S" ] && + [ "$executionMode" != "s" ] && + [ "$executionMode" != "M" ] && + [ "$executionMode" != "m" ] + then + echo "Entry for BW_THREADMODE in BWProperties file is incorrect." + echo "It should be set to 'S' or 'M'" + echo + echo " Make changes to BWProperties file and re-run this script" + echo + exit 1 + fi + +} + + ################################################################## # # check which tests to run. XML/HTML or both @@ -376,6 +405,24 @@ then fi /bin/cp "$curdir/BWProperties" "$MOZILLA_FIVE_HOME/BWProperties" +# Read the LOGDIR setting from BWProperties and +# accordingly set BWTest.txt location +# +logdir=`grep BW_LOGDIR $curdir/BWProperties | cut -d"=" -f2` +if [ ! -d "$logdir" ] +then + echo + echo "Log Directory $logdir does not exist..."; + echo "Create Directory and re-run this script..."; + echo + exit 1 +fi +LOGTXT="$logdir/BWTest.txt" + + +# check BW_THREADMODE setting from BWPropeties file +# +checkExecutionMode # check if output text file of previous run exists. # if so, then save it as .bak @@ -434,6 +481,8 @@ CLASSPATH="$curdir/../classes:${CLASSPATH}" currcnt=0 while true do + + for i in `cat $filename` do if [ ! -z "$testparam" ] @@ -449,7 +498,20 @@ do continue fi - echo $testcase > $curdir/BWTestClass.lst + # if single threaded execution + if [ "$executionMode" = "S" ] + then + echo $testcase > $curdir/BWTestClass.lst + else + # if multi-threaded but user has specified particular testcase + if [ ! -z "$testparam" ] + then + echo $testcase > $curdir/BWTestClass.lst + else + /bin/cp $filename $curdir/BWTestClass.lst + fi + fi + cd $MOZILLA_FIVE_HOME echo "========================================" @@ -461,6 +523,9 @@ do nom=`basename $format` testlog="$curdir/log/$nom.$id.log" ./apprunner $DOCFILE 2>$testlog 1>&2 & + + # dummy sleep to allow apprunner to show up on process table + sleep 3 curpid=`ps -aef | grep apprunner | grep -v grep | awk '{ print $2 }'` flag=0 @@ -517,10 +582,11 @@ do break fi - #if [ $flag -eq 0 ] - #then - # /bin/rm $testlog - #fi + # if single threaded execution + if [ "$executionMode" = "S" ] + then + break + fi done currcnt=`expr $currcnt + 1` diff --git a/java/dom/tests/src/mozilla.bat b/java/dom/tests/src/mozilla.bat new file mode 100644 index 000000000000..fdea41bcdbcf --- /dev/null +++ b/java/dom/tests/src/mozilla.bat @@ -0,0 +1,12 @@ +set BLACKWOOD_HOME= +set MOZILLA_FIVE_HOME= +set JAVA_HOME= +set TEST_PATH=%BLACKWOOD_HOME% +# url of the directory where you placed test.html and test.xml +set TEST_URL= + +set PATH=%JAVA_HOME%\bin;%PATH% +set PATH=%MOZILLA_FIVE_HOME%;%PATH% + +set CLASSPATH=%MOZILLA_FIVE_HOME%\classes +set CLASSPATH=%TEST_PATH%\classes;%CLASSPATH% diff --git a/java/dom/tests/src/mozilla.csh b/java/dom/tests/src/mozilla.csh index 9bc70078307e..6cb29b4292f4 100755 --- a/java/dom/tests/src/mozilla.csh +++ b/java/dom/tests/src/mozilla.csh @@ -2,20 +2,16 @@ setenv BLACKWOOD_HOME `pwd`/.. setenv MOZILLA_FIVE_HOME `pwd`/../../../../dist/bin setenv JAVA_HOME /usr/local/java/jdk1.2/solaris setenv TEST_PATH ${BLACKWOOD_HOME} -setenv XML_PATH /workspace/xml setenv PREFIX /workspace - setenv LD_LIBRARY_PATH ${JAVA_HOME}/jre/lib/sparc setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${JAVA_HOME}/jre/lib/sparc/classic setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${JAVA_HOME}/jre/lib/sparc/native_threads -setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/workspace/lib:/workspace/mozilla/dist/lib +setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${PREFIX}/lib:${PREFIX}/mozilla/dist/lib setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${MOZILLA_FIVE_HOME} -setenv PATH /bin:/usr/bin:/usr/ccs/bin:/usr/dt/bin -setenv PATH ${PATH}:/usr/dist/local/exe:/usr/dist/exe setenv PATH ${JAVA_HOME}/bin:${PATH} -setenv PATH ${PATH}:${MOZILLA_FIVE_HOME}:/workspace/bin +setenv PATH ${PATH}:${MOZILLA_FIVE_HOME}:${PREFIX}/bin -setenv CLASSPATH ${MOZILLA_FIVE_HOME}/classes:${XML_PATH}/xml.jar:. +setenv CLASSPATH ${MOZILLA_FIVE_HOME}/classes:${PREFIX}/xml/xml.jar:. setenv CLASSPATH ${TEST_PATH}/classes:${CLASSPATH}