| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008 The Native Client Authors. All rights reserved. | 2 * Copyright 2008 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can |
| 4 * be found in the LICENSE file. | 4 * be found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* | 7 /* |
| 8 * NaCl tests for simple syscalls | 8 * NaCl tests for simple syscalls |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 return failed(testname, "read(fd, out_char, -1)"); | 230 return failed(testname, "read(fd, out_char, -1)"); |
| 231 // bad address | 231 // bad address |
| 232 if (EFAULT != errno) | 232 if (EFAULT != errno) |
| 233 return failed(testname, "EFAULT != errno"); | 233 return failed(testname, "EFAULT != errno"); |
| 234 | 234 |
| 235 errno = 0; | 235 errno = 0; |
| 236 // fd not OK, buffer OK, count not OK | 236 // fd not OK, buffer OK, count not OK |
| 237 ret_val = read(-1, out_char, -1); | 237 ret_val = read(-1, out_char, -1); |
| 238 if (ret_val != -1) | 238 if (ret_val != -1) |
| 239 return failed(testname, "read(-1, out_char, -1)"); | 239 return failed(testname, "read(-1, out_char, -1)"); |
| 240 // bad address | 240 // bad descriptor |
| 241 if (EFAULT != errno) | 241 if (EBADF != errno) |
| 242 return failed(testname, "EFAULT != errno"); | 242 return failed(testname, "EBADF != errno"); |
| 243 | 243 |
| 244 // fd OK, buffer OK, count 0 | 244 // fd OK, buffer OK, count 0 |
| 245 ret_val = read(fd, out_char, 0); | 245 ret_val = read(fd, out_char, 0); |
| 246 if (ret_val != 0) | 246 if (ret_val != 0) |
| 247 return failed(testname, "read(fd, out_char, 0)"); | 247 return failed(testname, "read(fd, out_char, 0)"); |
| 248 | 248 |
| 249 // read 10, but only 3 are left | 249 // read 10, but only 3 are left |
| 250 ret_val = read(fd, out_char, 10); | 250 ret_val = read(fd, out_char, 10); |
| 251 if (ret_val != 4) | 251 if (ret_val != 4) |
| 252 return failed(testname, "read(fd, out_char, 10)"); | 252 return failed(testname, "read(fd, out_char, 10)"); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 passed = testSuite(argv[1]); | 424 passed = testSuite(argv[1]); |
| 425 | 425 |
| 426 if (passed) { | 426 if (passed) { |
| 427 printf("All tests PASSED\n"); | 427 printf("All tests PASSED\n"); |
| 428 exit(0); | 428 exit(0); |
| 429 } else { | 429 } else { |
| 430 printf("One or more tests FAILED\n"); | 430 printf("One or more tests FAILED\n"); |
| 431 exit(-1); | 431 exit(-1); |
| 432 } | 432 } |
| 433 } | 433 } |
| OLD | NEW |