| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <errno.h> | 5 #include <errno.h> |
| 6 #include <fcntl.h> | 6 #include <fcntl.h> |
| 7 #include <pthread.h> | 7 #include <pthread.h> |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 | 551 |
| 552 TEST_F(KernelProxyTest, OpenWithMode) { | 552 TEST_F(KernelProxyTest, OpenWithMode) { |
| 553 int fd = ki_open("/foo", O_CREAT | O_RDWR, 0723); | 553 int fd = ki_open("/foo", O_CREAT | O_RDWR, 0723); |
| 554 ASSERT_GT(fd, -1); | 554 ASSERT_GT(fd, -1); |
| 555 | 555 |
| 556 struct stat buf; | 556 struct stat buf; |
| 557 EXPECT_EQ(0, ki_lstat("/foo", &buf)); | 557 EXPECT_EQ(0, ki_lstat("/foo", &buf)); |
| 558 EXPECT_EQ(0723, buf.st_mode & ~S_IFMT); | 558 EXPECT_EQ(0723, buf.st_mode & ~S_IFMT); |
| 559 } | 559 } |
| 560 | 560 |
| 561 TEST_F(KernelProxyTest, CreateWronlyWithReadOnlyMode) { |
| 562 int fd = ki_open("/foo", O_CREAT | O_WRONLY, 0444); |
| 563 ASSERT_GT(fd, -1); |
| 564 } |
| 565 |
| 561 TEST_F(KernelProxyTest, UseAfterClose) { | 566 TEST_F(KernelProxyTest, UseAfterClose) { |
| 562 int fd = ki_open("/dummy", O_CREAT | O_WRONLY, 0777); | 567 int fd = ki_open("/dummy", O_CREAT | O_WRONLY, 0777); |
| 563 ASSERT_GT(fd, -1); | 568 ASSERT_GT(fd, -1); |
| 564 EXPECT_EQ(5, ki_write(fd, "hello", 5)); | 569 EXPECT_EQ(5, ki_write(fd, "hello", 5)); |
| 565 EXPECT_EQ(0, ki_close(fd)); | 570 EXPECT_EQ(0, ki_close(fd)); |
| 566 EXPECT_EQ(-1, ki_write(fd, "hello", 5)); | 571 EXPECT_EQ(-1, ki_write(fd, "hello", 5)); |
| 567 EXPECT_EQ(EBADF, errno); | 572 EXPECT_EQ(EBADF, errno); |
| 568 } | 573 } |
| 569 | 574 |
| 570 TEST_F(KernelProxyTest, Utimes) { | 575 TEST_F(KernelProxyTest, Utimes) { |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 | 960 |
| 956 int fd = ki_open("/dummy", O_RDONLY, 0); | 961 int fd = ki_open("/dummy", O_RDONLY, 0); |
| 957 EXPECT_NE(0, fd); | 962 EXPECT_NE(0, fd); |
| 958 | 963 |
| 959 char buf[20]; | 964 char buf[20]; |
| 960 EXPECT_EQ(-1, ki_read(fd, &buf[0], 20)); | 965 EXPECT_EQ(-1, ki_read(fd, &buf[0], 20)); |
| 961 // The Filesystem should be able to return whatever error it wants and have it | 966 // The Filesystem should be able to return whatever error it wants and have it |
| 962 // propagate through. | 967 // propagate through. |
| 963 EXPECT_EQ(1234, errno); | 968 EXPECT_EQ(1234, errno); |
| 964 } | 969 } |
| OLD | NEW |