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

Side by Side Diff: base/android/library_loader/library_prefetcher_unittest.cc

Issue 1534613002: Disable NativeLibraryPrefetcherTest tests that use mincore() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « no previous file | 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "base/android/library_loader/library_prefetcher.h" 5 #include "base/android/library_loader/library_prefetcher.h"
6 6
7 #include <sys/mman.h> 7 #include <sys/mman.h>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 #include "base/debug/proc_maps_linux.h" 10 #include "base/debug/proc_maps_linux.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 regions.push_back( 87 regions.push_back(
88 base::debug::MappedMemoryRegion{0x3, 0x4, 0, kReadPrivate, "base.apk"}); 88 base::debug::MappedMemoryRegion{0x3, 0x4, 0, kReadPrivate, "base.apk"});
89 std::vector<NativeLibraryPrefetcher::AddressRange> ranges; 89 std::vector<NativeLibraryPrefetcher::AddressRange> ranges;
90 NativeLibraryPrefetcher::FilterLibchromeRangesOnlyIfPossible(regions, 90 NativeLibraryPrefetcher::FilterLibchromeRangesOnlyIfPossible(regions,
91 &ranges); 91 &ranges);
92 EXPECT_EQ(ranges.size(), 1U); 92 EXPECT_EQ(ranges.size(), 1U);
93 EXPECT_EQ(ranges[0].first, 0x6U); 93 EXPECT_EQ(ranges[0].first, 0x6U);
94 EXPECT_EQ(ranges[0].second, 0x7U); 94 EXPECT_EQ(ranges[0].second, 0x7U);
95 } 95 }
96 96
97 TEST(NativeLibraryPrefetcherTest, TestPercentageOfResidentCode) { 97 TEST(NativeLibraryPrefetcherTest, DISABLED_TestPercentageOfResidentCode) {
98 size_t length = 4 * kPageSize; 98 size_t length = 4 * kPageSize;
99 base::SharedMemory shared_mem; 99 base::SharedMemory shared_mem;
100 ASSERT_TRUE(shared_mem.CreateAndMapAnonymous(length)); 100 ASSERT_TRUE(shared_mem.CreateAndMapAnonymous(length));
101 void* address = shared_mem.memory(); 101 void* address = shared_mem.memory();
102 102
103 std::vector<NativeLibraryPrefetcher::AddressRange> ranges = { 103 std::vector<NativeLibraryPrefetcher::AddressRange> ranges = {
104 {reinterpret_cast<uintptr_t>(address), 104 {reinterpret_cast<uintptr_t>(address),
105 reinterpret_cast<uintptr_t>(address) + length}}; 105 reinterpret_cast<uintptr_t>(address) + length}};
106 106
107 // Remove everything. 107 // Remove everything.
108 ASSERT_EQ(0, madvise(address, length, MADV_DONTNEED)); 108 ASSERT_EQ(0, madvise(address, length, MADV_DONTNEED));
109 // TODO(lizeb): If flaky, mock mincore(). 109 // TODO(lizeb): If flaky, mock mincore().
110 EXPECT_EQ(0, NativeLibraryPrefetcher::PercentageOfResidentCode(ranges)); 110 EXPECT_EQ(0, NativeLibraryPrefetcher::PercentageOfResidentCode(ranges));
111 111
112 // Get everything back. 112 // Get everything back.
113 ASSERT_EQ(0, mlock(address, length)); 113 ASSERT_EQ(0, mlock(address, length));
114 EXPECT_EQ(100, NativeLibraryPrefetcher::PercentageOfResidentCode(ranges)); 114 EXPECT_EQ(100, NativeLibraryPrefetcher::PercentageOfResidentCode(ranges));
115 munlock(address, length); 115 munlock(address, length);
116 } 116 }
117 117
118 TEST(NativeLibraryPrefetcherTest, TestPercentageOfResidentCodeTwoRegions) { 118 TEST(NativeLibraryPrefetcherTest,
119 DISABLED_TestPercentageOfResidentCodeTwoRegions) {
119 size_t length = 4 * kPageSize; 120 size_t length = 4 * kPageSize;
120 base::SharedMemory shared_mem; 121 base::SharedMemory shared_mem;
121 ASSERT_TRUE(shared_mem.CreateAndMapAnonymous(length)); 122 ASSERT_TRUE(shared_mem.CreateAndMapAnonymous(length));
122 void* address = shared_mem.memory(); 123 void* address = shared_mem.memory();
123 124
124 size_t length2 = 8 * kPageSize; 125 size_t length2 = 8 * kPageSize;
125 base::SharedMemory shared_mem2; 126 base::SharedMemory shared_mem2;
126 ASSERT_TRUE(shared_mem2.CreateAndMapAnonymous(length2)); 127 ASSERT_TRUE(shared_mem2.CreateAndMapAnonymous(length2));
127 void* address2 = shared_mem2.memory(); 128 void* address2 = shared_mem2.memory();
128 129
(...skipping 14 matching lines...) Expand all
143 EXPECT_EQ(33, NativeLibraryPrefetcher::PercentageOfResidentCode(ranges)); 144 EXPECT_EQ(33, NativeLibraryPrefetcher::PercentageOfResidentCode(ranges));
144 // The second one. 145 // The second one.
145 ASSERT_EQ(0, mlock(address2, length2)); 146 ASSERT_EQ(0, mlock(address2, length2));
146 EXPECT_EQ(100, NativeLibraryPrefetcher::PercentageOfResidentCode(ranges)); 147 EXPECT_EQ(100, NativeLibraryPrefetcher::PercentageOfResidentCode(ranges));
147 munlock(address, length); 148 munlock(address, length);
148 munlock(address2, length); 149 munlock(address2, length);
149 } 150 }
150 151
151 } // namespace android 152 } // namespace android
152 } // namespace base 153 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698