OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // The linux/mac host build of nacl_io can't do wrapping of syscalls so all | 5 // The linux/mac host build of nacl_io can't do wrapping of syscalls so all |
6 // these tests must be disabled. | 6 // these tests must be disabled. |
7 #if !defined(__linux__) && !defined(__APPLE__) | 7 #if !defined(__linux__) && !defined(__APPLE__) |
8 | 8 |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 | 10 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Initialize the global errno value to a consistent value rather than | 143 // Initialize the global errno value to a consistent value rather than |
144 // relying on its value from previous test runs. | 144 // relying on its value from previous test runs. |
145 errno = 0; | 145 errno = 0; |
146 | 146 |
147 // Initializing the KernelProxy opens stdin/stdout/stderr. | 147 // Initializing the KernelProxy opens stdin/stdout/stderr. |
148 EXPECT_CALL(mock, open(_, _, _)) | 148 EXPECT_CALL(mock, open(_, _, _)) |
149 .WillOnce(Return(0)) | 149 .WillOnce(Return(0)) |
150 .WillOnce(Return(1)) | 150 .WillOnce(Return(1)) |
151 .WillOnce(Return(2)); | 151 .WillOnce(Return(2)); |
152 | 152 |
| 153 // ki_init calls mkdir to create /dev directory |
| 154 EXPECT_CALL(mock, mkdir(_, _)) |
| 155 .WillOnce(Return(0)); |
| 156 |
153 ASSERT_EQ(0, ki_push_state_for_testing()); | 157 ASSERT_EQ(0, ki_push_state_for_testing()); |
154 ASSERT_EQ(0, ki_init(&mock)); | 158 ASSERT_EQ(0, ki_init(&mock)); |
155 | 159 |
156 // We allow write to be called any number of times, and it forwards to | 160 // We allow write to be called any number of times, and it forwards to |
157 // _real_write. This prevents an infinite loop writing output if there is a | 161 // _real_write. This prevents an infinite loop writing output if there is a |
158 // failure. | 162 // failure. |
159 ON_CALL(mock, write(_, _, _)) | 163 ON_CALL(mock, write(_, _, _)) |
160 .WillByDefault(Invoke(this, &KernelWrapTest::DefaultWrite)); | 164 .WillByDefault(Invoke(this, &KernelWrapTest::DefaultWrite)); |
161 EXPECT_CALL(mock, write(_, _, _)).Times(AnyNumber()); | 165 EXPECT_CALL(mock, write(_, _, _)).Times(AnyNumber()); |
162 | 166 |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 .WillOnce(Return(0)) | 930 .WillOnce(Return(0)) |
927 .WillOnce(DoAll(SetErrno(kDummyErrno), Return(-1))); | 931 .WillOnce(DoAll(SetErrno(kDummyErrno), Return(-1))); |
928 EXPECT_EQ(0, socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val)); | 932 EXPECT_EQ(0, socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val)); |
929 EXPECT_EQ(-1, socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val)); | 933 EXPECT_EQ(-1, socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val)); |
930 EXPECT_EQ(kDummyErrno, errno); | 934 EXPECT_EQ(kDummyErrno, errno); |
931 } | 935 } |
932 | 936 |
933 #endif // PROVIDES_SOCKET_API | 937 #endif // PROVIDES_SOCKET_API |
934 | 938 |
935 #endif // __linux__ | 939 #endif // __linux__ |
OLD | NEW |