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/11 01:09:03 UTC
[lucy-commits] svn commit: r1134472 - in /incubator/lucy/trunk/core/Lucy:
Store/FSFileHandle.c Test/Store/TestFSFileHandle.c
Author: marvin
Date: Fri Jun 10 23:09:02 2011
New Revision: 1134472
URL: http://svn.apache.org/viewvc?rev=1134472&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/trunk/core/Lucy/Store/FSFileHandle.c
incubator/lucy/trunk/core/Lucy/Test/Store/TestFSFileHandle.c
Modified: incubator/lucy/trunk/core/Lucy/Store/FSFileHandle.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Store/FSFileHandle.c?rev=1134472&r1=1134471&r2=1134472&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Store/FSFileHandle.c (original)
+++ incubator/lucy/trunk/core/Lucy/Store/FSFileHandle.c Fri Jun 10 23:09:02 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/trunk/core/Lucy/Test/Store/TestFSFileHandle.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Test/Store/TestFSFileHandle.c?rev=1134472&r1=1134471&r2=1134472&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Test/Store/TestFSFileHandle.c (original)
+++ incubator/lucy/trunk/core/Lucy/Test/Store/TestFSFileHandle.c Fri Jun 10 23:09:02 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);