aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2016-07-08 13:53:38 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2016-07-08 13:53:38 +0000
commit4ba91508d00bcbc4c7847b6ba23e68944c8a328c (patch)
tree77234610f59393e08bfdfe7ff79291ed92cedb94 /searchlib
parent5f3b515c6d92f979f0b7afa946d550aade5478e4 (diff)
Must forward to end of file before writing.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/tests/datastore/logdatastore_test.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/searchlib/src/tests/datastore/logdatastore_test.cpp b/searchlib/src/tests/datastore/logdatastore_test.cpp
index 9f92b0ad920..f31f6cdc413 100644
--- a/searchlib/src/tests/datastore/logdatastore_test.cpp
+++ b/searchlib/src/tests/datastore/logdatastore_test.cpp
@@ -179,11 +179,16 @@ TEST("test that DirectIOPadding works accordng to spec") {
FastOS_File file2("directio.test");
file2.EnableDirectIO();
EXPECT_TRUE(file2.OpenWriteOnlyExisting(true));
+ EXPECT_TRUE(file2.SetPosition(file2.GetSize()));
EXPECT_EQUAL(FILE_SIZE, file2.GetSize());
EXPECT_EQUAL(FILE_SIZE, file2.Write2(buf.get(), FILE_SIZE));
- EXPECT_EQUAL(FILE_SIZE, file2.GetSize());
+ EXPECT_EQUAL(FILE_SIZE*2, file2.GetSize());
EXPECT_TRUE(file2.Close());
+ EXPECT_TRUE(file.DirectIOPadding(4097, 4096, padBefore, padAfter));
+ EXPECT_EQUAL(1u, padBefore);
+ EXPECT_EQUAL(4095u, padAfter);
+
EXPECT_TRUE(file.DirectIOPadding(FILE_SIZE-1, 4096, padBefore, padAfter));
EXPECT_EQUAL(4095u, padBefore);
EXPECT_EQUAL(1u, padAfter);