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

Side by Side Diff: syzygy/common/asan_parameters_unittest.cc

Issue 2576003002: Add the ability to defer the initialization of the SyzyAsan crash reporter. (Closed)
Patch Set: Fix comments. Created 3 years, 11 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
« no previous file with comments | « syzygy/common/asan_parameters.cc ('k') | syzygy/instrument/transforms/asan_transform.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 EXPECT_EQ(kDefaultLargeAllocationThreshold, 89 EXPECT_EQ(kDefaultLargeAllocationThreshold,
90 aparams.large_allocation_threshold); 90 aparams.large_allocation_threshold);
91 EXPECT_EQ(kDefaultQuarantineFloodFillRate, 91 EXPECT_EQ(kDefaultQuarantineFloodFillRate,
92 aparams.quarantine_flood_fill_rate); 92 aparams.quarantine_flood_fill_rate);
93 EXPECT_EQ(kDefaultFeatureRandomization, 93 EXPECT_EQ(kDefaultFeatureRandomization,
94 static_cast<bool>(aparams.feature_randomization)); 94 static_cast<bool>(aparams.feature_randomization));
95 EXPECT_EQ(kDefaultPreventDuplicateCorruptionCrashes, 95 EXPECT_EQ(kDefaultPreventDuplicateCorruptionCrashes,
96 static_cast<bool>(aparams.prevent_duplicate_corruption_crashes)); 96 static_cast<bool>(aparams.prevent_duplicate_corruption_crashes));
97 EXPECT_EQ(kDefaultReportInvalidAccesses, 97 EXPECT_EQ(kDefaultReportInvalidAccesses,
98 static_cast<bool>(aparams.report_invalid_accesses)); 98 static_cast<bool>(aparams.report_invalid_accesses));
99 EXPECT_EQ(kDefaultDeferCrashReporterInitialization,
100 static_cast<bool>(aparams.defer_crash_reporter_initialization));
99 } 101 }
100 102
101 TEST(AsanParametersTest, InflateAsanParametersStackIdsPastEnd) { 103 TEST(AsanParametersTest, InflateAsanParametersStackIdsPastEnd) {
102 AsanParameters aparams = {}; 104 AsanParameters aparams = {};
103 SetDefaultAsanParameters(&aparams); 105 SetDefaultAsanParameters(&aparams);
104 106
105 aparams.ignored_stack_ids = reinterpret_cast<AsanStackId*>( 107 aparams.ignored_stack_ids = reinterpret_cast<AsanStackId*>(
106 &aparams + 2); 108 &aparams + 2);
107 109
108 InflatedAsanParameters iparams; 110 InflatedAsanParameters iparams;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 EXPECT_EQ(kDefaultLargeAllocationThreshold, 246 EXPECT_EQ(kDefaultLargeAllocationThreshold,
245 iparams.large_allocation_threshold); 247 iparams.large_allocation_threshold);
246 EXPECT_EQ(kDefaultQuarantineFloodFillRate, 248 EXPECT_EQ(kDefaultQuarantineFloodFillRate,
247 iparams.quarantine_flood_fill_rate); 249 iparams.quarantine_flood_fill_rate);
248 EXPECT_EQ(kDefaultFeatureRandomization, 250 EXPECT_EQ(kDefaultFeatureRandomization,
249 static_cast<bool>(iparams.feature_randomization)); 251 static_cast<bool>(iparams.feature_randomization));
250 EXPECT_EQ(kDefaultPreventDuplicateCorruptionCrashes, 252 EXPECT_EQ(kDefaultPreventDuplicateCorruptionCrashes,
251 static_cast<bool>(iparams.prevent_duplicate_corruption_crashes)); 253 static_cast<bool>(iparams.prevent_duplicate_corruption_crashes));
252 EXPECT_EQ(kDefaultReportInvalidAccesses, 254 EXPECT_EQ(kDefaultReportInvalidAccesses,
253 static_cast<bool>(iparams.report_invalid_accesses)); 255 static_cast<bool>(iparams.report_invalid_accesses));
256 EXPECT_EQ(kDefaultDeferCrashReporterInitialization,
257 static_cast<bool>(iparams.defer_crash_reporter_initialization));
254 } 258 }
255 259
256 TEST(AsanParametersTest, ParseAsanParametersMaximal) { 260 TEST(AsanParametersTest, ParseAsanParametersMaximal) {
257 static const wchar_t kParams[] = 261 static const wchar_t kParams[] =
258 L"--quarantine_size=1024 " 262 L"--quarantine_size=1024 "
259 L"--quarantine_block_size=256 " 263 L"--quarantine_block_size=256 "
260 L"--trailer_padding_size=100 " 264 L"--trailer_padding_size=100 "
261 L"--compression_reporting_period=324 " 265 L"--compression_reporting_period=324 "
262 L"--bottom_frames_to_skip=5 " 266 L"--bottom_frames_to_skip=5 "
263 L"--max_num_frames=27 " 267 L"--max_num_frames=27 "
264 L"--ignored_stack_ids=0X1;0xDEADBEEF;0xBAADF00D;CAFEBABE " 268 L"--ignored_stack_ids=0X1;0xDEADBEEF;0xBAADF00D;CAFEBABE "
265 L"--exit_on_failure " 269 L"--exit_on_failure "
266 L"--no_check_heap_on_failure " 270 L"--no_check_heap_on_failure "
267 L"--minidump_on_failure " 271 L"--minidump_on_failure "
268 L"--no_log_as_text " 272 L"--no_log_as_text "
269 L"--disable_breakpad " 273 L"--disable_breakpad "
270 L"--allocation_guard_rate=0.6 " 274 L"--allocation_guard_rate=0.6 "
271 L"--ignored_as_it_doesnt_exist " 275 L"--ignored_as_it_doesnt_exist "
272 L"--zebra_block_heap_size=8388608 " 276 L"--zebra_block_heap_size=8388608 "
273 L"--zebra_block_heap_quarantine_ratio=0.5 " 277 L"--zebra_block_heap_quarantine_ratio=0.5 "
274 L"--enable_zebra_block_heap " 278 L"--enable_zebra_block_heap "
275 L"--disable_large_block_heap " 279 L"--disable_large_block_heap "
276 L"--enable_allocation_filter " 280 L"--enable_allocation_filter "
277 L"--large_allocation_threshold=4096 " 281 L"--large_allocation_threshold=4096 "
278 L"--quarantine_flood_fill_rate=0.25 " 282 L"--quarantine_flood_fill_rate=0.25 "
279 L"--enable_feature_randomization " 283 L"--enable_feature_randomization "
280 L"--prevent_duplicate_corruption_crashes " 284 L"--prevent_duplicate_corruption_crashes "
281 L"--report_invalid_accesses"; 285 L"--report_invalid_accesses "
286 L"--defer_crash_reporter_initialization";
282 287
283 InflatedAsanParameters iparams; 288 InflatedAsanParameters iparams;
284 SetDefaultAsanParameters(&iparams); 289 SetDefaultAsanParameters(&iparams);
285 EXPECT_TRUE(ParseAsanParameters(kParams, &iparams)); 290 EXPECT_TRUE(ParseAsanParameters(kParams, &iparams));
286 291
287 EXPECT_EQ(sizeof(AsanParameters), iparams.size); 292 EXPECT_EQ(sizeof(AsanParameters), iparams.size);
288 EXPECT_EQ(kAsanParametersVersion, iparams.version); 293 EXPECT_EQ(kAsanParametersVersion, iparams.version);
289 EXPECT_EQ(1024, iparams.quarantine_size); 294 EXPECT_EQ(1024, iparams.quarantine_size);
290 EXPECT_EQ(324, iparams.reporting_period); 295 EXPECT_EQ(324, iparams.reporting_period);
291 EXPECT_EQ(5, iparams.bottom_frames_to_skip); 296 EXPECT_EQ(5, iparams.bottom_frames_to_skip);
(...skipping 14 matching lines...) Expand all
306 EXPECT_FALSE(static_cast<bool>(iparams.deprecated_enable_ctmalloc)); 311 EXPECT_FALSE(static_cast<bool>(iparams.deprecated_enable_ctmalloc));
307 EXPECT_TRUE(static_cast<bool>(iparams.enable_zebra_block_heap)); 312 EXPECT_TRUE(static_cast<bool>(iparams.enable_zebra_block_heap));
308 EXPECT_FALSE(static_cast<bool>(iparams.enable_large_block_heap)); 313 EXPECT_FALSE(static_cast<bool>(iparams.enable_large_block_heap));
309 EXPECT_TRUE(static_cast<bool>(iparams.enable_allocation_filter)); 314 EXPECT_TRUE(static_cast<bool>(iparams.enable_allocation_filter));
310 EXPECT_EQ(4096, iparams.large_allocation_threshold); 315 EXPECT_EQ(4096, iparams.large_allocation_threshold);
311 EXPECT_EQ(0.25f, iparams.quarantine_flood_fill_rate); 316 EXPECT_EQ(0.25f, iparams.quarantine_flood_fill_rate);
312 EXPECT_EQ(true, static_cast<bool>(iparams.feature_randomization)); 317 EXPECT_EQ(true, static_cast<bool>(iparams.feature_randomization));
313 EXPECT_EQ(true, static_cast<bool>( 318 EXPECT_EQ(true, static_cast<bool>(
314 iparams.prevent_duplicate_corruption_crashes)); 319 iparams.prevent_duplicate_corruption_crashes));
315 EXPECT_EQ(true, static_cast<bool>(iparams.report_invalid_accesses)); 320 EXPECT_EQ(true, static_cast<bool>(iparams.report_invalid_accesses));
321 EXPECT_EQ(true,
322 static_cast<bool>(iparams.defer_crash_reporter_initialization));
316 } 323 }
317 324
318 } // namespace common 325 } // namespace common
OLDNEW
« no previous file with comments | « syzygy/common/asan_parameters.cc ('k') | syzygy/instrument/transforms/asan_transform.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698