You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by si...@apache.org on 2018/05/18 17:38:55 UTC
[1/3] lucene-solr:branch_7x: LUCENE-8320: Disable test on windows
Repository: lucene-solr
Updated Branches:
refs/heads/branch_7x ba7a666dc -> 59f2b7aec
LUCENE-8320: Disable test on windows
irony: currently we don't emulate windows well enough to work on windows!
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/8dee2458
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/8dee2458
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/8dee2458
Branch: refs/heads/branch_7x
Commit: 8dee2458b7ce44b61e02c128410c30a750c5659d
Parents: ba7a666
Author: Simon Willnauer <si...@apache.org>
Authored: Fri May 18 19:24:04 2018 +0200
Committer: Simon Willnauer <si...@apache.org>
Committed: Fri May 18 19:26:05 2018 +0200
----------------------------------------------------------------------
.../org/apache/lucene/store/TestHardLinkCopyDirectoryWrapper.java | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8dee2458/lucene/misc/src/test/org/apache/lucene/store/TestHardLinkCopyDirectoryWrapper.java
----------------------------------------------------------------------
diff --git a/lucene/misc/src/test/org/apache/lucene/store/TestHardLinkCopyDirectoryWrapper.java b/lucene/misc/src/test/org/apache/lucene/store/TestHardLinkCopyDirectoryWrapper.java
index 0cce132..a6392c9 100644
--- a/lucene/misc/src/test/org/apache/lucene/store/TestHardLinkCopyDirectoryWrapper.java
+++ b/lucene/misc/src/test/org/apache/lucene/store/TestHardLinkCopyDirectoryWrapper.java
@@ -28,6 +28,7 @@ import java.util.Collections;
import org.apache.lucene.codecs.CodecUtil;
import org.apache.lucene.mockfile.FilterPath;
import org.apache.lucene.mockfile.WindowsFS;
+import org.apache.lucene.util.Constants;
import org.apache.lucene.util.IOUtils;
// See: https://issues.apache.org/jira/browse/SOLR-12028 Tests cannot remove files on Windows machines occasionally
@@ -93,6 +94,8 @@ public class TestHardLinkCopyDirectoryWrapper extends BaseDirectoryTestCase {
}
public void testRenameWithHardLink() throws Exception {
+ // irony: currently we don't emulate windows well enough to work on windows!
+ assumeFalse("windows is not supported", Constants.WINDOWS);
Path path = createTempDir();
FileSystem fs = new WindowsFS(path.getFileSystem()).getFileSystem(URI.create("file:///"));
Directory dir1 = new SimpleFSDirectory(new FilterPath(path, fs));
[3/3] lucene-solr:branch_7x: Disable WindowsFS dependent tests in
TestSimpleFSDirectory on Windows
Posted by si...@apache.org.
Disable WindowsFS dependent tests in TestSimpleFSDirectory on Windows
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/59f2b7ae
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/59f2b7ae
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/59f2b7ae
Branch: refs/heads/branch_7x
Commit: 59f2b7aec2fb1beed63772eda197c2247091c975
Parents: af17037
Author: Simon Willnauer <si...@apache.org>
Authored: Fri May 18 19:36:16 2018 +0200
Committer: Simon Willnauer <si...@apache.org>
Committed: Fri May 18 19:38:46 2018 +0200
----------------------------------------------------------------------
.../src/test/org/apache/lucene/store/TestSimpleFSDirectory.java | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/59f2b7ae/lucene/core/src/test/org/apache/lucene/store/TestSimpleFSDirectory.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/store/TestSimpleFSDirectory.java b/lucene/core/src/test/org/apache/lucene/store/TestSimpleFSDirectory.java
index e550bcc..15a26a0 100644
--- a/lucene/core/src/test/org/apache/lucene/store/TestSimpleFSDirectory.java
+++ b/lucene/core/src/test/org/apache/lucene/store/TestSimpleFSDirectory.java
@@ -24,6 +24,7 @@ import java.nio.file.Path;
import org.apache.lucene.mockfile.FilterPath;
import org.apache.lucene.mockfile.WindowsFS;
+import org.apache.lucene.util.Constants;
import org.apache.lucene.util.IOUtils;
/**
@@ -38,6 +39,8 @@ public class TestSimpleFSDirectory extends BaseDirectoryTestCase {
public void testRenameWithPendingDeletes() throws IOException {
Path path = createTempDir();
+ // irony: currently we don't emulate windows well enough to work on windows!
+ assumeFalse("windows is not supported", Constants.WINDOWS);
// Use WindowsFS to prevent open files from being deleted:
FileSystem fs = new WindowsFS(path.getFileSystem()).getFileSystem(URI.create("file:///"));
Path root = new FilterPath(path, fs);
@@ -60,6 +63,8 @@ public class TestSimpleFSDirectory extends BaseDirectoryTestCase {
}
public void testCreateOutputWithPendingDeletes() throws IOException {
+ // irony: currently we don't emulate windows well enough to work on windows!
+ assumeFalse("windows is not supported", Constants.WINDOWS);
Path path = createTempDir();
// Use WindowsFS to prevent open files from being deleted:
FileSystem fs = new WindowsFS(path.getFileSystem()).getFileSystem(URI.create("file:///"));
[2/3] lucene-solr:branch_7x: LUCENE-8320: Fix NPE in WindowsFS if
target file exists but isn't open
Posted by si...@apache.org.
LUCENE-8320: Fix NPE in WindowsFS if target file exists but isn't open
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/af17037b
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/af17037b
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/af17037b
Branch: refs/heads/branch_7x
Commit: af17037bf0995695bc350fa0697e6029457cb8ee
Parents: 8dee245
Author: Simon Willnauer <si...@apache.org>
Authored: Fri May 18 19:24:45 2018 +0200
Committer: Simon Willnauer <si...@apache.org>
Committed: Fri May 18 19:26:48 2018 +0200
----------------------------------------------------------------------
.../org/apache/lucene/mockfile/WindowsFS.java | 18 +++++++-------
.../apache/lucene/mockfile/TestWindowsFS.java | 25 ++++++++++++++++++--
2 files changed, 33 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af17037b/lucene/test-framework/src/java/org/apache/lucene/mockfile/WindowsFS.java
----------------------------------------------------------------------
diff --git a/lucene/test-framework/src/java/org/apache/lucene/mockfile/WindowsFS.java b/lucene/test-framework/src/java/org/apache/lucene/mockfile/WindowsFS.java
index ecf73b6..28ca368 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/mockfile/WindowsFS.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/mockfile/WindowsFS.java
@@ -138,14 +138,16 @@ public class WindowsFS extends HandleTrackingFS {
// return a different i-node next time we call it with the target path and our onClose method will
// trip an assert
Map<Path, Integer> map = openFiles.get(key);
- Integer v = map.remove(target);
- if (v != null) {
- Map<Path, Integer> pathIntegerMap = openFiles.computeIfAbsent(newKey, k -> new HashMap<>());
- Integer existingValue = pathIntegerMap.getOrDefault(target, 0);
- pathIntegerMap.put(target, existingValue + v);
- }
- if (map.isEmpty()) {
- openFiles.remove(key);
+ if (map != null) {
+ Integer v = map.remove(target);
+ if (v != null) {
+ Map<Path, Integer> pathIntegerMap = openFiles.computeIfAbsent(newKey, k -> new HashMap<>());
+ Integer existingValue = pathIntegerMap.getOrDefault(target, 0);
+ pathIntegerMap.put(target, existingValue + v);
+ }
+ if (map.isEmpty()) {
+ openFiles.remove(key);
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af17037b/lucene/test-framework/src/test/org/apache/lucene/mockfile/TestWindowsFS.java
----------------------------------------------------------------------
diff --git a/lucene/test-framework/src/test/org/apache/lucene/mockfile/TestWindowsFS.java b/lucene/test-framework/src/test/org/apache/lucene/mockfile/TestWindowsFS.java
index 5e0a687..dd6c35c 100644
--- a/lucene/test-framework/src/test/org/apache/lucene/mockfile/TestWindowsFS.java
+++ b/lucene/test-framework/src/test/org/apache/lucene/mockfile/TestWindowsFS.java
@@ -31,8 +31,6 @@ import java.nio.file.StandardCopyOption;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.atomic.AtomicBoolean;
-import org.apache.lucene.mockfile.FilterPath;
-import org.apache.lucene.mockfile.WindowsFS;
import org.apache.lucene.util.Constants;
/** Basic tests for WindowsFS */
@@ -155,4 +153,27 @@ public class TestWindowsFS extends MockFileSystemTestCase {
t.join();
}
}
+
+ public void testMove() throws IOException {
+ Path dir = wrap(createTempDir());
+ OutputStream file = Files.newOutputStream(dir.resolve("file"));
+ file.write(1);
+ file.close();
+ Files.move(dir.resolve("file"), dir.resolve("target"));
+ assertTrue(Files.exists(dir.resolve("target")));
+ assertFalse(Files.exists(dir.resolve("file")));
+ try (InputStream stream = Files.newInputStream(dir.resolve("target"))) {
+ assertEquals(1, stream.read());
+ }
+ file = Files.newOutputStream(dir.resolve("otherFile"));
+ file.write(2);
+ file.close();
+
+ Files.move(dir.resolve("otherFile"), dir.resolve("target"), StandardCopyOption.REPLACE_EXISTING);
+ assertTrue(Files.exists(dir.resolve("target")));
+ assertFalse(Files.exists(dir.resolve("otherFile")));
+ try (InputStream stream = Files.newInputStream(dir.resolve("target"))) {
+ assertEquals(2, stream.read());
+ }
+ }
}