OLD | NEW |
---|---|
1 // Copyright 2013 Google Inc. All Rights Reserved. | 1 // Copyright 2013 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
340 ModuleInformationSet; | 340 ModuleInformationSet; |
341 | 341 |
342 using grinder::grinders::ProfileGrinder::PartData; | 342 using grinder::grinders::ProfileGrinder::PartData; |
343 using grinder::grinders::ProfileGrinder::PartDataMap; | 343 using grinder::grinders::ProfileGrinder::PartDataMap; |
344 using grinder::grinders::ProfileGrinder::PartKey; | 344 using grinder::grinders::ProfileGrinder::PartKey; |
345 | 345 |
346 using grinder::grinders::ProfileGrinder::modules_; | 346 using grinder::grinders::ProfileGrinder::modules_; |
347 using grinder::grinders::ProfileGrinder::parts_; | 347 using grinder::grinders::ProfileGrinder::parts_; |
348 }; | 348 }; |
349 | 349 |
350 enum InstrumentationMode { | |
351 SYZYGY, | |
352 CLANG, | |
Sébastien Marchand
2017/08/03 18:12:59
I'd remove CLANG for now.
| |
353 }; | |
354 | |
350 class LenientInstrumentAppIntegrationTest : public testing::PELibUnitTest { | 355 class LenientInstrumentAppIntegrationTest : public testing::PELibUnitTest { |
351 public: | 356 public: |
352 typedef testing::PELibUnitTest Super; | 357 typedef testing::PELibUnitTest Super; |
353 | 358 |
354 // A callback that gets hooked up to catch exceptions in the RTL. | 359 // A callback that gets hooked up to catch exceptions in the RTL. |
355 MOCK_METHOD1(OnExceptionCallback, void(EXCEPTION_POINTERS*)); | 360 MOCK_METHOD1(OnExceptionCallback, void(EXCEPTION_POINTERS*)); |
356 | 361 |
357 LenientInstrumentAppIntegrationTest() | 362 LenientInstrumentAppIntegrationTest() |
358 : cmd_line_(base::FilePath(L"instrument.exe")), | 363 : cmd_line_(base::FilePath(L"instrument.exe")), |
359 test_impl_(test_app_.implementation()), | 364 test_impl_(test_app_.implementation()), |
(...skipping 12 matching lines...) Expand all Loading... | |
372 this->CreateTemporaryDir(&temp_dir_); | 377 this->CreateTemporaryDir(&temp_dir_); |
373 stdin_path_ = temp_dir_.Append(L"NUL"); | 378 stdin_path_ = temp_dir_.Append(L"NUL"); |
374 stdout_path_ = temp_dir_.Append(L"stdout.txt"); | 379 stdout_path_ = temp_dir_.Append(L"stdout.txt"); |
375 stderr_path_ = temp_dir_.Append(L"stderr.txt"); | 380 stderr_path_ = temp_dir_.Append(L"stderr.txt"); |
376 InitStreams(stdin_path_, stdout_path_, stderr_path_); | 381 InitStreams(stdin_path_, stdout_path_, stderr_path_); |
377 | 382 |
378 // Initialize the (potential) input and output path values. | 383 // Initialize the (potential) input and output path values. |
379 base::FilePath abs_input_dll_path_ = | 384 base::FilePath abs_input_dll_path_ = |
380 testing::GetExeRelativePath(testing::kIntegrationTestsDllName); | 385 testing::GetExeRelativePath(testing::kIntegrationTestsDllName); |
381 input_dll_path_ = testing::GetRelativePath(abs_input_dll_path_); | 386 input_dll_path_ = testing::GetRelativePath(abs_input_dll_path_); |
382 output_dll_path_ = temp_dir_.Append(input_dll_path_.BaseName()); | 387 test_dll_path_ = temp_dir_.Append(input_dll_path_.BaseName()); |
383 | 388 |
384 // Initialize call_service output directory for produced trace files. | 389 // Initialize call_service output directory for produced trace files. |
385 traces_dir_ = temp_dir_.Append(L"traces"); | 390 traces_dir_ = temp_dir_.Append(L"traces"); |
386 | 391 |
387 // Initialize call_service session id. | 392 // Initialize call_service session id. |
388 service_.SetEnvironment(); | 393 service_.SetEnvironment(); |
389 | 394 |
390 ASSERT_NO_FATAL_FAILURE(ConfigureTestApp(&test_app_)); | 395 ASSERT_NO_FATAL_FAILURE(ConfigureTestApp(&test_app_)); |
391 } | 396 } |
392 | 397 |
(...skipping 22 matching lines...) Expand all Loading... | |
415 } | 420 } |
416 | 421 |
417 void UnloadDll() { | 422 void UnloadDll() { |
418 module_.Reset(NULL); | 423 module_.Reset(NULL); |
419 } | 424 } |
420 | 425 |
421 // Runs an instrumentation pass in the given mode and validates that the | 426 // Runs an instrumentation pass in the given mode and validates that the |
422 // resulting output DLL loads. | 427 // resulting output DLL loads. |
423 void EndToEndTest(const std::string& mode) { | 428 void EndToEndTest(const std::string& mode) { |
424 cmd_line_.AppendSwitchPath("input-image", input_dll_path_); | 429 cmd_line_.AppendSwitchPath("input-image", input_dll_path_); |
425 cmd_line_.AppendSwitchPath("output-image", output_dll_path_); | 430 cmd_line_.AppendSwitchPath("output-image", test_dll_path_); |
426 cmd_line_.AppendSwitchASCII("mode", mode); | 431 cmd_line_.AppendSwitchASCII("mode", mode); |
427 | 432 |
428 // Create the instrumented DLL. | 433 // Create the instrumented DLL. |
429 application::Application<instrument::InstrumentApp> app; | 434 application::Application<instrument::InstrumentApp> app; |
430 ASSERT_NO_FATAL_FAILURE(ConfigureTestApp(&app)); | 435 ASSERT_NO_FATAL_FAILURE(ConfigureTestApp(&app)); |
431 ASSERT_EQ(0, app.Run()); | 436 ASSERT_EQ(0, app.Run()); |
432 | 437 |
433 // Validate that the test dll loads post instrumentation. | 438 // Validate that the test dll loads post instrumentation. |
434 ASSERT_NO_FATAL_FAILURE(LoadTestDll(output_dll_path_, &module_)); | 439 ASSERT_NO_FATAL_FAILURE(LoadTestDll(test_dll_path_, &module_)); |
435 } | 440 } |
436 | 441 |
437 // Invoke a test function inside test_dll by addressing it with a test id. | 442 // Invoke a test function inside test_dll by addressing it with a test id. |
438 // Returns the value resulting from the test function execution. | 443 // Returns the value resulting from the test function execution. |
439 unsigned int InvokeTestDllFunction(testing::EndToEndTestId test) { | 444 unsigned int InvokeTestDllFunction(testing::EndToEndTestId test) { |
440 // Load the exported 'function_name' function. | 445 // Load the exported 'function_name' function. |
441 typedef unsigned int (CALLBACK* TestDllFuncs)(unsigned int); | 446 typedef unsigned int (CALLBACK* TestDllFuncs)(unsigned int); |
442 TestDllFuncs func = reinterpret_cast<TestDllFuncs>( | 447 TestDllFuncs func = reinterpret_cast<TestDllFuncs>( |
443 ::GetProcAddress(module_, "EndToEndTest")); | 448 ::GetProcAddress(module_, "EndToEndTest")); |
444 DCHECK(func != NULL); | 449 DCHECK(func != NULL); |
445 | 450 |
446 // Invoke it, and returns its value. | 451 // Invoke it, and returns its value. |
447 return func(test); | 452 return func(test); |
448 } | 453 } |
449 | 454 |
450 int RunOutOfProcessFunction(const base::string16& harness_name, | 455 int RunOutOfProcessFunction(const base::string16& harness_name, |
451 testing::EndToEndTestId test, | 456 testing::EndToEndTestId test, |
452 bool expect_exception) { | 457 bool expect_exception) { |
453 base::FilePath harness = testing::GetExeRelativePath(harness_name.c_str()); | 458 base::FilePath harness = testing::GetExeRelativePath(harness_name.c_str()); |
454 base::CommandLine cmd_line(harness); | 459 base::CommandLine cmd_line(harness); |
455 cmd_line.AppendSwitchASCII("test", base::StringPrintf("%d", test)); | 460 cmd_line.AppendSwitchASCII("test", base::StringPrintf("%d", test)); |
456 cmd_line.AppendSwitchPath("dll", output_dll_path_); | 461 cmd_line.AppendSwitchPath("dll", test_dll_path_); |
457 if (expect_exception) | 462 if (expect_exception) |
458 cmd_line.AppendSwitch("expect-exception"); | 463 cmd_line.AppendSwitch("expect-exception"); |
459 | 464 |
460 base::LaunchOptions options; | 465 base::LaunchOptions options; |
461 base::Process process = base::LaunchProcess(cmd_line, options); | 466 base::Process process = base::LaunchProcess(cmd_line, options); |
462 EXPECT_TRUE(process.IsValid()); | 467 EXPECT_TRUE(process.IsValid()); |
463 | 468 |
464 int exit_code = 0; | 469 int exit_code = 0; |
465 EXPECT_TRUE(process.WaitForExit(&exit_code)); | 470 EXPECT_TRUE(process.WaitForExit(&exit_code)); |
466 return exit_code; | 471 return exit_code; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
610 InvokeTestDllFunction(test); | 615 InvokeTestDllFunction(test); |
611 if (unload) | 616 if (unload) |
612 UnloadDll(); | 617 UnloadDll(); |
613 | 618 |
614 // If this appears to have failed then retry it for all but the last | 619 // If this appears to have failed then retry it for all but the last |
615 // attempt. Some tests have a non-zero chance of failure, but their | 620 // attempt. Some tests have a non-zero chance of failure, but their |
616 // chances of failing repeatedly are infinitesimally small. | 621 // chances of failing repeatedly are infinitesimally small. |
617 if (asan_error_count == 0 && i + 1 < max_tries) { | 622 if (asan_error_count == 0 && i + 1 < max_tries) { |
618 // If the module was unloaded and the test is retrying, then reload it. | 623 // If the module was unloaded and the test is retrying, then reload it. |
619 if (unload) | 624 if (unload) |
620 EXPECT_NO_FATAL_FAILURE(LoadTestDll(output_dll_path_, &module_)); | 625 EXPECT_NO_FATAL_FAILURE(LoadTestDll(test_dll_path_, &module_)); |
621 continue; | 626 continue; |
622 } | 627 } |
623 | 628 |
624 if (asan_error_count == 0 || | 629 if (asan_error_count == 0 || |
625 last_asan_error.error_type != kind || | 630 last_asan_error.error_type != kind || |
626 last_asan_error.access_mode != mode || | 631 last_asan_error.access_mode != mode || |
627 last_asan_error.access_size != size) { | 632 last_asan_error.access_size != size) { |
628 return false; | 633 return false; |
629 } | 634 } |
630 break; | 635 break; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
873 | 878 |
874 void AsanLargeBlockHeapTests(bool expect_exception) { | 879 void AsanLargeBlockHeapTests(bool expect_exception) { |
875 OutOfProcessAsanErrorCheckAndValidateLog( | 880 OutOfProcessAsanErrorCheckAndValidateLog( |
876 testing::kAsanReadLargeAllocationTrailerBeforeFree, expect_exception, | 881 testing::kAsanReadLargeAllocationTrailerBeforeFree, expect_exception, |
877 kAsanAccessViolationLog, kAsanHeapBufferOverflow); | 882 kAsanAccessViolationLog, kAsanHeapBufferOverflow); |
878 OutOfProcessAsanErrorCheckAndValidateLog( | 883 OutOfProcessAsanErrorCheckAndValidateLog( |
879 testing::kAsanReadLargeAllocationBodyAfterFree, true, | 884 testing::kAsanReadLargeAllocationBodyAfterFree, true, |
880 kAsanAccessViolationLog, kAsanHeapUseAfterFree); | 885 kAsanAccessViolationLog, kAsanHeapUseAfterFree); |
881 } | 886 } |
882 | 887 |
883 void AsanZebraHeapTest(bool enabled); | |
884 | |
885 void BBEntryInvokeTestDll() { | 888 void BBEntryInvokeTestDll() { |
886 EXPECT_EQ(42, InvokeTestDllFunction(testing::kBBEntryCallOnce)); | 889 EXPECT_EQ(42, InvokeTestDllFunction(testing::kBBEntryCallOnce)); |
887 EXPECT_EQ(42, InvokeTestDllFunction(testing::kBBEntryCallTree)); | 890 EXPECT_EQ(42, InvokeTestDllFunction(testing::kBBEntryCallTree)); |
888 EXPECT_EQ(42, InvokeTestDllFunction(testing::kBBEntryCallRecursive)); | 891 EXPECT_EQ(42, InvokeTestDllFunction(testing::kBBEntryCallRecursive)); |
889 } | 892 } |
890 | 893 |
891 void ProfileInvokeTestDll() { | 894 void ProfileInvokeTestDll() { |
892 EXPECT_EQ(5, InvokeTestDllFunction(testing::kProfileCallExport)); | 895 EXPECT_EQ(5, InvokeTestDllFunction(testing::kProfileCallExport)); |
893 // Save the RVA of one of the invoked functions for testing later. | 896 // Save the RVA of one of the invoked functions for testing later. |
894 get_my_rva_ = InvokeTestDllFunction(testing::kProfileGetMyRVA); | 897 get_my_rva_ = InvokeTestDllFunction(testing::kProfileGetMyRVA); |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1262 base::FilePath temp_dir_; | 1265 base::FilePath temp_dir_; |
1263 base::FilePath stdin_path_; | 1266 base::FilePath stdin_path_; |
1264 base::FilePath stdout_path_; | 1267 base::FilePath stdout_path_; |
1265 base::FilePath stderr_path_; | 1268 base::FilePath stderr_path_; |
1266 // @} | 1269 // @} |
1267 | 1270 |
1268 // @name Command-line, parameters and outputs. | 1271 // @name Command-line, parameters and outputs. |
1269 // @{ | 1272 // @{ |
1270 base::CommandLine cmd_line_; | 1273 base::CommandLine cmd_line_; |
1271 base::FilePath input_dll_path_; | 1274 base::FilePath input_dll_path_; |
1272 base::FilePath output_dll_path_; | 1275 base::FilePath test_dll_path_; |
1273 base::FilePath traces_dir_; | 1276 base::FilePath traces_dir_; |
1274 // @} | 1277 // @} |
1275 | 1278 |
1276 // The test_dll module. | 1279 // The test_dll module. |
1277 testing::ScopedHMODULE module_; | 1280 testing::ScopedHMODULE module_; |
1278 | 1281 |
1279 // Our call trace service process instance. | 1282 // Our call trace service process instance. |
1280 testing::CallTraceService service_; | 1283 testing::CallTraceService service_; |
1281 | 1284 |
1282 // Decomposed image. | 1285 // Decomposed image. |
1283 pe::PEFile pe_image_; | 1286 pe::PEFile pe_image_; |
1284 pe::ImageLayout image_layout_; | 1287 pe::ImageLayout image_layout_; |
1285 block_graph::BlockGraph block_graph_; | 1288 block_graph::BlockGraph block_graph_; |
1286 uint32_t get_my_rva_; | 1289 uint32_t get_my_rva_; |
1287 }; | 1290 }; |
1291 | |
1292 class ParametrizedLenientInstrumentAppIntegrationTest | |
Sébastien Marchand
2017/08/03 18:12:59
Add a comment to describe the purpose of this clas
| |
1293 : public LenientInstrumentAppIntegrationTest, | |
1294 public ::testing::WithParamInterface<InstrumentationMode> { | |
1295 public: | |
1296 void SetUp() { | |
1297 LenientInstrumentAppIntegrationTest::SetUp(); | |
1298 if (GetParam() == CLANG) { | |
Sébastien Marchand
2017/08/03 18:12:59
Remove this, you'll add this once we do want to ru
| |
1299 test_dll_path_ = | |
1300 testing::GetExeRelativePath(testing::kIntegrationTestsClangDllName); | |
1301 } | |
1302 } | |
1303 | |
1304 void EndToEndTest(const std::string& mode) { | |
1305 if (GetParam() == SYZYGY) { | |
1306 LenientInstrumentAppIntegrationTest::EndToEndTest(mode); | |
1307 } else if (GetParam() == CLANG) { | |
Sébastien Marchand
2017/08/03 18:12:59
Ditto
| |
1308 ASSERT_NO_FATAL_FAILURE(LoadTestDll(test_dll_path_, &module_)); | |
1309 } | |
1310 } | |
1311 void AsanZebraHeapTest(bool enabled); | |
1312 | |
1313 void EndToEndCheckTestDll() { | |
1314 if (GetParam() == SYZYGY) { | |
Sébastien Marchand
2017/08/03 18:12:59
Ditto
| |
1315 LenientInstrumentAppIntegrationTest::EndToEndCheckTestDll(); | |
1316 } | |
1317 } | |
1318 }; | |
1319 | |
1320 typedef testing::StrictMock<ParametrizedLenientInstrumentAppIntegrationTest> | |
1321 ParametrizedInstrumentAppIntegrationTest; | |
1322 | |
1288 typedef testing::StrictMock<LenientInstrumentAppIntegrationTest> | 1323 typedef testing::StrictMock<LenientInstrumentAppIntegrationTest> |
1289 InstrumentAppIntegrationTest; | 1324 InstrumentAppIntegrationTest; |
1290 | 1325 |
1291 typedef std::map<std::string, size_t> FunctionOffsetMap; | 1326 typedef std::map<std::string, size_t> FunctionOffsetMap; |
1292 | 1327 |
1293 // A utility transform for extracting call site offsets from blocks. | 1328 // A utility transform for extracting call site offsets from blocks. |
1294 // Used by GetCallOffsets and ZebraBlockHeap tests. | 1329 // Used by GetCallOffsets and ZebraBlockHeap tests. |
1295 class ExtractCallTransform | 1330 class ExtractCallTransform |
1296 : public block_graph::BasicBlockSubGraphTransformInterface { | 1331 : public block_graph::BasicBlockSubGraphTransformInterface { |
1297 public: | 1332 public: |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1363 // Apply our dummy transform which simply extracts call addresses. | 1398 // Apply our dummy transform which simply extracts call addresses. |
1364 { | 1399 { |
1365 ExtractCallTransform bbtx(map); | 1400 ExtractCallTransform bbtx(map); |
1366 block_graph::transforms::ChainedBasicBlockTransforms tx; | 1401 block_graph::transforms::ChainedBasicBlockTransforms tx; |
1367 tx.AppendTransform(&bbtx); | 1402 tx.AppendTransform(&bbtx); |
1368 ASSERT_TRUE(block_graph::ApplyBlockGraphTransform( | 1403 ASSERT_TRUE(block_graph::ApplyBlockGraphTransform( |
1369 &tx, &policy, &bg, header)); | 1404 &tx, &policy, &bg, header)); |
1370 } | 1405 } |
1371 } | 1406 } |
1372 | 1407 |
1373 void LenientInstrumentAppIntegrationTest::AsanZebraHeapTest(bool enabled) { | 1408 void ParametrizedLenientInstrumentAppIntegrationTest::AsanZebraHeapTest( |
1409 bool enabled) { | |
1374 // Find the offset of the call we want to instrument. | 1410 // Find the offset of the call we want to instrument. |
1375 static const char kTest1[] = | 1411 static const char kTest1[] = |
1376 "testing::AsanReadPageAllocationTrailerBeforeFree"; | 1412 "testing::AsanReadPageAllocationTrailerBeforeFree"; |
1377 static const char kTest2[] = | 1413 static const char kTest2[] = |
1378 "testing::AsanWritePageAllocationBodyAfterFree"; | 1414 "testing::AsanWritePageAllocationBodyAfterFree"; |
1379 FunctionOffsetMap map({{kTest1, -1}, {kTest2, -1}}); | 1415 FunctionOffsetMap map({{kTest1, -1}, {kTest2, -1}}); |
1380 ASSERT_NO_FATAL_FAILURE(GetCallOffsets(input_dll_path_, &map)); | 1416 ASSERT_NO_FATAL_FAILURE(GetCallOffsets(input_dll_path_, &map)); |
1381 | 1417 |
1382 // Create an allocation filter. | 1418 // Create an allocation filter. |
1383 base::FilePath filter_path = temp_dir_.AppendASCII("allocation_filter.json"); | 1419 base::FilePath filter_path = temp_dir_.AppendASCII("allocation_filter.json"); |
(...skipping 16 matching lines...) Expand all Loading... | |
1400 OutOfProcessAsanErrorCheckAndValidateLog( | 1436 OutOfProcessAsanErrorCheckAndValidateLog( |
1401 testing::kAsanReadPageAllocationTrailerBeforeFreeAllocation, enabled, | 1437 testing::kAsanReadPageAllocationTrailerBeforeFreeAllocation, enabled, |
1402 kAsanAccessViolationLog, kAsanHeapBufferOverflow); | 1438 kAsanAccessViolationLog, kAsanHeapBufferOverflow); |
1403 OutOfProcessAsanErrorCheckAndValidateLog( | 1439 OutOfProcessAsanErrorCheckAndValidateLog( |
1404 testing::kAsanWritePageAllocationBodyAfterFree, enabled, | 1440 testing::kAsanWritePageAllocationBodyAfterFree, enabled, |
1405 kAsanAccessViolationLog, kAsanHeapUseAfterFree); | 1441 kAsanAccessViolationLog, kAsanHeapUseAfterFree); |
1406 } | 1442 } |
1407 | 1443 |
1408 } // namespace | 1444 } // namespace |
1409 | 1445 |
1410 TEST_F(InstrumentAppIntegrationTest, AsanEndToEnd) { | 1446 TEST_P(ParametrizedInstrumentAppIntegrationTest, AsanEndToEnd) { |
1411 // Disable the heap checking as this is implies touching all the shadow bytes | 1447 // Disable the heap checking as this is implies touching all the shadow bytes |
1412 // and this make those tests really slow. | 1448 // and this make those tests really slow. |
1413 cmd_line_.AppendSwitchASCII("asan-rtl-options", "--no_check_heap_on_failure"); | 1449 cmd_line_.AppendSwitchASCII("asan-rtl-options", "--no_check_heap_on_failure"); |
1414 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1450 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
1415 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1451 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
1416 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | 1452 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
1417 ASSERT_NO_FATAL_FAILURE(CheckTestDllImportsRedirected()); | 1453 ASSERT_NO_FATAL_FAILURE(CheckTestDllImportsRedirected()); |
1418 } | 1454 } |
1419 | 1455 |
1420 TEST_F(InstrumentAppIntegrationTest, AsanEndToEndNoLiveness) { | 1456 TEST_P(ParametrizedInstrumentAppIntegrationTest, AsanEndToEndNoLiveness) { |
1421 // Disable the heap checking as this is implies touching all the shadow bytes | 1457 // Disable the heap checking as this is implies touching all the shadow bytes |
1422 // and this make those tests really slow. | 1458 // and this make those tests really slow. |
1423 cmd_line_.AppendSwitchASCII("asan-rtl-options", "--no_check_heap_on_failure"); | 1459 cmd_line_.AppendSwitchASCII("asan-rtl-options", "--no_check_heap_on_failure"); |
1424 cmd_line_.AppendSwitch("no-liveness-analysis"); | 1460 cmd_line_.AppendSwitch("no-liveness-analysis"); |
1425 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1461 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
1426 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1462 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
1427 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | 1463 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
1428 } | 1464 } |
1429 | 1465 |
1430 TEST_F(InstrumentAppIntegrationTest, AsanEndToEndNoRedundancyAnalysis) { | 1466 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
1467 AsanEndToEndNoRedundancyAnalysis) { | |
1431 // Disable the heap checking as this is implies touching all the shadow bytes | 1468 // Disable the heap checking as this is implies touching all the shadow bytes |
1432 // and this make those tests really slow. | 1469 // and this make those tests really slow. |
1433 cmd_line_.AppendSwitchASCII("asan-rtl-options", "--no_check_heap_on_failure"); | 1470 cmd_line_.AppendSwitchASCII("asan-rtl-options", "--no_check_heap_on_failure"); |
1434 cmd_line_.AppendSwitch("no-redundancy-analysis"); | 1471 cmd_line_.AppendSwitch("no-redundancy-analysis"); |
1435 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1472 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
1436 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1473 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
1437 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | 1474 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
1438 } | 1475 } |
1439 | 1476 |
1440 TEST_F(InstrumentAppIntegrationTest, AsanEndToEndNoFunctionInterceptors) { | 1477 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
1478 AsanEndToEndNoFunctionInterceptors) { | |
1441 // Disable the heap checking as this is implies touching all the shadow bytes | 1479 // Disable the heap checking as this is implies touching all the shadow bytes |
1442 // and this make those tests really slow. | 1480 // and this make those tests really slow. |
1443 cmd_line_.AppendSwitchASCII("asan-rtl-options", "--no_check_heap_on_failure"); | 1481 cmd_line_.AppendSwitchASCII("asan-rtl-options", "--no_check_heap_on_failure"); |
1444 cmd_line_.AppendSwitch("no-interceptors"); | 1482 cmd_line_.AppendSwitch("no-interceptors"); |
1445 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1483 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
1446 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1484 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
1447 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | 1485 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
1448 } | 1486 } |
1449 | 1487 |
1450 TEST_F(InstrumentAppIntegrationTest, AsanEndToEndWithRtlOptions) { | 1488 TEST_P(ParametrizedInstrumentAppIntegrationTest, AsanEndToEndWithRtlOptions) { |
1451 cmd_line_.AppendSwitchASCII( | 1489 cmd_line_.AppendSwitchASCII( |
1452 "asan-rtl-options", | 1490 "asan-rtl-options", |
1453 "--quarantine_size=20000000 --quarantine_block_size=1000000 " | 1491 "--quarantine_size=20000000 --quarantine_block_size=1000000 " |
1454 "--no_check_heap_on_failure"); | 1492 "--no_check_heap_on_failure"); |
1455 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1493 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
1456 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1494 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
1457 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | 1495 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
1458 | 1496 |
1459 // Get the active runtime and validate its parameters. | 1497 // Get the active runtime and validate its parameters. |
1460 agent::asan::AsanRuntime* runtime = GetActiveAsanRuntime(); | 1498 agent::asan::AsanRuntime* runtime = GetActiveAsanRuntime(); |
1461 ASSERT_TRUE(runtime != NULL); | 1499 ASSERT_TRUE(runtime != NULL); |
1462 ASSERT_EQ(20000000u, runtime->params().quarantine_size); | 1500 ASSERT_EQ(20000000u, runtime->params().quarantine_size); |
1463 ASSERT_EQ(1000000u, runtime->params().quarantine_block_size); | 1501 ASSERT_EQ(1000000u, runtime->params().quarantine_block_size); |
1464 } | 1502 } |
1465 | 1503 |
1466 TEST_F(InstrumentAppIntegrationTest, | 1504 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
1467 AsanEndToEndWithRtlOptionsOverrideWithEnvironment) { | 1505 AsanEndToEndWithRtlOptionsOverrideWithEnvironment) { |
1468 std::unique_ptr<base::Environment> env(base::Environment::Create()); | 1506 std::unique_ptr<base::Environment> env(base::Environment::Create()); |
1469 ASSERT_NE(env.get(), nullptr); | 1507 ASSERT_NE(env.get(), nullptr); |
1470 env->SetVar(::common::kSyzyAsanOptionsEnvVar, | 1508 env->SetVar(::common::kSyzyAsanOptionsEnvVar, |
1471 "--quarantine_block_size=800000 --ignored_stack_ids=0x1 " | 1509 "--quarantine_block_size=800000 --ignored_stack_ids=0x1 " |
1472 "--no_check_heap_on_failure"); | 1510 "--no_check_heap_on_failure"); |
1473 cmd_line_.AppendSwitchASCII( | 1511 cmd_line_.AppendSwitchASCII( |
1474 "asan-rtl-options", | 1512 "asan-rtl-options", |
1475 "--quarantine_size=20000000 --quarantine_block_size=1000000 " | 1513 "--quarantine_size=20000000 --quarantine_block_size=1000000 " |
1476 "--ignored_stack_ids=0x2"); | 1514 "--ignored_stack_ids=0x2"); |
1477 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1515 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
1478 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1516 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
1479 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | 1517 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
1480 | 1518 |
1481 // Get the active runtime and validate its parameters. | 1519 // Get the active runtime and validate its parameters. |
1482 agent::asan::AsanRuntime* runtime = GetActiveAsanRuntime(); | 1520 agent::asan::AsanRuntime* runtime = GetActiveAsanRuntime(); |
1483 ASSERT_TRUE(runtime != NULL); | 1521 ASSERT_TRUE(runtime != NULL); |
1484 ASSERT_EQ(20000000u, runtime->params().quarantine_size); | 1522 ASSERT_EQ(20000000u, runtime->params().quarantine_size); |
1485 ASSERT_EQ(800000u, runtime->params().quarantine_block_size); | 1523 ASSERT_EQ(800000u, runtime->params().quarantine_block_size); |
1486 ASSERT_THAT(runtime->params().ignored_stack_ids_set, | 1524 ASSERT_THAT(runtime->params().ignored_stack_ids_set, |
1487 testing::ElementsAre(0x1, 0x2)); | 1525 testing::ElementsAre(0x1, 0x2)); |
1488 | 1526 |
1489 env->UnSetVar(::common::kSyzyAsanOptionsEnvVar); | 1527 env->UnSetVar(::common::kSyzyAsanOptionsEnvVar); |
1490 } | 1528 } |
1491 | 1529 |
1492 TEST_F(InstrumentAppIntegrationTest, FullOptimizedAsanEndToEnd) { | 1530 TEST_P(ParametrizedInstrumentAppIntegrationTest, FullOptimizedAsanEndToEnd) { |
1493 // Disable the heap checking as this implies touching all the shadow bytes | 1531 // Disable the heap checking as this implies touching all the shadow bytes |
1494 // and this make these tests really slow. | 1532 // and this make these tests really slow. |
1495 cmd_line_.AppendSwitchASCII("asan-rtl-options", "--no_check_heap_on_failure"); | 1533 cmd_line_.AppendSwitchASCII("asan-rtl-options", "--no_check_heap_on_failure"); |
1496 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1534 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
1497 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1535 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
1498 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | 1536 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
1499 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckInterceptedFunctions()); | 1537 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckInterceptedFunctions()); |
1500 } | 1538 } |
1501 | 1539 |
1502 TEST_F(InstrumentAppIntegrationTest, | 1540 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
1503 AsanInvalidAccessWithCorruptAllocatedBlockHeader) { | 1541 AsanInvalidAccessWithCorruptAllocatedBlockHeader) { |
1504 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1542 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
1505 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1543 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
1506 OutOfProcessAsanErrorCheckAndValidateLog( | 1544 OutOfProcessAsanErrorCheckAndValidateLog( |
1507 testing::kAsanInvalidAccessWithCorruptAllocatedBlockHeader, true, | 1545 testing::kAsanInvalidAccessWithCorruptAllocatedBlockHeader, true, |
1508 kAsanCorruptHeap, NULL); | 1546 kAsanCorruptHeap, NULL); |
1509 } | 1547 } |
1510 | 1548 |
1511 TEST_F(InstrumentAppIntegrationTest, AsanOverflowCallsCrashForException) { | 1549 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
1550 AsanOverflowCallsCrashForException) { | |
1512 // Asan-detected violations go through CrashForException if it is available. | 1551 // Asan-detected violations go through CrashForException if it is available. |
1513 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1552 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
1514 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1553 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
1515 int exit_code = | 1554 int exit_code = |
1516 RunOutOfProcessFunction(L"crash_for_exception_harness.exe", | 1555 RunOutOfProcessFunction(L"crash_for_exception_harness.exe", |
1517 testing::kAsanRead8BufferOverflow, true); | 1556 testing::kAsanRead8BufferOverflow, true); |
1518 EXPECT_EQ(kExeCrashForExceptionExitCode, exit_code); | 1557 EXPECT_EQ(kExeCrashForExceptionExitCode, exit_code); |
1519 } | 1558 } |
1520 | 1559 |
1521 TEST_F(InstrumentAppIntegrationTest, | 1560 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
1522 AsanInvalidAccessWithCorruptAllocatedBlockTrailer) { | 1561 AsanInvalidAccessWithCorruptAllocatedBlockTrailer) { |
1523 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1562 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
1524 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1563 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
1525 OutOfProcessAsanErrorCheckAndValidateLog( | 1564 OutOfProcessAsanErrorCheckAndValidateLog( |
1526 testing::kAsanInvalidAccessWithCorruptAllocatedBlockTrailer, true, | 1565 testing::kAsanInvalidAccessWithCorruptAllocatedBlockTrailer, true, |
1527 kAsanCorruptHeap, NULL); | 1566 kAsanCorruptHeap, NULL); |
1528 } | 1567 } |
1529 | 1568 |
1530 TEST_F(InstrumentAppIntegrationTest, | 1569 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
1531 AsanInvalidAccessWithCorruptFreedBlock) { | 1570 AsanInvalidAccessWithCorruptFreedBlock) { |
1532 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1571 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
1533 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1572 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
1534 OutOfProcessAsanErrorCheckAndValidateLog( | 1573 OutOfProcessAsanErrorCheckAndValidateLog( |
1535 testing::kAsanInvalidAccessWithCorruptFreedBlock, true, kAsanCorruptHeap, | 1574 testing::kAsanInvalidAccessWithCorruptFreedBlock, true, kAsanCorruptHeap, |
1536 NULL); | 1575 NULL); |
1537 } | 1576 } |
1538 | 1577 |
1539 TEST_F(InstrumentAppIntegrationTest, AsanCorruptBlockWithPageProtections) { | 1578 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
1579 AsanCorruptBlockWithPageProtections) { | |
1540 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1580 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
1541 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1581 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
1542 OutOfProcessAsanErrorCheckAndValidateLog( | 1582 OutOfProcessAsanErrorCheckAndValidateLog( |
1543 testing::kAsanCorruptBlockWithPageProtections, true, | 1583 testing::kAsanCorruptBlockWithPageProtections, true, |
1544 kAsanHeapUseAfterFree, kAsanCorruptHeap); | 1584 kAsanHeapUseAfterFree, kAsanCorruptHeap); |
1545 } | 1585 } |
1546 | 1586 |
1547 TEST_F(InstrumentAppIntegrationTest, SampledAllocationsAsanEndToEnd) { | 1587 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
1588 SampledAllocationsAsanEndToEnd) { | |
1548 cmd_line_.AppendSwitchASCII("asan-rtl-options", | 1589 cmd_line_.AppendSwitchASCII("asan-rtl-options", |
1549 "--allocation_guard_rate=0.5 " | 1590 "--allocation_guard_rate=0.5 " |
1550 "--no_check_heap_on_failure"); | 1591 "--no_check_heap_on_failure"); |
1551 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1592 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
1552 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1593 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
1553 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckSampledAllocations()); | 1594 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckSampledAllocations()); |
1554 } | 1595 } |
1555 | 1596 |
1556 TEST_F(InstrumentAppIntegrationTest, AsanLargeBlockHeapEnabledTest) { | 1597 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
1598 AsanLargeBlockHeapEnabledTest) { | |
1557 cmd_line_.AppendSwitchASCII("asan-rtl-options", | 1599 cmd_line_.AppendSwitchASCII("asan-rtl-options", |
1558 "--no_check_heap_on_failure " | 1600 "--no_check_heap_on_failure " |
1559 "--quarantine_size=4000000 " | 1601 "--quarantine_size=4000000 " |
1560 "--quarantine_block_size=2000000"); | 1602 "--quarantine_block_size=2000000"); |
1561 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1603 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
1562 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1604 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
1563 ASSERT_NO_FATAL_FAILURE(AsanLargeBlockHeapTests(true)); | 1605 ASSERT_NO_FATAL_FAILURE(AsanLargeBlockHeapTests(true)); |
1564 } | 1606 } |
1565 | 1607 |
1566 TEST_F(InstrumentAppIntegrationTest, AsanLargeBlockHeapDisabledTest) { | 1608 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
1609 AsanLargeBlockHeapDisabledTest) { | |
1567 cmd_line_.AppendSwitchASCII("asan-rtl-options", | 1610 cmd_line_.AppendSwitchASCII("asan-rtl-options", |
1568 "--no_check_heap_on_failure " | 1611 "--no_check_heap_on_failure " |
1569 "--disable_large_block_heap"); | 1612 "--disable_large_block_heap"); |
1570 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1613 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
1571 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1614 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
1572 ASSERT_NO_FATAL_FAILURE(AsanLargeBlockHeapTests(false)); | 1615 ASSERT_NO_FATAL_FAILURE(AsanLargeBlockHeapTests(false)); |
1573 } | 1616 } |
1574 | 1617 |
1575 TEST_F(InstrumentAppIntegrationTest, AsanZebraHeapDisabledTest) { | 1618 TEST_P(ParametrizedInstrumentAppIntegrationTest, AsanZebraHeapDisabledTest) { |
1576 AsanZebraHeapTest(false); | 1619 AsanZebraHeapTest(false); |
1577 } | 1620 } |
1578 | 1621 |
1579 TEST_F(InstrumentAppIntegrationTest, AsanZebraHeapEnabledTest) { | 1622 TEST_P(ParametrizedInstrumentAppIntegrationTest, AsanZebraHeapEnabledTest) { |
1580 AsanZebraHeapTest(true); | 1623 AsanZebraHeapTest(true); |
1581 } | 1624 } |
1582 | 1625 |
1583 TEST_F(InstrumentAppIntegrationTest, AsanSymbolizerTestAsanBufferOverflow) { | 1626 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
1627 AsanSymbolizerTestAsanBufferOverflow) { | |
1584 AsanSymbolizerTest(testing::kAsanRead8BufferOverflow, | 1628 AsanSymbolizerTest(testing::kAsanRead8BufferOverflow, |
1585 STRINGIFY(HEAP_BUFFER_OVERFLOW), | 1629 STRINGIFY(HEAP_BUFFER_OVERFLOW), |
1586 STRINGIFY(ASAN_READ_ACCESS), | 1630 STRINGIFY(ASAN_READ_ACCESS), |
1587 1, | 1631 1, |
1588 false); | 1632 false); |
1589 } | 1633 } |
1590 | 1634 |
1591 TEST_F(InstrumentAppIntegrationTest, AsanSymbolizerTestAsanBufferUnderflow) { | 1635 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
1636 AsanSymbolizerTestAsanBufferUnderflow) { | |
1592 AsanSymbolizerTest(testing::kAsanWrite32BufferUnderflow, | 1637 AsanSymbolizerTest(testing::kAsanWrite32BufferUnderflow, |
1593 STRINGIFY(HEAP_BUFFER_UNDERFLOW), | 1638 STRINGIFY(HEAP_BUFFER_UNDERFLOW), |
1594 STRINGIFY(ASAN_WRITE_ACCESS), | 1639 STRINGIFY(ASAN_WRITE_ACCESS), |
1595 4, | 1640 4, |
1596 false); | 1641 false); |
1597 } | 1642 } |
1598 | 1643 |
1599 TEST_F(InstrumentAppIntegrationTest, AsanSymbolizerTestAsanUseAfterFree) { | 1644 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
1645 AsanSymbolizerTestAsanUseAfterFree) { | |
1600 AsanSymbolizerTest(testing::kAsanRead64UseAfterFree, | 1646 AsanSymbolizerTest(testing::kAsanRead64UseAfterFree, |
1601 STRINGIFY(USE_AFTER_FREE), | 1647 STRINGIFY(USE_AFTER_FREE), |
1602 STRINGIFY(ASAN_READ_ACCESS), | 1648 STRINGIFY(ASAN_READ_ACCESS), |
1603 8, | 1649 8, |
1604 false); | 1650 false); |
1605 } | 1651 } |
1606 | 1652 |
1607 TEST_F(InstrumentAppIntegrationTest, AsanSymbolizerTestAsanCorruptBlock) { | 1653 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
1654 AsanSymbolizerTestAsanCorruptBlock) { | |
1608 AsanSymbolizerTest(testing::kAsanCorruptBlock, | 1655 AsanSymbolizerTest(testing::kAsanCorruptBlock, |
1609 STRINGIFY(CORRUPT_BLOCK), | 1656 STRINGIFY(CORRUPT_BLOCK), |
1610 STRINGIFY(ASAN_UNKNOWN_ACCESS), | 1657 STRINGIFY(ASAN_UNKNOWN_ACCESS), |
1611 0, | 1658 0, |
1612 false); | 1659 false); |
1613 } | 1660 } |
1614 | 1661 |
1615 TEST_F(InstrumentAppIntegrationTest, | 1662 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
1616 AsanSymbolizerTestAsanCorruptBlockInQuarantine) { | 1663 AsanSymbolizerTestAsanCorruptBlockInQuarantine) { |
1617 AsanSymbolizerTest(testing::kAsanCorruptBlockInQuarantine, | 1664 AsanSymbolizerTest(testing::kAsanCorruptBlockInQuarantine, |
1618 STRINGIFY(CORRUPT_BLOCK), | 1665 STRINGIFY(CORRUPT_BLOCK), |
1619 STRINGIFY(ASAN_UNKNOWN_ACCESS), | 1666 STRINGIFY(ASAN_UNKNOWN_ACCESS), |
1620 0, | 1667 0, |
1621 true); | 1668 true); |
1622 } | 1669 } |
1623 | 1670 |
1624 // These tests require corrupt heap checking to be enabled. | 1671 // These tests require corrupt heap checking to be enabled. |
1625 TEST_F(InstrumentAppIntegrationTest, AsanNearNullptrAccess) { | 1672 TEST_P(ParametrizedInstrumentAppIntegrationTest, AsanNearNullptrAccess) { |
1626 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1673 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
1627 | 1674 |
1628 OutOfProcessAsanErrorCheckAndValidateLog( | 1675 OutOfProcessAsanErrorCheckAndValidateLog( |
1629 testing::kAsanNearNullptrAccessHeapCorruptionInstrumented, true, | 1676 testing::kAsanNearNullptrAccessHeapCorruptionInstrumented, true, |
1630 kAsanHandlingException, kAsanNearNullptrAccessHeapCorruption); | 1677 kAsanHandlingException, kAsanNearNullptrAccessHeapCorruption); |
1631 OutOfProcessAsanErrorCheckAndValidateLog( | 1678 OutOfProcessAsanErrorCheckAndValidateLog( |
1632 testing::kAsanNearNullptrAccessHeapCorruptionUninstrumented, true, | 1679 testing::kAsanNearNullptrAccessHeapCorruptionUninstrumented, true, |
1633 kAsanHandlingException, kAsanNearNullptrAccessHeapCorruption); | 1680 kAsanHandlingException, kAsanNearNullptrAccessHeapCorruption); |
1634 OutOfProcessAsanErrorCheckAndValidateLog( | 1681 OutOfProcessAsanErrorCheckAndValidateLog( |
1635 testing::kAsanNearNullptrAccessNoHeapCorruptionInstrumented, true, | 1682 testing::kAsanNearNullptrAccessNoHeapCorruptionInstrumented, true, |
1636 kAsanHandlingException, kAsanNearNullptrAccessNoHeapCorruption); | 1683 kAsanHandlingException, kAsanNearNullptrAccessNoHeapCorruption); |
1637 OutOfProcessAsanErrorCheckAndValidateLog( | 1684 OutOfProcessAsanErrorCheckAndValidateLog( |
1638 testing::kAsanNearNullptrAccessNoHeapCorruptionUninstrumented, true, | 1685 testing::kAsanNearNullptrAccessNoHeapCorruptionUninstrumented, true, |
1639 kAsanHandlingException, kAsanNearNullptrAccessNoHeapCorruption); | 1686 kAsanHandlingException, kAsanNearNullptrAccessNoHeapCorruption); |
1640 OutOfProcessAsanErrorCheckAndValidateLog( | 1687 OutOfProcessAsanErrorCheckAndValidateLog( |
1641 testing::kAsanNullptrAccessNoHeapCorruptionUninstrumented, true, | 1688 testing::kAsanNullptrAccessNoHeapCorruptionUninstrumented, true, |
1642 kAsanHandlingException, kAsanNearNullptrAccessNoHeapCorruption); | 1689 kAsanHandlingException, kAsanNearNullptrAccessNoHeapCorruption); |
1643 } | 1690 } |
1644 | 1691 |
1692 // Instantiate the test cases only with SYZYGY until some problems are fixed. | |
1693 INSTANTIATE_TEST_CASE_P(InstantiationName, | |
1694 ParametrizedInstrumentAppIntegrationTest, | |
1695 testing::Values(SYZYGY)); | |
1696 | |
1645 TEST_F(InstrumentAppIntegrationTest, BBEntryEndToEnd) { | 1697 TEST_F(InstrumentAppIntegrationTest, BBEntryEndToEnd) { |
1646 ASSERT_NO_FATAL_FAILURE(StartService()); | 1698 ASSERT_NO_FATAL_FAILURE(StartService()); |
1647 ASSERT_NO_FATAL_FAILURE(EndToEndTest("bbentry")); | 1699 ASSERT_NO_FATAL_FAILURE(EndToEndTest("bbentry")); |
1648 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1700 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
1649 ASSERT_NO_FATAL_FAILURE(BBEntryInvokeTestDll()); | 1701 ASSERT_NO_FATAL_FAILURE(BBEntryInvokeTestDll()); |
1650 ASSERT_NO_FATAL_FAILURE(StopService()); | 1702 ASSERT_NO_FATAL_FAILURE(StopService()); |
1651 ASSERT_NO_FATAL_FAILURE(BBEntryCheckTestDll()); | 1703 ASSERT_NO_FATAL_FAILURE(BBEntryCheckTestDll()); |
1652 } | 1704 } |
1653 | 1705 |
1654 TEST_F(InstrumentAppIntegrationTest, BranchEndToEnd) { | 1706 TEST_F(InstrumentAppIntegrationTest, BranchEndToEnd) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1743 | 1795 |
1744 TEST_F(InstrumentAppIntegrationTest, DeferredFreeTLS) { | 1796 TEST_F(InstrumentAppIntegrationTest, DeferredFreeTLS) { |
1745 ASSERT_NO_FATAL_FAILURE(StartService()); | 1797 ASSERT_NO_FATAL_FAILURE(StartService()); |
1746 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1798 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
1747 ASSERT_EQ(0, InvokeTestDllFunction(testing::kAsanDeferredFreeTLS)); | 1799 ASSERT_EQ(0, InvokeTestDllFunction(testing::kAsanDeferredFreeTLS)); |
1748 ASSERT_NO_FATAL_FAILURE(UnloadDll()); | 1800 ASSERT_NO_FATAL_FAILURE(UnloadDll()); |
1749 ASSERT_NO_FATAL_FAILURE(StopService()); | 1801 ASSERT_NO_FATAL_FAILURE(StopService()); |
1750 } | 1802 } |
1751 | 1803 |
1752 } // namespace integration_tests | 1804 } // namespace integration_tests |
OLD | NEW |