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 host build of nacl_io can't do wrapping of syscalls so all | 5 // The linux 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__) | 7 #if !defined(__linux__) |
8 | 8 |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 | 10 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 char buffer[] = "ioctl"; | 289 char buffer[] = "ioctl"; |
290 EXPECT_CALL(mock, ioctl(kDummyInt, kDummyInt2, _)) | 290 EXPECT_CALL(mock, ioctl(kDummyInt, kDummyInt2, _)) |
291 .WillOnce(Return(kDummyInt3)); | 291 .WillOnce(Return(kDummyInt3)); |
292 EXPECT_EQ(kDummyInt3, ioctl(kDummyInt, kDummyInt2, buffer)); | 292 EXPECT_EQ(kDummyInt3, ioctl(kDummyInt, kDummyInt2, buffer)); |
293 } | 293 } |
294 | 294 |
295 #if !defined(__BIONIC__) | 295 #if !defined(__BIONIC__) |
296 TEST_F(KernelWrapTest, isatty) { | 296 TEST_F(KernelWrapTest, isatty) { |
297 EXPECT_CALL(mock, isatty(kDummyInt)).WillOnce(Return(kDummyInt2)); | 297 EXPECT_CALL(mock, isatty(kDummyInt)).WillOnce(Return(kDummyInt2)); |
298 EXPECT_EQ(kDummyInt2, isatty(kDummyInt)); | 298 EXPECT_EQ(kDummyInt2, isatty(kDummyInt)); |
| 299 |
| 300 // This test verifies that the IRT interception wrapper for isatty |
| 301 // ignores the value of errno when isatty() returns 1. We had a bug |
| 302 // where returning 1 from ki_isatty resulted in errno being returned |
| 303 // by the IRT interface. |
| 304 errno = kDummyInt3; |
| 305 EXPECT_CALL(mock, isatty(kDummyInt)).WillOnce(Return(1)); |
| 306 EXPECT_EQ(1, isatty(kDummyInt)); |
299 } | 307 } |
300 #endif | 308 #endif |
301 | 309 |
302 TEST_F(KernelWrapTest, kill) { | 310 TEST_F(KernelWrapTest, kill) { |
303 EXPECT_CALL(mock, kill(kDummyInt, kDummyInt2)).WillOnce(Return(kDummyInt3)); | 311 EXPECT_CALL(mock, kill(kDummyInt, kDummyInt2)).WillOnce(Return(kDummyInt3)); |
304 EXPECT_EQ(kDummyInt3, kill(kDummyInt, kDummyInt2)); | 312 EXPECT_EQ(kDummyInt3, kill(kDummyInt, kDummyInt2)); |
305 } | 313 } |
306 | 314 |
307 TEST_F(KernelWrapTest, lchown) { | 315 TEST_F(KernelWrapTest, lchown) { |
308 EXPECT_CALL(mock, lchown(kDummyConstChar, kDummyUid, kDummyGid)) | 316 EXPECT_CALL(mock, lchown(kDummyConstChar, kDummyUid, kDummyGid)) |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 int dummy_val; | 738 int dummy_val; |
731 EXPECT_CALL(mock, socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val)) | 739 EXPECT_CALL(mock, socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val)) |
732 .WillOnce(Return(kDummyInt4)); | 740 .WillOnce(Return(kDummyInt4)); |
733 EXPECT_EQ(kDummyInt4, | 741 EXPECT_EQ(kDummyInt4, |
734 socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val)); | 742 socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val)); |
735 } | 743 } |
736 | 744 |
737 #endif // PROVIDES_SOCKET_API | 745 #endif // PROVIDES_SOCKET_API |
738 | 746 |
739 #endif // __linux__ | 747 #endif // __linux__ |
OLD | NEW |