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

Unified Diff: tests/syscalls/mem_test.cc

Issue 1264783002: Remove failure for bad mmap address hints. (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Added fix for failing test Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: tests/syscalls/mem_test.cc
diff --git a/tests/syscalls/mem_test.cc b/tests/syscalls/mem_test.cc
index 24a6420099d58342ca40abc2863998ca5cc100e5..1162d71acf4b3c4dd1577f4687770a5b19c53353 100644
--- a/tests/syscalls/mem_test.cc
+++ b/tests/syscalls/mem_test.cc
@@ -54,6 +54,24 @@ int TestBadFiledesc() {
END_TEST();
}
+// Verify that mmap does not fail if a bad hint address is passed, but
+// |MMAP_FIXED| is not specified.
+int TestMmapBadHint() {
+ START_TEST("TestMmapBadHint");
+ void* bad_hint = (void *) 0x123;
+ void* mmap_ptr = mmap(bad_hint,
+ k64Kbytes,
+ PROT_READ,
+ MAP_PRIVATE | MAP_ANONYMOUS,
+ kAnonymousFiledesc,
+ 0);
+ EXPECT(MAP_FAILED != mmap_ptr);
+ EXPECT(mmap_ptr != bad_hint);
+ EXPECT(munmap(mmap_ptr, k64Kbytes) == 0);
+ END_TEST();
+}
+
Mark Seaborn 2015/07/30 15:20:14 Nit: be consistent about whether there's 1 or 2 em
Sean Klein 2015/07/30 16:04:29 Done.
+
// Test mmap() and munmap(), since these often to go together. Tries to mmap
// a 64 Kb region of memory and then tests to make sure that the pages have all
// been 0-filled.
@@ -158,6 +176,7 @@ int main() {
int fail_count = 0;
fail_count += TestZeroLengthRegion();
fail_count += TestBadFiledesc();
+ fail_count += TestMmapBadHint();
fail_count += TestMmapMunmap();
fail_count += TestMunmapText();
fail_count += TestMmapNULL();
« src/trusted/service_runtime/sys_memory.c ('K') | « src/trusted/service_runtime/sys_memory.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698