OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <fcntl.h> | 5 #include <fcntl.h> |
6 | 6 |
7 #include <gtest/gtest.h> | 7 #include <gtest/gtest.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
334 | 334 |
335 void KernelProxyFuseTest::TearDown() { | 335 void KernelProxyFuseTest::TearDown() { |
336 nacl_io_unregister_fs_type("flatfs"); | 336 nacl_io_unregister_fs_type("flatfs"); |
337 ki_uninit(); | 337 ki_uninit(); |
338 } | 338 } |
339 | 339 |
340 } // namespace | 340 } // namespace |
341 | 341 |
342 TEST_F(KernelProxyFuseTest, Basic) { | 342 TEST_F(KernelProxyFuseTest, Basic) { |
343 // Write a file. | 343 // Write a file. |
344 int fd = ki_open("/hello", O_WRONLY | O_CREAT); | 344 int fd = ki_open("/hello", O_WRONLY | O_CREAT, 0777); |
345 ASSERT_GT(fd, -1); | 345 ASSERT_GT(fd, -1); |
346 ASSERT_EQ(sizeof(hello_world), | 346 ASSERT_EQ(sizeof(hello_world), |
347 ki_write(fd, hello_world, sizeof(hello_world))); | 347 ki_write(fd, hello_world, sizeof(hello_world))); |
348 EXPECT_EQ(0, ki_close(fd)); | 348 EXPECT_EQ(0, ki_close(fd)); |
349 | 349 |
350 // Then read it back in. | 350 // Then read it back in. |
351 fd = ki_open("/hello", O_RDONLY); | 351 fd = ki_open("/hello", O_RDONLY, 0777); |
binji
2014/09/11 23:51:41
0 instead of 0777?
bradn
2014/09/12 06:17:03
Done.
| |
352 ASSERT_GT(fd, -1); | 352 ASSERT_GT(fd, -1); |
353 | 353 |
354 char buffer[30]; | 354 char buffer[30]; |
355 memset(buffer, 0, sizeof(buffer)); | 355 memset(buffer, 0, sizeof(buffer)); |
356 ASSERT_EQ(sizeof(hello_world), ki_read(fd, buffer, sizeof(buffer))); | 356 ASSERT_EQ(sizeof(hello_world), ki_read(fd, buffer, sizeof(buffer))); |
357 EXPECT_STREQ(hello_world, buffer); | 357 EXPECT_STREQ(hello_world, buffer); |
358 EXPECT_EQ(0, ki_close(fd)); | 358 EXPECT_EQ(0, ki_close(fd)); |
359 } | 359 } |
OLD | NEW |