Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: native_client_sdk/src/tests/nacl_io_test/kernel_wrap_test.cc

Issue 1136953014: nacl_io: Remove the direct syscall intercept for 'remove' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/syscalls/remove.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 503
504 EXPECT_CALL(mock, readlink(kDummyConstChar, buf, 10)) 504 EXPECT_CALL(mock, readlink(kDummyConstChar, buf, 10))
505 .WillOnce(Return(kDummyInt)) 505 .WillOnce(Return(kDummyInt))
506 .WillOnce(DoAll(SetErrno(kDummyErrno), Return(-1))); 506 .WillOnce(DoAll(SetErrno(kDummyErrno), Return(-1)));
507 507
508 EXPECT_EQ(kDummyInt, readlink(kDummyConstChar, buf, 10)); 508 EXPECT_EQ(kDummyInt, readlink(kDummyConstChar, buf, 10));
509 EXPECT_EQ(-1, readlink(kDummyConstChar, buf, 10)); 509 EXPECT_EQ(-1, readlink(kDummyConstChar, buf, 10));
510 ASSERT_EQ(kDummyErrno, errno); 510 ASSERT_EQ(kDummyErrno, errno);
511 } 511 }
512 512
513 #ifdef __GLIBC__
514 // Under newlib there is no remove syscall. Instead it is implemented
515 // in terms of unlink()/rmdir().
516 TEST_F(KernelWrapTest, remove) { 513 TEST_F(KernelWrapTest, remove) {
517 EXPECT_CALL(mock, remove(kDummyConstChar)).WillOnce(Return(-1)); 514 // The remove syscall is not directly intercepted. Instead it is implemented
515 // in terms of unlink()/rmdir().
516 EXPECT_CALL(mock, unlink(kDummyConstChar))
517 .WillOnce(DoAll(SetErrno(kDummyErrno), Return(-1)));
518 EXPECT_EQ(-1, remove(kDummyConstChar)); 518 EXPECT_EQ(-1, remove(kDummyConstChar));
519 } 519 }
520 #endif
521 520
522 TEST_F(KernelWrapTest, rename) { 521 TEST_F(KernelWrapTest, rename) {
523 EXPECT_CALL(mock, rename(kDummyConstChar, kDummyConstChar2)) 522 EXPECT_CALL(mock, rename(kDummyConstChar, kDummyConstChar2))
524 .WillOnce(Return(0)) 523 .WillOnce(Return(0))
525 .WillOnce(DoAll(SetErrno(kDummyErrno), Return(-1))); 524 .WillOnce(DoAll(SetErrno(kDummyErrno), Return(-1)));
526 525
527 EXPECT_EQ(0, rename(kDummyConstChar, kDummyConstChar2)); 526 EXPECT_EQ(0, rename(kDummyConstChar, kDummyConstChar2));
528 EXPECT_EQ(-1, rename(kDummyConstChar, kDummyConstChar2)); 527 EXPECT_EQ(-1, rename(kDummyConstChar, kDummyConstChar2));
529 ASSERT_EQ(kDummyErrno, errno); 528 ASSERT_EQ(kDummyErrno, errno);
530 } 529 }
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 .WillOnce(Return(0)) 919 .WillOnce(Return(0))
921 .WillOnce(DoAll(SetErrno(kDummyErrno), Return(-1))); 920 .WillOnce(DoAll(SetErrno(kDummyErrno), Return(-1)));
922 EXPECT_EQ(0, socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val)); 921 EXPECT_EQ(0, socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val));
923 EXPECT_EQ(-1, socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val)); 922 EXPECT_EQ(-1, socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val));
924 EXPECT_EQ(kDummyErrno, errno); 923 EXPECT_EQ(kDummyErrno, errno);
925 } 924 }
926 925
927 #endif // PROVIDES_SOCKET_API 926 #endif // PROVIDES_SOCKET_API
928 927
929 #endif // __linux__ 928 #endif // __linux__
OLDNEW
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/syscalls/remove.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698