You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by cu...@apache.org on 2006/03/13 21:30:36 UTC

svn commit: r385652 - in /lucene/hadoop/trunk: build.xml src/test/hadoop-site.xml src/test/mapred-default.xml src/test/org/apache/hadoop/dfs/ClusterTestDFS.java src/test/org/apache/hadoop/dfs/TestDFS.java

Author: cutting
Date: Mon Mar 13 12:30:34 2006
New Revision: 385652

URL: http://svn.apache.org/viewcvs?rev=385652&view=rev
Log:
Fix for HADOOP-70.  Unit tests should have their own hadoop-site.xml and mapred-default.xml, so that local modifications to these files in conf/ don't alter unit testing.  Also rename TestDFS so that it is not normally run, and add a new test target which runs tests using the config files in conf/.

Added:
    lucene/hadoop/trunk/src/test/hadoop-site.xml
    lucene/hadoop/trunk/src/test/mapred-default.xml
    lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFS.java
      - copied, changed from r385629, lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFS.java
Removed:
    lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFS.java
Modified:
    lucene/hadoop/trunk/build.xml

Modified: lucene/hadoop/trunk/build.xml
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/build.xml?rev=385652&r1=385651&r2=385652&view=diff
==============================================================================
--- lucene/hadoop/trunk/build.xml (original)
+++ lucene/hadoop/trunk/build.xml Mon Mar 13 12:30:34 2006
@@ -34,6 +34,8 @@
   <property name="test.build.data" value="${test.build.dir}/data"/>
   <property name="test.build.classes" value="${test.build.dir}/classes"/>
   <property name="test.build.javadoc" value="${test.build.dir}/docs/api"/>
+  <property name="test.include" value="Test*"/>
+  <property name="test.classpath.id" value="test.classpath"/>
 
   <property name="web.src.dir" value="${basedir}/src/web"/>
   <property name="src.webapps" value="${basedir}/src/webapps"/>
@@ -55,16 +57,23 @@
     <fileset dir="${lib.dir}">
       <include name="**/*.jar" />
     </fileset>
+    <pathelement location="${conf.dir}"/>
   </path>
 
-  <!-- the unit test classpath -->
+  <!-- the unit test classpath: uses test.src.dir for configuration -->
   <path id="test.classpath">
     <pathelement location="${test.build.classes}" />
-    <pathelement location="${conf.dir}"/>
     <pathelement location="${test.src.dir}"/>
     <path refid="classpath"/>
   </path>
 
+  <!-- the cluster test classpath: uses conf.dir for configuration -->
+  <path id="test.cluster.classpath">
+    <path refid="classpath"/>
+    <pathelement location="${test.build.classes}" />
+    <pathelement location="${test.src.dir}"/>
+  </path>
+
   <!-- ====================================================== -->
   <!-- Stuff needed by all targets                            -->
   <!-- ====================================================== -->
@@ -200,11 +209,12 @@
       errorProperty="tests.failed" failureProperty="tests.failed">
       <sysproperty key="test.build.data" value="${test.build.data}"/>
       <sysproperty key="test.src.dir" value="${test.src.dir}"/>
-      <classpath refid="test.classpath"/>
+      <classpath refid="${test.classpath.id}"/>
       <formatter type="plain" />
       <batchtest todir="${test.build.dir}" unless="testcase">
         <fileset dir="${test.src.dir}"
-                 includes="**/Test*.java" excludes="**/${test.exclude}.java" />
+	         includes="**/${test.include}.java"
+		 excludes="**/${test.exclude}.java" />
       </batchtest>
       <batchtest todir="${test.build.dir}" if="testcase">
         <fileset dir="${test.src.dir}" includes="**/${testcase}.java"/>
@@ -214,6 +224,14 @@
     <fail if="tests.failed">Tests failed!</fail>
 
   </target>   
+
+  <!-- Run all unit tests, not just Test*, and use non-test configuration. -->
+  <target name="test-cluster">
+    <antcall target="test">
+      <param name="test.include" value="*"/>
+      <param name="test.classpath.id" value="test.cluster.classpath"/>
+    </antcall>
+  </target>
 
   <target name="nightly" depends="test, tar">
   </target>

Added: lucene/hadoop/trunk/src/test/hadoop-site.xml
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/test/hadoop-site.xml?rev=385652&view=auto
==============================================================================
--- lucene/hadoop/trunk/src/test/hadoop-site.xml (added)
+++ lucene/hadoop/trunk/src/test/hadoop-site.xml Mon Mar 13 12:30:34 2006
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="nutch-conf.xsl"?>
+
+<!-- Values used when running unit tests.  This is mostly empty, to -->
+<!-- use of the default values, overriding the potentially -->
+<!-- user-editted hadoop-site.xml in the conf/ directory.  -->
+
+<configuration>
+
+</configuration>

Added: lucene/hadoop/trunk/src/test/mapred-default.xml
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/test/mapred-default.xml?rev=385652&view=auto
==============================================================================
--- lucene/hadoop/trunk/src/test/mapred-default.xml (added)
+++ lucene/hadoop/trunk/src/test/mapred-default.xml Mon Mar 13 12:30:34 2006
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="nutch-conf.xsl"?>
+
+<!-- Values used when running unit tests.  This is mostly empty, to -->
+<!-- use of the default values, overriding the potentially -->
+<!-- user-editted mapred-default.xml in the conf/ directory.  -->
+
+<configuration>
+
+</configuration>

Copied: lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFS.java (from r385629, lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFS.java)
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFS.java?p2=lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFS.java&p1=lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFS.java&r1=385629&r2=385652&rev=385652&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFS.java (original)
+++ lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFS.java Mon Mar 13 12:30:34 2006
@@ -37,7 +37,7 @@
 
 /**
  * Test DFS.
- * TestDFS is a JUnit test for DFS using "pseudo multiprocessing" (or 
+ * ClusterTestDFS is a JUnit test for DFS using "pseudo multiprocessing" (or 
  more strictly, pseudo distributed) meaning all daemons run in one process 
  and sockets are used to communicate between daemons.  The test permutes
  * various block sizes, number of files, file sizes, and number of
@@ -68,9 +68,9 @@
  * (HadoopFS level) test {@link org.apache.hadoop.fs.TestFileSystem}.
  * @author Paul Baclace
  */
-public class TestDFS extends TestCase implements FSConstants {
+public class ClusterTestDFS extends TestCase implements FSConstants {
   private static final Logger LOG =
-      LogFormatter.getLogger("org.apache.hadoop.dfs.TestDFS");
+      LogFormatter.getLogger("org.apache.hadoop.dfs.ClusterTestDFS");
 
   private static Configuration conf = new Configuration();
   private static int BUFFER_SIZE =
@@ -518,12 +518,12 @@
   }
 
   public static void main(String[] args) throws Exception {
-    String usage = "Usage: TestDFS (no args)";
+    String usage = "Usage: ClusterTestDFS (no args)";
     if (args.length != 0) {
       System.err.println(usage);
       System.exit(-1);
     }
-    String[] testargs = {"org.apache.hadoop.dfs.TestDFS"};
+    String[] testargs = {"org.apache.hadoop.dfs.ClusterTestDFS"};
     junit.textui.TestRunner.main(testargs);
   }