You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/06/19 20:27:49 UTC

[lucy-commits] svn commit: r1137404 - in /incubator/lucy/branches/0.1: ./ core/Lucy/Store/FSFileHandle.c core/Lucy/Test/Store/TestFSFileHandle.c

Author: marvin
Date: Sun Jun 19 18:27:49 2011
New Revision: 1137404

URL: http://svn.apache.org/viewvc?rev=1137404&view=rev
Log:
LUCY-155 Disable FSFH Close() test on MSVC.

MSVC close() throws an exception when passed a negative file descriptor
instead of returning an error code.  Disable the test that simulates a bad
system close() using that technique.

Modified:
    incubator/lucy/branches/0.1/   (props changed)
    incubator/lucy/branches/0.1/core/Lucy/Store/FSFileHandle.c
    incubator/lucy/branches/0.1/core/Lucy/Test/Store/TestFSFileHandle.c

Propchange: incubator/lucy/branches/0.1/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Jun 19 18:27:49 2011
@@ -1 +1 @@
-/incubator/lucy/trunk:1134011,1134355
+/incubator/lucy/trunk:1134011,1134355,1134472

Modified: incubator/lucy/branches/0.1/core/Lucy/Store/FSFileHandle.c
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/0.1/core/Lucy/Store/FSFileHandle.c?rev=1137404&r1=1137403&r2=1137404&view=diff
==============================================================================
--- incubator/lucy/branches/0.1/core/Lucy/Store/FSFileHandle.c (original)
+++ incubator/lucy/branches/0.1/core/Lucy/Store/FSFileHandle.c Sun Jun 19 18:27:49 2011
@@ -161,7 +161,7 @@ FSFH_do_open(FSFileHandle *self, const C
 bool_t
 FSFH_close(FSFileHandle *self) {
     // On 64-bit systems, cancel the whole-file mapping.
-    if (IS_64_BIT && (self->flags & FH_READ_ONLY)) {
+    if (IS_64_BIT && (self->flags & FH_READ_ONLY) && self->buf != NULL) {
         if (!SI_unmap(self, self->buf, self->len)) { return false; }
         self->buf = NULL;
     }

Modified: incubator/lucy/branches/0.1/core/Lucy/Test/Store/TestFSFileHandle.c
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/0.1/core/Lucy/Test/Store/TestFSFileHandle.c?rev=1137404&r1=1137403&r2=1137404&view=diff
==============================================================================
--- incubator/lucy/branches/0.1/core/Lucy/Test/Store/TestFSFileHandle.c (original)
+++ incubator/lucy/branches/0.1/core/Lucy/Test/Store/TestFSFileHandle.c Sun Jun 19 18:27:49 2011
@@ -158,7 +158,6 @@ static void
 test_Close(TestBatch *batch) {
     CharBuf *test_filename = (CharBuf*)ZCB_WRAP_STR("_fstest", 7);
     FSFileHandle *fh;
-    bool_t result;
 
     remove((char*)CB_Get_Ptr8(test_filename));
     fh = FSFH_open(test_filename,
@@ -171,13 +170,19 @@ test_Close(TestBatch *batch) {
     remove((char*)CB_Get_Ptr8(test_filename));
     fh = FSFH_open(test_filename,
                    FH_CREATE | FH_WRITE_ONLY | FH_EXCLUSIVE);
-    close(fh->fd);
+#ifdef _MSC_VER
+    SKIP(batch, "LUCY-155");
+    SKIP(batch, "LUCY-155");
+#else
+    int saved_fd = fh->fd;
     fh->fd = -1;
     Err_set_error(NULL);
-    result = FSFH_Close(fh);
+    bool_t result = FSFH_Close(fh);
     TEST_FALSE(batch, result, "Failed Close() returns false");
     TEST_TRUE(batch, Err_get_error() != NULL,
               "Failed Close() sets Err_error");
+    fh->fd = saved_fd;
+#endif /* _MSC_VER */
     DECREF(fh);
 
     fh = FSFH_open(test_filename, FH_READ_ONLY);