Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Unified Diff: native_client_sdk/src/tests/nacl_io_test/fuse_fs_test.cc

Issue 549353003: [NaCl SDK] nacl_io: Fix FuseFs.{read,write} (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/tests/nacl_io_test/fuse_fs_test.cc
diff --git a/native_client_sdk/src/tests/nacl_io_test/fuse_fs_test.cc b/native_client_sdk/src/tests/nacl_io_test/fuse_fs_test.cc
index a75246d8f9d441fbbe0961b37a95a124ee82f312..962ca811921a7f60dbdc0529f17724f607c4cd51 100644
--- a/native_client_sdk/src/tests/nacl_io_test/fuse_fs_test.cc
+++ b/native_client_sdk/src/tests/nacl_io_test/fuse_fs_test.cc
@@ -222,9 +222,14 @@ TEST_F(FuseFsTest, OpenAndRead) {
int bytes_read = 0;
HandleAttr attr;
ASSERT_EQ(0, node->Read(attr, &buffer[0], sizeof(buffer), &bytes_read));
- // FUSE always fills the buffer (padding with \0) unless in direct_io mode.
- ASSERT_EQ(sizeof(buffer), bytes_read);
+ ASSERT_EQ(strlen(hello_world), bytes_read);
ASSERT_STREQ(hello_world, buffer);
+
+ // Try to read past the end of the file.
+ attr.offs = strlen(hello_world) - 7;
+ ASSERT_EQ(0, node->Read(attr, &buffer[0], sizeof(buffer), &bytes_read));
+ ASSERT_EQ(7, bytes_read);
+ ASSERT_STREQ("World!\n", buffer);
}
TEST_F(FuseFsTest, CreateAndWrite) {
@@ -241,8 +246,7 @@ TEST_F(FuseFsTest, CreateAndWrite) {
char buffer[40] = {0};
int bytes_read = 0;
ASSERT_EQ(0, node->Read(attr, &buffer[0], sizeof(buffer), &bytes_read));
- // FUSE always fills the buffer (padding with \0) unless in direct_io mode.
- ASSERT_EQ(sizeof(buffer), bytes_read);
+ ASSERT_EQ(strlen(message), bytes_read);
ASSERT_STREQ(message, buffer);
}
@@ -349,7 +353,7 @@ TEST_F(KernelProxyFuseTest, Basic) {
char buffer[30];
memset(buffer, 0, sizeof(buffer));
- ASSERT_EQ(sizeof(buffer), ki_read(fd, buffer, sizeof(buffer)));
+ ASSERT_EQ(sizeof(hello_world), ki_read(fd, buffer, sizeof(buffer)));
EXPECT_STREQ(hello_world, buffer);
EXPECT_EQ(0, ki_close(fd));
}
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698