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

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

Issue 176923017: [NaCl SDK] Compile for naclio for Bionic (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix bug in h_error Created 6 years, 8 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 | Annotate | Revision Log
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 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 statbuf->st_nlink = 4; 84 statbuf->st_nlink = 4;
85 statbuf->st_uid = 5; 85 statbuf->st_uid = 5;
86 statbuf->st_gid = 6; 86 statbuf->st_gid = 6;
87 statbuf->st_rdev = 7; 87 statbuf->st_rdev = 7;
88 statbuf->st_size = 8; 88 statbuf->st_size = 8;
89 statbuf->st_atime = 9; 89 statbuf->st_atime = 9;
90 statbuf->st_mtime = 10; 90 statbuf->st_mtime = 10;
91 statbuf->st_ctime = 11; 91 statbuf->st_ctime = 11;
92 } 92 }
93 93
94 const mode_t kDummyMode = 0xbeef;
94 const int kDummyInt = 0xdedbeef; 95 const int kDummyInt = 0xdedbeef;
95 const int kDummyInt2 = 0xcabba6e; 96 const int kDummyInt2 = 0xcabba6e;
96 const int kDummyInt3 = 0xf00ba4; 97 const int kDummyInt3 = 0xf00ba4;
97 const int kDummyInt4 = 0xabacdba; 98 const int kDummyInt4 = 0xabacdba;
98 const size_t kDummySizeT = 0x60067e; 99 const size_t kDummySizeT = 0x60067e;
99 const char* kDummyConstChar = "foobar"; 100 const char* kDummyConstChar = "foobar";
100 const char* kDummyConstChar2 = "g00gl3"; 101 const char* kDummyConstChar2 = "g00gl3";
101 const char* kDummyConstChar3 = "fr00gl3"; 102 const char* kDummyConstChar3 = "fr00gl3";
102 const void* kDummyVoidPtr = "blahblah"; 103 const void* kDummyVoidPtr = "blahblah";
103 const uid_t kDummyUid = 1001; 104 const uid_t kDummyUid = 1001;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 145
145 TEST_F(KernelWrapTest, chdir) { 146 TEST_F(KernelWrapTest, chdir) {
146 EXPECT_CALL(mock, chdir(kDummyConstChar)).WillOnce(Return(-1)); 147 EXPECT_CALL(mock, chdir(kDummyConstChar)).WillOnce(Return(-1));
147 EXPECT_EQ(-1, chdir(kDummyConstChar)); 148 EXPECT_EQ(-1, chdir(kDummyConstChar));
148 149
149 EXPECT_CALL(mock, chdir(kDummyConstChar)).WillOnce(Return(0)); 150 EXPECT_CALL(mock, chdir(kDummyConstChar)).WillOnce(Return(0));
150 EXPECT_EQ(0, chdir(kDummyConstChar)); 151 EXPECT_EQ(0, chdir(kDummyConstChar));
151 } 152 }
152 153
153 TEST_F(KernelWrapTest, chmod) { 154 TEST_F(KernelWrapTest, chmod) {
154 EXPECT_CALL(mock, chmod(kDummyConstChar, kDummyInt)) 155 EXPECT_CALL(mock, chmod(kDummyConstChar, kDummyMode))
155 .WillOnce(Return(kDummyInt2)); 156 .WillOnce(Return(kDummyInt2));
156 EXPECT_EQ(kDummyInt2, chmod(kDummyConstChar, kDummyInt)); 157 EXPECT_EQ(kDummyInt2,chmod(kDummyConstChar, kDummyMode));
157 } 158 }
158 159
159 TEST_F(KernelWrapTest, chown) { 160 TEST_F(KernelWrapTest, chown) {
160 EXPECT_CALL(mock, chown(kDummyConstChar, kDummyUid, kDummyGid)) 161 EXPECT_CALL(mock, chown(kDummyConstChar, kDummyUid, kDummyGid))
161 .WillOnce(Return(kDummyInt)); 162 .WillOnce(Return(kDummyInt));
162 EXPECT_EQ(kDummyInt, chown(kDummyConstChar, kDummyUid, kDummyGid)); 163 EXPECT_EQ(kDummyInt, chown(kDummyConstChar, kDummyUid, kDummyGid));
163 } 164 }
164 165
165 TEST_F(KernelWrapTest, close) { 166 TEST_F(KernelWrapTest, close) {
166 // The way we wrap close does not support returning arbitrary values, so we 167 // The way we wrap close does not support returning arbitrary values, so we
(...skipping 21 matching lines...) Expand all
188 EXPECT_EQ(-1, dup2(kDummyInt, kDummyInt2)); 189 EXPECT_EQ(-1, dup2(kDummyInt, kDummyInt2));
189 } 190 }
190 191
191 TEST_F(KernelWrapTest, fchdir) { 192 TEST_F(KernelWrapTest, fchdir) {
192 EXPECT_CALL(mock, fchdir(kDummyInt)) 193 EXPECT_CALL(mock, fchdir(kDummyInt))
193 .WillOnce(Return(-1)); 194 .WillOnce(Return(-1));
194 EXPECT_EQ(-1, fchdir(kDummyInt)); 195 EXPECT_EQ(-1, fchdir(kDummyInt));
195 } 196 }
196 197
197 TEST_F(KernelWrapTest, fchmod) { 198 TEST_F(KernelWrapTest, fchmod) {
198 EXPECT_CALL(mock, fchmod(kDummyInt, kDummyInt2)) .WillOnce(Return(-1)); 199 EXPECT_CALL(mock, fchmod(kDummyInt, kDummyMode))
199 EXPECT_EQ(-1, fchmod(kDummyInt, kDummyInt2)); 200 .WillOnce(Return(-1));
201 EXPECT_EQ(-1, fchmod(kDummyInt, kDummyMode));
200 202
201 EXPECT_CALL(mock, fchmod(kDummyInt, kDummyInt2)) .WillOnce(Return(0)); 203 EXPECT_CALL(mock, fchmod(kDummyInt, kDummyMode)) .WillOnce(Return(0));
202 EXPECT_EQ(0, fchmod(kDummyInt, kDummyInt2)); 204 EXPECT_EQ(0, fchmod(kDummyInt, kDummyMode));
203 } 205 }
204 206
205 TEST_F(KernelWrapTest, fchown) { 207 TEST_F(KernelWrapTest, fchown) {
206 EXPECT_CALL(mock, fchown(kDummyInt, kDummyUid, kDummyGid)) 208 EXPECT_CALL(mock, fchown(kDummyInt, kDummyUid, kDummyGid))
207 .WillOnce(Return(kDummyInt)); 209 .WillOnce(Return(kDummyInt));
208 EXPECT_EQ(kDummyInt, fchown(kDummyInt, kDummyUid, kDummyGid)); 210 EXPECT_EQ(kDummyInt, fchown(kDummyInt, kDummyUid, kDummyGid));
209 } 211 }
210 212
211 TEST_F(KernelWrapTest, fcntl) { 213 TEST_F(KernelWrapTest, fcntl) {
212 char buffer[] = "fcntl"; 214 char buffer[] = "fcntl";
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 251 }
250 252
251 TEST_F(KernelWrapTest, getcwd) { 253 TEST_F(KernelWrapTest, getcwd) {
252 char result[] = "getcwd_result"; 254 char result[] = "getcwd_result";
253 char buffer[] = "getcwd"; 255 char buffer[] = "getcwd";
254 EXPECT_CALL(mock, getcwd(buffer, kDummySizeT)).WillOnce(Return(result)); 256 EXPECT_CALL(mock, getcwd(buffer, kDummySizeT)).WillOnce(Return(result));
255 EXPECT_EQ(result, getcwd(buffer, kDummySizeT)); 257 EXPECT_EQ(result, getcwd(buffer, kDummySizeT));
256 } 258 }
257 259
258 TEST_F(KernelWrapTest, getdents) { 260 TEST_F(KernelWrapTest, getdents) {
259 #ifndef __GLIBC__ 261 #if !defined( __GLIBC__) && !defined(__BIONIC__)
260 // TODO(sbc): Find a way to test the getdents wrapper under glibc. 262 // TODO(sbc): Find a way to test the getdents wrapper under glibc.
261 // It looks like the only way to exercise it is to call readdir(2). 263 // It looks like the only way to exercise it is to call readdir(2).
262 // There is an internal glibc function __getdents that will call the 264 // There is an internal glibc function __getdents that will call the
263 // IRT but that cannot be accessed from here as glibc does not export it. 265 // IRT but that cannot be accessed from here as glibc does not export it.
264 int dummy_val; 266 int dummy_val;
265 void* void_ptr = &dummy_val; 267 void* void_ptr = &dummy_val;
266 EXPECT_CALL(mock, getdents(kDummyInt, void_ptr, kDummyInt2)) 268 EXPECT_CALL(mock, getdents(kDummyInt, void_ptr, kDummyInt2))
267 .WillOnce(Return(kDummyInt2)); 269 .WillOnce(Return(kDummyInt2));
268 EXPECT_EQ(kDummyInt2, getdents(kDummyInt, void_ptr, kDummyInt2)); 270 EXPECT_EQ(kDummyInt2, getdents(kDummyInt, void_ptr, kDummyInt2));
269 #endif 271 #endif
(...skipping 13 matching lines...) Expand all
283 #pragma GCC diagnostic warning "-Wdeprecated-declarations" 285 #pragma GCC diagnostic warning "-Wdeprecated-declarations"
284 #endif 286 #endif
285 287
286 TEST_F(KernelWrapTest, ioctl) { 288 TEST_F(KernelWrapTest, ioctl) {
287 char buffer[] = "ioctl"; 289 char buffer[] = "ioctl";
288 EXPECT_CALL(mock, ioctl(kDummyInt, kDummyInt2, _)) 290 EXPECT_CALL(mock, ioctl(kDummyInt, kDummyInt2, _))
289 .WillOnce(Return(kDummyInt3)); 291 .WillOnce(Return(kDummyInt3));
290 EXPECT_EQ(kDummyInt3, ioctl(kDummyInt, kDummyInt2, buffer)); 292 EXPECT_EQ(kDummyInt3, ioctl(kDummyInt, kDummyInt2, buffer));
291 } 293 }
292 294
295 #if !defined(__BIONIC__)
293 TEST_F(KernelWrapTest, isatty) { 296 TEST_F(KernelWrapTest, isatty) {
294 EXPECT_CALL(mock, isatty(kDummyInt)).WillOnce(Return(kDummyInt2)); 297 EXPECT_CALL(mock, isatty(kDummyInt)).WillOnce(Return(kDummyInt2));
295 EXPECT_EQ(kDummyInt2, isatty(kDummyInt)); 298 EXPECT_EQ(kDummyInt2, isatty(kDummyInt));
296 } 299 }
300 #endif
297 301
298 TEST_F(KernelWrapTest, kill) { 302 TEST_F(KernelWrapTest, kill) {
299 EXPECT_CALL(mock, kill(kDummyInt, kDummyInt2)).WillOnce(Return(kDummyInt3)); 303 EXPECT_CALL(mock, kill(kDummyInt, kDummyInt2)).WillOnce(Return(kDummyInt3));
300 EXPECT_EQ(kDummyInt3, kill(kDummyInt, kDummyInt2)); 304 EXPECT_EQ(kDummyInt3, kill(kDummyInt, kDummyInt2));
301 } 305 }
302 306
303 TEST_F(KernelWrapTest, lchown) { 307 TEST_F(KernelWrapTest, lchown) {
304 EXPECT_CALL(mock, lchown(kDummyConstChar, kDummyUid, kDummyGid)) 308 EXPECT_CALL(mock, lchown(kDummyConstChar, kDummyUid, kDummyGid))
305 .WillOnce(Return(kDummyInt)); 309 .WillOnce(Return(kDummyInt));
306 EXPECT_EQ(kDummyInt, lchown(kDummyConstChar, kDummyUid, kDummyGid)); 310 EXPECT_EQ(kDummyInt, lchown(kDummyConstChar, kDummyUid, kDummyGid));
307 } 311 }
308 312
309 TEST_F(KernelWrapTest, link) { 313 TEST_F(KernelWrapTest, link) {
310 EXPECT_CALL(mock, link(kDummyConstChar, kDummyConstChar2)) 314 EXPECT_CALL(mock, link(kDummyConstChar, kDummyConstChar2))
311 .WillOnce(Return(kDummyInt)); 315 .WillOnce(Return(kDummyInt));
312 EXPECT_EQ(kDummyInt, link(kDummyConstChar, kDummyConstChar2)); 316 EXPECT_EQ(kDummyInt, link(kDummyConstChar, kDummyConstChar2));
313 } 317 }
314 318
315 TEST_F(KernelWrapTest, lseek) { 319 TEST_F(KernelWrapTest, lseek) {
316 EXPECT_CALL(mock, lseek(kDummyInt, kDummyInt2, kDummyInt3)) 320 EXPECT_CALL(mock, lseek(kDummyInt, kDummyInt2, kDummyInt3))
317 .WillOnce(Return(kDummyInt4)); 321 .WillOnce(Return(kDummyInt4));
318 EXPECT_EQ(kDummyInt4, lseek(kDummyInt, kDummyInt2, kDummyInt3)); 322 EXPECT_EQ(kDummyInt4, lseek(kDummyInt, kDummyInt2, kDummyInt3));
319 } 323 }
320 324
321 TEST_F(KernelWrapTest, mkdir) { 325 TEST_F(KernelWrapTest, mkdir) {
322 #if defined(WIN32) 326 #if defined(WIN32)
323 EXPECT_CALL(mock, mkdir(kDummyConstChar, 0777)).WillOnce(Return(kDummyInt2)); 327 EXPECT_CALL(mock, mkdir(kDummyConstChar, 0777)).WillOnce(Return(kDummyInt2));
324 EXPECT_EQ(kDummyInt2, mkdir(kDummyConstChar)); 328 EXPECT_EQ(kDummyInt2, mkdir(kDummyConstChar));
325 #else 329 #else
326 EXPECT_CALL(mock, mkdir(kDummyConstChar, kDummyInt)) 330 EXPECT_CALL(mock, mkdir(kDummyConstChar, kDummyMode))
327 .WillOnce(Return(kDummyInt2)); 331 .WillOnce(Return(kDummyInt2));
328 EXPECT_EQ(kDummyInt2, mkdir(kDummyConstChar, kDummyInt)); 332 EXPECT_EQ(kDummyInt2, mkdir(kDummyConstChar, kDummyMode));
329 #endif 333 #endif
330 } 334 }
331 335
332 TEST_F(KernelWrapTest, mmap) { 336 TEST_F(KernelWrapTest, mmap) {
333 // We only wrap mmap if |flags| has the MAP_ANONYMOUS bit unset. 337 // We only wrap mmap if |flags| has the MAP_ANONYMOUS bit unset.
334 int flags = kDummyInt2 & ~MAP_ANONYMOUS; 338 int flags = kDummyInt2 & ~MAP_ANONYMOUS;
335 339
336 const size_t kDummySizeT2 = 0xbadf00d; 340 const size_t kDummySizeT2 = 0xbadf00d;
337 int dummy1 = 123; 341 int dummy1 = 123;
338 int dummy2 = 456; 342 int dummy2 = 456;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 // one. The result returned is from the "real" mmap. 378 // one. The result returned is from the "real" mmap.
375 int dummy1 = 123; 379 int dummy1 = 123;
376 void* kDummyVoidPtr = &dummy1; 380 void* kDummyVoidPtr = &dummy1;
377 size_t kDummySizeT = sizeof(kDummyVoidPtr); 381 size_t kDummySizeT = sizeof(kDummyVoidPtr);
378 EXPECT_CALL(mock, munmap(kDummyVoidPtr, kDummySizeT)); 382 EXPECT_CALL(mock, munmap(kDummyVoidPtr, kDummySizeT));
379 munmap(kDummyVoidPtr, kDummySizeT); 383 munmap(kDummyVoidPtr, kDummySizeT);
380 } 384 }
381 385
382 386
383 TEST_F(KernelWrapTest, open) { 387 TEST_F(KernelWrapTest, open) {
384 EXPECT_CALL(mock, open(kDummyConstChar, kDummyInt)) 388 // We pass O_RDONLY because we do not want an error in flags translation
389 EXPECT_CALL(mock, open(kDummyConstChar, 0))
385 .WillOnce(Return(kDummyInt2)); 390 .WillOnce(Return(kDummyInt2));
386 EXPECT_EQ(kDummyInt2, open(kDummyConstChar, kDummyInt)); 391 EXPECT_EQ(kDummyInt2, open(kDummyConstChar, 0));
387 392
388 EXPECT_CALL(mock, open(kDummyConstChar, kDummyInt)) 393 EXPECT_CALL(mock, open(kDummyConstChar, 0))
389 .WillOnce(Return(kDummyInt2)); 394 .WillOnce(Return(kDummyInt2));
390 EXPECT_EQ(kDummyInt2, open(kDummyConstChar, kDummyInt)); 395 EXPECT_EQ(kDummyInt2, open(kDummyConstChar, 0));
391 } 396 }
392 397
393 TEST_F(KernelWrapTest, pipe) { 398 TEST_F(KernelWrapTest, pipe) {
394 int fds[] = {1, 2}; 399 int fds[] = {1, 2};
395 EXPECT_CALL(mock, pipe(fds)).WillOnce(Return(kDummyInt)); 400 EXPECT_CALL(mock, pipe(fds)).WillOnce(Return(kDummyInt));
396 EXPECT_EQ(kDummyInt, pipe(fds)); 401 EXPECT_EQ(kDummyInt, pipe(fds));
397 } 402 }
398 403
399 TEST_F(KernelWrapTest, read) { 404 TEST_F(KernelWrapTest, read) {
400 int dummy_value; 405 int dummy_value;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 EXPECT_THAT(&in_statbuf, IsEqualToStatbuf(&out_statbuf)); 481 EXPECT_THAT(&in_statbuf, IsEqualToStatbuf(&out_statbuf));
477 EXPECT_EQ(-1, stat(kDummyConstChar, &out_statbuf)); 482 EXPECT_EQ(-1, stat(kDummyConstChar, &out_statbuf));
478 } 483 }
479 484
480 TEST_F(KernelWrapTest, symlink) { 485 TEST_F(KernelWrapTest, symlink) {
481 EXPECT_CALL(mock, symlink(kDummyConstChar, kDummyConstChar2)) 486 EXPECT_CALL(mock, symlink(kDummyConstChar, kDummyConstChar2))
482 .WillOnce(Return(kDummyInt)); 487 .WillOnce(Return(kDummyInt));
483 EXPECT_EQ(kDummyInt, symlink(kDummyConstChar, kDummyConstChar2)); 488 EXPECT_EQ(kDummyInt, symlink(kDummyConstChar, kDummyConstChar2));
484 } 489 }
485 490
491 #ifndef __BIONIC__
486 TEST_F(KernelWrapTest, tcflush) { 492 TEST_F(KernelWrapTest, tcflush) {
487 EXPECT_CALL(mock, tcflush(kDummyInt, kDummyInt2)) 493 EXPECT_CALL(mock, tcflush(kDummyInt, kDummyInt2))
488 .WillOnce(Return(kDummyInt3)); 494 .WillOnce(Return(kDummyInt3));
489 EXPECT_EQ(kDummyInt3, tcflush(kDummyInt, kDummyInt2)); 495 EXPECT_EQ(kDummyInt3, tcflush(kDummyInt, kDummyInt2));
490 } 496 }
491 497
492 TEST_F(KernelWrapTest, tcgetattr) { 498 TEST_F(KernelWrapTest, tcgetattr) {
493 struct termios term; 499 struct termios term;
494 EXPECT_CALL(mock, tcgetattr(kDummyInt, &term)).WillOnce(Return(kDummyInt2)); 500 EXPECT_CALL(mock, tcgetattr(kDummyInt, &term)).WillOnce(Return(kDummyInt2));
495 EXPECT_EQ(kDummyInt2, tcgetattr(kDummyInt, &term)); 501 EXPECT_EQ(kDummyInt2, tcgetattr(kDummyInt, &term));
496 } 502 }
497 503
498 TEST_F(KernelWrapTest, tcsetattr) { 504 TEST_F(KernelWrapTest, tcsetattr) {
499 struct termios term; 505 struct termios term;
500 EXPECT_CALL(mock, tcsetattr(kDummyInt, kDummyInt2, &term)) 506 EXPECT_CALL(mock, tcsetattr(kDummyInt, kDummyInt2, &term))
501 .WillOnce(Return(kDummyInt3)); 507 .WillOnce(Return(kDummyInt3));
502 EXPECT_EQ(kDummyInt3, tcsetattr(kDummyInt, kDummyInt2, &term)); 508 EXPECT_EQ(kDummyInt3, tcsetattr(kDummyInt, kDummyInt2, &term));
503 } 509 }
510 #endif
504 511
505 TEST_F(KernelWrapTest, umount) { 512 TEST_F(KernelWrapTest, umount) {
506 EXPECT_CALL(mock, umount(kDummyConstChar)).WillOnce(Return(kDummyInt)); 513 EXPECT_CALL(mock, umount(kDummyConstChar)).WillOnce(Return(kDummyInt));
507 EXPECT_EQ(kDummyInt, umount(kDummyConstChar)); 514 EXPECT_EQ(kDummyInt, umount(kDummyConstChar));
508 } 515 }
509 516
510 TEST_F(KernelWrapTest, truncate) { 517 TEST_F(KernelWrapTest, truncate) {
511 EXPECT_CALL(mock, truncate(kDummyConstChar, kDummyInt3)).WillOnce(Return(-1)); 518 EXPECT_CALL(mock, truncate(kDummyConstChar, kDummyInt3)).WillOnce(Return(-1));
512 EXPECT_EQ(-1, truncate(kDummyConstChar, kDummyInt3)); 519 EXPECT_EQ(-1, truncate(kDummyConstChar, kDummyInt3));
513 520
514 EXPECT_CALL(mock, truncate(kDummyConstChar, kDummyInt3)).WillOnce(Return(0)); 521 EXPECT_CALL(mock, truncate(kDummyConstChar, kDummyInt3)).WillOnce(Return(0));
515 EXPECT_EQ(0, truncate(kDummyConstChar, kDummyInt3)); 522 EXPECT_EQ(0, truncate(kDummyConstChar, kDummyInt3));
516 } 523 }
517 524
525 #ifndef __BIONIC__
518 TEST_F(KernelWrapTest, lstat) { 526 TEST_F(KernelWrapTest, lstat) {
519 struct stat buf; 527 struct stat buf;
520 EXPECT_CALL(mock, lstat(kDummyConstChar, &buf)).WillOnce(Return(-1)); 528 EXPECT_CALL(mock, lstat(kDummyConstChar, &buf)).WillOnce(Return(-1));
521 EXPECT_EQ(-1, lstat(kDummyConstChar, &buf)); 529 EXPECT_EQ(-1, lstat(kDummyConstChar, &buf));
522 530
523 EXPECT_CALL(mock, lstat(kDummyConstChar, &buf)).WillOnce(Return(0)); 531 EXPECT_CALL(mock, lstat(kDummyConstChar, &buf)).WillOnce(Return(0));
524 EXPECT_EQ(0, lstat(kDummyConstChar, &buf)); 532 EXPECT_EQ(0, lstat(kDummyConstChar, &buf));
525 } 533 }
534 #endif
526 535
527 TEST_F(KernelWrapTest, unlink) { 536 TEST_F(KernelWrapTest, unlink) {
528 EXPECT_CALL(mock, unlink(kDummyConstChar)).WillOnce(Return(kDummyInt)); 537 EXPECT_CALL(mock, unlink(kDummyConstChar)).WillOnce(Return(kDummyInt));
529 EXPECT_EQ(kDummyInt, unlink(kDummyConstChar)); 538 EXPECT_EQ(kDummyInt, unlink(kDummyConstChar));
530 } 539 }
531 540
532 TEST_F(KernelWrapTest, utime) { 541 TEST_F(KernelWrapTest, utime) {
533 const struct utimbuf* times = NULL; 542 const struct utimbuf* times = NULL;
534 EXPECT_CALL(mock, utime(kDummyConstChar, times)).WillOnce(Return(kDummyInt)); 543 EXPECT_CALL(mock, utime(kDummyConstChar, times)).WillOnce(Return(kDummyInt));
535 EXPECT_EQ(kDummyInt, utime(kDummyConstChar, times)); 544 EXPECT_EQ(kDummyInt, utime(kDummyConstChar, times));
536 } 545 }
537 546
538 TEST_F(KernelWrapTest, utimes) { 547 TEST_F(KernelWrapTest, utimes) {
539 struct timeval* times = NULL; 548 struct timeval* times = NULL;
540 EXPECT_CALL(mock, utimes(kDummyConstChar, times)).WillOnce(Return(-1)); 549 EXPECT_CALL(mock, utimes(kDummyConstChar, times)).WillOnce(Return(-1));
541 EXPECT_EQ(-1, utimes(kDummyConstChar, times)); 550 EXPECT_EQ(-1, utimes(kDummyConstChar, times));
542 } 551 }
543 552
544 TEST_F(KernelWrapTest, write) { 553 TEST_F(KernelWrapTest, write) {
545 EXPECT_CALL(mock, write(kDummyInt, kDummyVoidPtr, kDummyInt2)) 554 EXPECT_CALL(mock, write(kDummyInt, kDummyVoidPtr, kDummyInt2))
546 .WillOnce(Return(kDummyInt3)); 555 .WillOnce(Return(kDummyInt3));
547 EXPECT_EQ(kDummyInt3, write(kDummyInt, kDummyVoidPtr, kDummyInt2)); 556 EXPECT_EQ(kDummyInt3, write(kDummyInt, kDummyVoidPtr, kDummyInt2));
548 } 557 }
549 558
550 #ifdef PROVIDES_SOCKET_API 559 #if defined(PROVIDES_SOCKET_API) and !defined(__BIONIC__)
551 TEST_F(KernelWrapTest, poll) { 560 TEST_F(KernelWrapTest, poll) {
552 struct pollfd fds; 561 struct pollfd fds;
553 EXPECT_CALL(mock, poll(&fds, kDummyInt, kDummyInt2)) 562 EXPECT_CALL(mock, poll(&fds, kDummyInt, kDummyInt2))
554 .WillOnce(Return(kDummyInt3)); 563 .WillOnce(Return(kDummyInt3));
555 EXPECT_EQ(kDummyInt3, poll(&fds, kDummyInt, kDummyInt2)); 564 EXPECT_EQ(kDummyInt3, poll(&fds, kDummyInt, kDummyInt2));
556 } 565 }
557 566
558 TEST_F(KernelWrapTest, select) { 567 TEST_F(KernelWrapTest, select) {
559 fd_set readfds; 568 fd_set readfds;
560 fd_set writefds; 569 fd_set writefds;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 socklen_t len; 652 socklen_t len;
644 EXPECT_CALL( 653 EXPECT_CALL(
645 mock, 654 mock,
646 recvfrom(kDummyInt, dummy_void_ptr, kDummyInt2, kDummyInt3, &addr, &len)) 655 recvfrom(kDummyInt, dummy_void_ptr, kDummyInt2, kDummyInt3, &addr, &len))
647 .WillOnce(Return(kDummyInt4)); 656 .WillOnce(Return(kDummyInt4));
648 EXPECT_EQ( 657 EXPECT_EQ(
649 kDummyInt4, 658 kDummyInt4,
650 recvfrom(kDummyInt, dummy_void_ptr, kDummyInt2, kDummyInt3, &addr, &len)); 659 recvfrom(kDummyInt, dummy_void_ptr, kDummyInt2, kDummyInt3, &addr, &len));
651 } 660 }
652 661
662 #ifndef __BIONIC__
653 TEST_F(KernelWrapTest, recvmsg) { 663 TEST_F(KernelWrapTest, recvmsg) {
654 struct msghdr msg; 664 struct msghdr msg;
655 EXPECT_CALL(mock, recvmsg(kDummyInt, &msg, kDummyInt2)) 665 EXPECT_CALL(mock, recvmsg(kDummyInt, &msg, kDummyInt2))
656 .WillOnce(Return(kDummyInt3)); 666 .WillOnce(Return(kDummyInt3));
657 EXPECT_EQ(kDummyInt3, recvmsg(kDummyInt, &msg, kDummyInt2)); 667 EXPECT_EQ(kDummyInt3, recvmsg(kDummyInt, &msg, kDummyInt2));
658 } 668 }
669 #endif
659 670
660 TEST_F(KernelWrapTest, send) { 671 TEST_F(KernelWrapTest, send) {
661 EXPECT_CALL(mock, send(kDummyInt, kDummyVoidPtr, kDummySizeT, kDummyInt2)) 672 EXPECT_CALL(mock, send(kDummyInt, kDummyVoidPtr, kDummySizeT, kDummyInt2))
662 .WillOnce(Return(kDummyInt3)); 673 .WillOnce(Return(kDummyInt3));
663 EXPECT_EQ(kDummyInt3, 674 EXPECT_EQ(kDummyInt3,
664 send(kDummyInt, kDummyVoidPtr, kDummySizeT, kDummyInt2)); 675 send(kDummyInt, kDummyVoidPtr, kDummySizeT, kDummyInt2));
665 } 676 }
666 677
667 TEST_F(KernelWrapTest, sendto) { 678 TEST_F(KernelWrapTest, sendto) {
668 const socklen_t kDummySockLen = 0x50cc5; 679 const socklen_t kDummySockLen = 0x50cc5;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 int dummy_val; 730 int dummy_val;
720 EXPECT_CALL(mock, socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val)) 731 EXPECT_CALL(mock, socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val))
721 .WillOnce(Return(kDummyInt4)); 732 .WillOnce(Return(kDummyInt4));
722 EXPECT_EQ(kDummyInt4, 733 EXPECT_EQ(kDummyInt4,
723 socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val)); 734 socketpair(kDummyInt, kDummyInt2, kDummyInt3, &dummy_val));
724 } 735 }
725 736
726 #endif // PROVIDES_SOCKET_API 737 #endif // PROVIDES_SOCKET_API
727 738
728 #endif // __linux__ 739 #endif // __linux__
OLDNEW
« no previous file with comments | « native_client_sdk/src/tests/nacl_io_test/example.dsc ('k') | native_client_sdk/src/tools/common.mk » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698