| 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 } | 523 } |
| 524 | 524 |
| 525 TEST_F(KernelWrapTest, truncate) { | 525 TEST_F(KernelWrapTest, truncate) { |
| 526 EXPECT_CALL(mock, truncate(kDummyConstChar, kDummyInt3)).WillOnce(Return(-1)); | 526 EXPECT_CALL(mock, truncate(kDummyConstChar, kDummyInt3)).WillOnce(Return(-1)); |
| 527 EXPECT_EQ(-1, truncate(kDummyConstChar, kDummyInt3)); | 527 EXPECT_EQ(-1, truncate(kDummyConstChar, kDummyInt3)); |
| 528 | 528 |
| 529 EXPECT_CALL(mock, truncate(kDummyConstChar, kDummyInt3)).WillOnce(Return(0)); | 529 EXPECT_CALL(mock, truncate(kDummyConstChar, kDummyInt3)).WillOnce(Return(0)); |
| 530 EXPECT_EQ(0, truncate(kDummyConstChar, kDummyInt3)); | 530 EXPECT_EQ(0, truncate(kDummyConstChar, kDummyInt3)); |
| 531 } | 531 } |
| 532 | 532 |
| 533 #ifndef __BIONIC__ | |
| 534 TEST_F(KernelWrapTest, lstat) { | 533 TEST_F(KernelWrapTest, lstat) { |
| 535 struct stat buf; | 534 struct stat in_statbuf; |
| 536 EXPECT_CALL(mock, lstat(kDummyConstChar, &buf)).WillOnce(Return(-1)); | 535 MakeDummyStatbuf(&in_statbuf); |
| 537 EXPECT_EQ(-1, lstat(kDummyConstChar, &buf)); | 536 EXPECT_CALL(mock, lstat(StrEq(kDummyConstChar), _)) |
| 538 | 537 .WillOnce(DoAll(SetStat(&in_statbuf), Return(0))) |
| 539 EXPECT_CALL(mock, lstat(kDummyConstChar, &buf)).WillOnce(Return(0)); | 538 .WillOnce(Return(-1)); |
| 540 EXPECT_EQ(0, lstat(kDummyConstChar, &buf)); | 539 struct stat out_statbuf; |
| 540 EXPECT_EQ(0, lstat(kDummyConstChar, &out_statbuf)); |
| 541 EXPECT_THAT(&in_statbuf, IsEqualToStatbuf(&out_statbuf)); |
| 542 EXPECT_EQ(-1, lstat(kDummyConstChar, &out_statbuf)); |
| 541 } | 543 } |
| 542 #endif | |
| 543 | 544 |
| 544 TEST_F(KernelWrapTest, unlink) { | 545 TEST_F(KernelWrapTest, unlink) { |
| 545 EXPECT_CALL(mock, unlink(kDummyConstChar)).WillOnce(Return(kDummyInt)); | 546 EXPECT_CALL(mock, unlink(kDummyConstChar)).WillOnce(Return(kDummyInt)); |
| 546 EXPECT_EQ(kDummyInt, unlink(kDummyConstChar)); | 547 EXPECT_EQ(kDummyInt, unlink(kDummyConstChar)); |
| 547 } | 548 } |
| 548 | 549 |
| 549 TEST_F(KernelWrapTest, utime) { | 550 TEST_F(KernelWrapTest, utime) { |
| 550 const struct utimbuf* times = NULL; | 551 const struct utimbuf* times = NULL; |
| 551 EXPECT_CALL(mock, utime(kDummyConstChar, times)).WillOnce(Return(kDummyInt)); | 552 EXPECT_CALL(mock, utime(kDummyConstChar, times)).WillOnce(Return(kDummyInt)); |
| 552 EXPECT_EQ(kDummyInt, utime(kDummyConstChar, times)); | 553 EXPECT_EQ(kDummyInt, utime(kDummyConstChar, times)); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 int dummy_val; | 739 int dummy_val; |
| 739 EXPECT_CALL(mock, socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val)) | 740 EXPECT_CALL(mock, socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val)) |
| 740 .WillOnce(Return(kDummyInt4)); | 741 .WillOnce(Return(kDummyInt4)); |
| 741 EXPECT_EQ(kDummyInt4, | 742 EXPECT_EQ(kDummyInt4, |
| 742 socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val)); | 743 socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val)); |
| 743 } | 744 } |
| 744 | 745 |
| 745 #endif // PROVIDES_SOCKET_API | 746 #endif // PROVIDES_SOCKET_API |
| 746 | 747 |
| 747 #endif // __linux__ | 748 #endif // __linux__ |
| OLD | NEW |