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 ni...@apache.org on 2007/10/12 04:46:19 UTC

svn commit: r584031 - in /lucene/hadoop/trunk: CHANGES.txt src/test/org/apache/hadoop/fs/TestLocalDirAllocator.java

Author: nigel
Date: Thu Oct 11 19:46:18 2007
New Revision: 584031

URL: http://svn.apache.org/viewvc?rev=584031&view=rev
Log:
HADOOP-2023. Disable TestLocalDirAllocator on Windows.  Contributed by Hairong.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/test/org/apache/hadoop/fs/TestLocalDirAllocator.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?rev=584031&r1=584030&r2=584031&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Thu Oct 11 19:46:18 2007
@@ -281,6 +281,9 @@
     a response from the target datanode before closing the data stream.
     (Hairong Kuang via dhruba)
                                 
+    HADOOP-2023. Disable TestLocalDirAllocator on Windows.
+    (Hairong Kuang via nigel)
+
   IMPROVEMENTS
 
     HADOOP-1908. Restructure data node code so that block sending and 

Modified: lucene/hadoop/trunk/src/test/org/apache/hadoop/fs/TestLocalDirAllocator.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/test/org/apache/hadoop/fs/TestLocalDirAllocator.java?rev=584031&r1=584030&r2=584031&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/test/org/apache/hadoop/fs/TestLocalDirAllocator.java (original)
+++ lucene/hadoop/trunk/src/test/org/apache/hadoop/fs/TestLocalDirAllocator.java Thu Oct 11 19:46:18 2007
@@ -26,7 +26,11 @@
 
 /** This test LocalDirAllocator works correctly;
  * Every test case uses different buffer dirs to 
- * enforce the AllocatorPerContext initialization*/ 
+ * enforce the AllocatorPerContext initialization.
+ * This test does not run on Cygwin because under Cygwin
+ * a directory can be created in a read-only directory
+ * which breaks this test.
+ */ 
 public class TestLocalDirAllocator extends TestCase {
   final static private Configuration conf = new Configuration();
   final static private String BUFFER_DIR_ROOT = "build/test/temp";
@@ -43,8 +47,8 @@
   final static private LocalDirAllocator dirAllocator = 
     new LocalDirAllocator(CONTEXT);
   static LocalFileSystem localFs;
-  
-  /** constructor */
+  final static private boolean isWindows =
+    System.getProperty("os.name").startsWith("Windows");
   
   static {
     try {
@@ -64,7 +68,8 @@
   
   private void validateTempDirCreation(int i) throws IOException {
     File result = createTempFile();
-    assertTrue(result.getPath().startsWith(BUFFER_DIR[i]+"/"+FILENAME));
+    assertTrue(result.getPath().startsWith(
+        new File(BUFFER_DIR[i], FILENAME).getPath()));
   }
   
   private File createTempFile() throws IOException {
@@ -77,6 +82,7 @@
    * @throws Exception
    */
   public void test0() throws Exception {
+    if (isWindows) return;
     try {
       conf.set(CONTEXT, BUFFER_DIR[0]+","+BUFFER_DIR[1]);
       assertTrue(localFs.mkdirs(BUFFER_PATH[1]));
@@ -94,6 +100,7 @@
    * @throws Exception
    */
   public void test1() throws Exception {
+    if (isWindows) return;
     try {
       conf.set(CONTEXT, BUFFER_DIR[1]+","+BUFFER_DIR[2]);
       assertTrue(localFs.mkdirs(BUFFER_PATH[2]));
@@ -109,6 +116,7 @@
    * Check if tmp dirs are allocated in a round-robin 
    */
   public void test2() throws Exception {
+    if (isWindows) return;
     try {
       conf.set(CONTEXT, BUFFER_DIR[2]+","+BUFFER_DIR[3]);
       validateTempDirCreation(2);
@@ -125,6 +133,7 @@
    * @throws Exception
    */
   public void test3() throws Exception {
+    if (isWindows) return;
     try {
       conf.set(CONTEXT, BUFFER_DIR[3]+","+BUFFER_DIR[4]);
       assertTrue(localFs.mkdirs(BUFFER_PATH[3]));