You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2001/01/22 17:42:17 UTC

cvs commit: jakarta-tomcat/src/tests build.xml

costin      01/01/22 08:42:16

  Modified:    .        build.xml
               src/admin/WEB-INF/classes/tadm AntServletLogger.java
                        GTestTag.java
               src/share/org/apache/tomcat/util/test DefaultMatcher.java
                        GTest.java
               src/tests build.xml
  Added:       src/admin/WEB-INF/scripts watchdog-servlet.xml
               src/admin/test watchdog-jsp.jsp watchdog-servlet.jsp
  Log:
  Added code and build changes to allow us to run watchdog using a simple
  web page.
  
  The "right" way to run watchdog is by using the provided scripts. The current
  mechanism ( built using "ant watchdog-web-based" and run by accessing
  http://localhost:8080/admin/test/watchdog-jsp.jsp , watchgod-servlet.jsp )
  is intended to increase the test pool by making it easier for people with
  special platforms to run tests. ( example - I don't think a Mac will run
  either .sh or .bat files ).
  
  Running watchdog as web application is mostly a hack - for example the
  servlet tests are based on moo ( remember moo ? ), and the trick used is
  an <ant> java task that runs it ( with fork=true ), so that the output
  goes to the ant logger ( AntServletLogger in this case ). This is the
  trickiest part, for jsps GTest is used ( and we use <replace> to patch
   in the new GTest ).
  
  This is not production-quality or even close - it's just a quick way to
  get things started ( testing and adding regression tests to the /test
  application ). The nightly builds will include both /test and watchdog,
  in order to allow people to check tomcat on their platform. Running
  the scripts is still the "correct" way to run watchdog.
  
  Revision  Changes    Path
  1.105     +7 -3      jakarta-tomcat/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/build.xml,v
  retrieving revision 1.104
  retrieving revision 1.105
  diff -u -r1.104 -r1.105
  --- build.xml	2001/01/20 21:50:22	1.104
  +++ build.xml	2001/01/22 16:42:00	1.105
  @@ -342,9 +342,13 @@
     <!-- ==================== Build the internal test app =================== -->
   
     <target name="sanity-test">
  -    <ant antfile="src/tests/build.xml" target="sanity-test"/>
  +    <ant antfile="src/tests/build.xml" />
     </target>
   
  +  <target name="watchdog-web-based">
  +    <ant antfile="src/tests/build.xml" target="watchdog" />
  +  </target>
  +
     <!-- ==================== Copy the files to distribution format ======== -->
     <target name="dist" depends="main,webapps,tomcat-jars-new">
   
  @@ -400,7 +404,7 @@
      
     <!-- The self-test app should be removed in the release, but it's 
          useful to have it builded by default -->
  -  <target name="tomcat" depends="prepare,tomcat-jars-new,sanity-test">
  +  <target name="tomcat" depends="prepare,tomcat-jars-new">
     </target>
   
     <target name="clean-classes" depends="init">
  @@ -413,6 +417,6 @@
     </target>
     
     <target name="all" depends="clean,dist"/>
  -  <target name="main" depends="tomcat,webapps"/>
  +  <target name="main" depends="tomcat,webapps,sanity-test"/>
       
   </project>
  
  
  
  1.2       +5 -2      jakarta-tomcat/src/admin/WEB-INF/classes/tadm/AntServletLogger.java
  
  Index: AntServletLogger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/admin/WEB-INF/classes/tadm/AntServletLogger.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AntServletLogger.java	2001/01/20 20:14:28	1.1
  +++ AntServletLogger.java	2001/01/22 16:42:04	1.2
  @@ -105,12 +105,15 @@
   
       public void messageLogged(BuildEvent event) {
           try {
  -	    if( event.getPriority() > 2 )
  +	    if( event.getPriority() > 2 ) 
   		return;
   
  +	    String msg=event.getMessage();
  +	    if( msg.indexOf("is deprecated") > 0 )
  +		return;
  +	    
   	    out.write("\n<br>");
   	    // Print the message
  -	    String msg=event.getMessage();
   	    if( msg.startsWith( "ERROR" )) {
   		out.write("<font color='red'>");
   	    }
  
  
  
  1.6       +2 -1      jakarta-tomcat/src/admin/WEB-INF/classes/tadm/GTestTag.java
  
  Index: GTestTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/admin/WEB-INF/classes/tadm/GTestTag.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- GTestTag.java	2001/01/21 20:10:38	1.5
  +++ GTestTag.java	2001/01/22 16:42:05	1.6
  @@ -128,7 +128,7 @@
   	    // 	    org.apache.tomcat.task.GTest.setHtmlMode( true );
   	    // new one
   	    GTest.setDefaultWriter(out);
  -	    GTest.setDefaultOutput("none"); // external formatting
  +	    GTest.setDefaultOutput(outputType); // external formatting
   	    if(debug!=null)
   		GTest.setDefaultDebug(Integer.valueOf( debug ).intValue());
   	    
  @@ -142,6 +142,7 @@
   	    project.setUserProperty( "ant.file", testFile.toString());
   	    // XXX
   	    project.setUserProperty( "gdir", base + "/Golden");
  +	    project.setUserProperty( "wgdir", base + "/Golden");
   	    
   	    ProjectHelper.configureProject( project, testFile );
   	    
  
  
  
  1.1                  jakarta-tomcat/src/admin/WEB-INF/scripts/watchdog-servlet.xml
  
  Index: watchdog-servlet.xml
  ===================================================================
  <project name="Watchdog-moo" default="main" basedir=".">
  
    <property name="tomcat.home" value="../../../../.."/>
    <property name="ant-file" 
     value="${tomcat.home}/webapps/servlet-tests/WEB-INF/servlet-moo.xml"/>
    
  
    <target name="main" >
      <echo message="XXX ${ant-file} ${tomcat.home} " />
      <java classname="org.apache.tools.ant.Main" 
  	  fork="true" dir="../../../..">
        <classpath>
  	<pathelement
  	        path="../classes" />
  	<pathelement 
  		path="../lib/ant.jar" />
  	<pathelement 
  		path="../../../../lib/jaxp.jar" />
  	<pathelement 
  		path="../../../../lib/parser.jar" />
        </classpath>
        <arg value="-f" />
        <arg value="webapps/servlet-tests/WEB-INF/servlet-moo.xml" />
      </java>
    </target>
  
  </project>
  
  
  1.1                  jakarta-tomcat/src/admin/test/watchdog-jsp.jsp
  
  Index: watchdog-jsp.jsp
  ===================================================================
  <h1>Tomcat Self-test</h1> 
  
  <%@ taglib uri="http://jakarta.apache.org/taglibs/tomcat_admin-1.0" 
             prefix="adm" %>
  
  This page will show the result of executing the sanity test suite. 
  You can see the context log <a href="/jsp-tests/context_log.txt">here</a>
  
  <adm:admin ctxPath="/jsp-tests" 
  	   action="setLogger" 
  	   value="webapps/jsp-tests/context_log.txt" />
  
  
  <adm:gtest testFile="WEB-INF/jsp-gtest.xml" 
  	   testApp="/jsp-tests" 
  	   target='main' 
             debug='<%= request.getParameter("debug") %>' 
             outputType='html' />
  
  <% // Test completed, display the results ( outType=none means
     // Gtest doesn't generate any output ( but we have to wait untill
     // it's done ), use 'html' for "interactive" results
  %>
  
  <% // -------------------- Failures -------------------- %>
  <h1>FAILED Tests</h1>
  
  <adm:iterate name="failures" enumeration="<%= gtestTestFailures.elements() %>" 
                 type="org.apache.tomcat.util.test.GTest" >
  <% // Need more tags - if, etc 
  %>
  <a href='<%= failures.getHttpClient().getURI() %>'> 
  <font color='red'> FAIL </font></a> ( <%= failures.getDescription() %> )
      <%= failures.getHttpClient().getRequestLine() %>
  <br>
  TEST: <%= failures.getMatcher().getTestDescription() %>
  <br>
  <b>Request: </b>
  <pre>
    <%= failures.getHttpClient().getFullRequest() %>
  </pre>
  
  <b>Message: </b>
  <pre>
    <%= failures.getMatcher().getMessage() %>
  </pre>
  
  <b>Response status: </b> 
  <%= failures.getHttpClient().getResponse().getResponseLine() %>
  <br>
  <b>Response headers: </b>
   (I'm not sure how to do embeded iterations, need JSP expert )
  <br>
  
  <b>Response body: </b>
  <pre>
  <%= failures.getHttpClient().getResponse().getResponseBody() %>
  </pre>
  
  </adm:iterate>
  
  
  
  
  1.1                  jakarta-tomcat/src/admin/test/watchdog-servlet.jsp
  
  Index: watchdog-servlet.jsp
  ===================================================================
  <h1>Tomcat Self-test</h1> 
  
  <%@ taglib uri="http://jakarta.apache.org/taglibs/tomcat_admin-1.0" 
             prefix="adm" %>
  
  This page will show the result of executing the sanity test suite. 
  You can see the context log <a href="/servlet-tests/context_log.txt">here</a>
  
  <adm:admin ctxPath="/servlet-tests" 
  	   action="setLogger" 
  	   value="webapps/servlet-tests/context_log.txt" />
  
  
  <adm:gtest testFile="WEB-INF/scripts/watchdog-servlet.xml" 
  	   testApp="/admin" 
  	   target='main'  />
  
  
  
  1.4       +2 -0      jakarta-tomcat/src/share/org/apache/tomcat/util/test/DefaultMatcher.java
  
  Index: DefaultMatcher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/test/DefaultMatcher.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultMatcher.java	2001/01/21 20:10:39	1.3
  +++ DefaultMatcher.java	2001/01/22 16:42:12	1.4
  @@ -223,6 +223,8 @@
   		desc.append( "equals file '" );
   	    else
   		desc.append( "like file '");
  +	    int idx=goldenFile.lastIndexOf("/");
  +	    String g=(idx>0) ? goldenFile.substring(idx) : goldenFile;
   	    desc.append( goldenFile + "') ");
   	}
   
  
  
  
  1.5       +1 -1      jakarta-tomcat/src/share/org/apache/tomcat/util/test/GTest.java
  
  Index: GTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/test/GTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- GTest.java	2001/01/21 20:10:39	1.4
  +++ GTest.java	2001/01/22 16:42:12	1.5
  @@ -289,7 +289,7 @@
   
   	    // don't print OKs
   	    if( result && failureOnly ) return;
  -	    
  +
   	    if( "text".equals(outType) )
   		textReport();
   	    if( "html".equals(outType) )
  
  
  
  1.3       +73 -1     jakarta-tomcat/src/tests/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/tests/build.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- build.xml	2001/01/20 20:11:03	1.2
  +++ build.xml	2001/01/22 16:42:15	1.3
  @@ -16,6 +16,10 @@
     <!-- Directories -->
   
     <property name="tomcat.home" value="../../../build/tomcat"/>
  +  <property name="watchdog.src" 
  +	    value="${tomcat.home}/../../jakarta-watchdog"/>
  +  <property name="watchdog.build" 
  +	    value="${watchdog.src}/../build/watchdog"/>
   
   
     <!-- External packages we depend on -->
  @@ -28,6 +32,8 @@
   
     <!-- ==================== Initialization - guessing config ========== -->
     <target name="init">
  +    <available file="${watchdog.src}/build.xml" 
  +	       property="watchdog.available" />
     </target>
   
     <!-- ==================== Copy static files ==================== -->
  @@ -71,6 +77,72 @@
   	 basedir="${tomcat.build}/webapps/test" includes="**"/> 
     </target>
   
  +  <target name="watchdog" if="watchdog.available" depends="init"> 
  +    <echo message="Building watchdog from ${watchdog.src} " />
  +    <!-- special arangements to allow running watchdog from web -->
  +    
  +    <mkdir dir="${tomcat.build}/webapps/servlet-tests"/>
  +    <mkdir dir="${tomcat.build}/webapps/jsp-tests"/>
  +
  +    <copy todir="${tomcat.build}/webapps/jsp-tests" >
  +      <fileset dir="${watchdog.src}/src/server/jsp-tests" />
  +    </copy>
  +    <copy todir="${tomcat.build}/webapps/jsp-tests/Golden" >
  +    <fileset dir="${watchdog.src}/src/clients/org/apache/jcheck/jsp/client" />
  +    </copy>
  +    <copy todir="${tomcat.build}/webapps/servlet-tests" >
  +      <fileset dir="${watchdog.src}/src/server/servlet-tests" />
  +    </copy>
  +
  +    <copyfile src="${watchdog.build}/conf/jsp-gtest.xml"
  +	      dest="${tomcat.build}/webapps/jsp-tests/WEB-INF/jsp-gtest.xml"/>
  +    <copyfile src="${watchdog.build}/conf/servlet-moo.xml"
  +  dest="${tomcat.build}/webapps/servlet-tests/WEB-INF/servlet-moo.xml"/>
  +
  +    <javac 
  +	   srcdir="${tomcat.build}/webapps/jsp-tests/WEB-INF/classes" 
  +	   optimize="${optimize}" 
  +	   destdir="${tomcat.build}/webapps/jsp-tests/WEB-INF/classes" 
  +	   classpath="${tomcat.build}/classes;${servlet22.jar}"
  +	   />
  +
  +    <!-- Watchdog requires a special client application -->
  +    <javac 
  +	   srcdir="${watchdog.src}/../jakarta-tools/moo/src/share"
  +	   optimize="${optimize}" 
  +	   destdir="${tomcat.build}/webapps/admin/WEB-INF/classes" 
  +	   classpath="${tomcat.build}/classes;${servlet22.jar}"
  +	   />
  +    <javac 
  +	   srcdir="${watchdog.src}/../jakarta-tools/moo/src/share"
  +	   optimize="${optimize}" 
  +	   destdir="${tomcat.build}/webapps/servlet-tests/WEB-INF/classes" 
  +	   classpath="${tomcat.build}/classes;${servlet22.jar}"
  +	   />
  +    <javac 
  +	   srcdir="${watchdog.src}/src/clients"
  +	   optimize="${optimize}" 
  +	   destdir="${tomcat.build}/webapps/admin/WEB-INF/classes" 
  +	   classpath="${tomcat.build}/classes;${servlet22.jar}"
  +	   />
  +    <copydir src="${watchdog.src}/src/clients"
  +	     dest="${tomcat.build}/webapps/admin/WEB-INF/classes" >
  +      <include name="**/**.properties" />
  +    </copydir>
  +
  +    <javac 
  +	   srcdir="${tomcat.build}/webapps/servlet-tests/WEB-INF/classes" 
  +	   optimize="${optimize}" 
  +	   destdir="${tomcat.build}/webapps/servlet-tests/WEB-INF/classes" 
  +	   classpath="${tomcat.build}/classes;${servlet22.jar}"
  +	   />
  +
  +    <replace file="${tomcat.build}/webapps/jsp-tests/WEB-INF/jsp-gtest.xml" 
  +	     token="org.apache.tomcat.task.GTest" 
  +	     value="org.apache.tomcat.util.test.GTest" />
  +
  +  </target>
  +
     <!-- ==================== Admin & agreagate ==================== -->
      
     <target name="clean-classes" depends="init">
  @@ -83,6 +155,6 @@
     </target>
     
     <target name="all" depends=""/>
  -  <target name="main" depends=""/>
  +  <target name="main" depends="sanity-test"/>
       
   </project>