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

Side by Side Diff: syzygy/agent/asan/block_unittest.cc

Issue 2527533003: Make SyzyAsan support the allocation > 1GB (Closed)
Patch Set: Move the limit to block.h/cc Created 4 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
OLDNEW
1 // Copyright 2014 Google Inc. All Rights Reserved. 1 // Copyright 2014 Google Inc. All Rights Reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 EXPECT_EQ(BuildBlockLayout(8, 120, 24, 0, 64, 4, 28), layout); 185 EXPECT_EQ(BuildBlockLayout(8, 120, 24, 0, 64, 4, 28), layout);
186 186
187 EXPECT_TRUE(BlockPlanLayout(8, 8, 61, 0, 0, &layout)); 187 EXPECT_TRUE(BlockPlanLayout(8, 8, 61, 0, 0, &layout));
188 EXPECT_EQ(BuildBlockLayout(8, 120, 24, 0, 61, 7, 28), layout); 188 EXPECT_EQ(BuildBlockLayout(8, 120, 24, 0, 61, 7, 28), layout);
189 189
190 // Plan a layout that would use guard pages. 190 // Plan a layout that would use guard pages.
191 EXPECT_TRUE(BlockPlanLayout(4096, 8, 100, 4096, 4096, &layout)); 191 EXPECT_TRUE(BlockPlanLayout(4096, 8, 100, 4096, 4096, &layout));
192 EXPECT_EQ(BuildBlockLayout(4096, 3 * 4096, 24, 8064, 100, 4072, 28), layout); 192 EXPECT_EQ(BuildBlockLayout(4096, 3 * 4096, 24, 8064, 100, 4072, 28), layout);
193 #endif 193 #endif
194 194
195 // Plan a layout with an invalid size, this should fail. 195 // Plan some layouts with an invalid size, this should fail.
196 EXPECT_FALSE(BlockPlanLayout(8, 8, kBlockMaxAllocSize + 1, 0, 0, &layout));
196 EXPECT_FALSE(BlockPlanLayout(8, 8, 0xffffffff, 0, 0, &layout)); 197 EXPECT_FALSE(BlockPlanLayout(8, 8, 0xffffffff, 0, 0, &layout));
197 } 198 }
198 199
199 TEST_F(BlockTest, EndToEnd) { 200 TEST_F(BlockTest, EndToEnd) {
200 BlockLayout layout = {}; 201 BlockLayout layout = {};
201 BlockInfo block_info = {}; 202 BlockInfo block_info = {};
202 203
203 EXPECT_TRUE(BlockPlanLayout(8, 8, 4, 0, 0, &layout)); 204 EXPECT_TRUE(BlockPlanLayout(8, 8, 4, 0, 0, &layout));
204 std::vector<uint8_t> block_data(layout.block_size); 205 std::vector<uint8_t> block_data(layout.block_size);
205 BlockInitialize(layout, block_data.data(), &block_info); 206 BlockInitialize(layout, block_data.data(), &block_info);
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 BlockBitFlipsFixChecksum(QUARANTINED_BLOCK, block1.block_info, 0)); 804 BlockBitFlipsFixChecksum(QUARANTINED_BLOCK, block1.block_info, 0));
804 EXPECT_TRUE( 805 EXPECT_TRUE(
805 BlockBitFlipsFixChecksum(QUARANTINED_BLOCK, block1.block_info, 3)); 806 BlockBitFlipsFixChecksum(QUARANTINED_BLOCK, block1.block_info, 3));
806 flips = BlockBitFlipsRequired(QUARANTINED_BLOCK, block1.block_info, 3); 807 flips = BlockBitFlipsRequired(QUARANTINED_BLOCK, block1.block_info, 3);
807 EXPECT_LT(0u, flips); 808 EXPECT_LT(0u, flips);
808 EXPECT_GE(3u, flips); 809 EXPECT_GE(3u, flips);
809 } 810 }
810 811
811 } // namespace asan 812 } // namespace asan
812 } // namespace agent 813 } // namespace agent
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698