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

Side by Side Diff: tests/mmap/mmap_test.cc

Issue 415383002: Non-SFI mode: SCONS_NONSFI_TC clean up. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 6 years, 4 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
« no previous file with comments | « buildbot/buildbot_pnacl.sh ('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 /* 1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <limits.h> 10 #include <limits.h>
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 219 }
220 220
221 /* 221 /*
222 * Verify that mmap into the NULL pointer guard page will fail. 222 * Verify that mmap into the NULL pointer guard page will fail.
223 */ 223 */
224 224
225 bool test3() { 225 bool test3() {
226 void *res; 226 void *res;
227 227
228 printf("test3\n"); 228 printf("test3\n");
229 if (NONSFI_MODE) {
230 /*
231 * This test is designed to made sure NaClSyscall mmap's behavior returns
Mark Seaborn 2014/07/25 20:54:54 "make sure" How about: "This test checks a securi
hidehiko 2014/07/28 22:11:05 Done.
232 * an appropriate error. So, we skip it in non-SFI mode.
233 */
234 printf("test3 skipped\n");
235 return true;
236 }
237
229 res = mmap(static_cast<void*>(0), (size_t) (1 << 16), 238 res = mmap(static_cast<void*>(0), (size_t) (1 << 16),
230 PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, 0, 0); 239 PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, 0, 0);
231 printf("res = %p\n", res); 240 printf("res = %p\n", res);
232 const int kExpectedErrno = NONSFI_MODE ? EPERM : EINVAL; 241 if (MAP_FAILED == res) {
233 if (MAP_FAILED == res && kExpectedErrno == errno) { 242 printf("errno = %d\n", errno);
243 }
244 if (MAP_FAILED == res && EINVAL == errno) {
234 printf("mmap okay\n"); 245 printf("mmap okay\n");
235 return true; 246 return true;
236 } 247 }
237 printf("mmap should not have succeeded, or failed with wrong error\n"); 248 printf("mmap should not have succeeded, or failed with wrong error\n");
238 return false; 249 return false;
239 } 250 }
240 251
241 /* 252 /*
242 * Verify that mmap/MAP_FIXED with a non-page-aligned address will fail. 253 * Verify that mmap/MAP_FIXED with a non-page-aligned address will fail.
243 */ 254 */
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 // run the full test suite 581 // run the full test suite
571 passed = testSuite(); 582 passed = testSuite();
572 583
573 if (passed) { 584 if (passed) {
574 printf("All tests PASSED\n"); 585 printf("All tests PASSED\n");
575 exit(0); 586 exit(0);
576 } 587 }
577 printf("One or more tests FAILED\n"); 588 printf("One or more tests FAILED\n");
578 exit(-1); 589 exit(-1);
579 } 590 }
OLDNEW
« no previous file with comments | « buildbot/buildbot_pnacl.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698