Chromium Code Reviews| 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, | |
| 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/07 16:46:59
Add a comment explaining the purpose of this class
njanevsk
2017/08/07 17:39:22
Done.
| |
| 1293 : public LenientInstrumentAppIntegrationTest, | |
| 1294 public ::testing::WithParamInterface<InstrumentationMode> { | |
| 1295 public: | |
| 1296 void SetUp() { LenientInstrumentAppIntegrationTest::SetUp(); } | |
|
Sébastien Marchand
2017/08/07 16:46:59
You don't need this?
njanevsk
2017/08/07 17:39:21
I need this when adding CLANG to set the path:
if
| |
| 1297 | |
| 1298 void EndToEndTest(const std::string& mode) { | |
|
Sébastien Marchand
2017/08/07 16:46:59
Add an "override" keyword.
njanevsk
2017/08/07 17:39:22
Done.
| |
| 1299 if (GetParam() == SYZYGY) { | |
| 1300 LenientInstrumentAppIntegrationTest::EndToEndTest(mode); | |
| 1301 } | |
| 1302 } | |
| 1303 void AsanZebraHeapTest(bool enabled); | |
|
Sébastien Marchand
2017/08/07 16:46:59
As mentioned in the previous comment, leave this i
njanevsk
2017/08/07 17:39:22
Done.
| |
| 1304 | |
| 1305 void EndToEndCheckTestDll() { | |
|
Sébastien Marchand
2017/08/07 16:46:59
Add the override keyword.
njanevsk
2017/08/07 17:39:22
Done.
| |
| 1306 if (GetParam() == SYZYGY) { | |
| 1307 LenientInstrumentAppIntegrationTest::EndToEndCheckTestDll(); | |
| 1308 } | |
| 1309 } | |
| 1310 }; | |
| 1311 | |
| 1312 typedef testing::StrictMock<ParametrizedLenientInstrumentAppIntegrationTest> | |
| 1313 ParametrizedInstrumentAppIntegrationTest; | |
| 1314 | |
| 1288 typedef testing::StrictMock<LenientInstrumentAppIntegrationTest> | 1315 typedef testing::StrictMock<LenientInstrumentAppIntegrationTest> |
| 1289 InstrumentAppIntegrationTest; | 1316 InstrumentAppIntegrationTest; |
| 1290 | 1317 |
| 1291 typedef std::map<std::string, size_t> FunctionOffsetMap; | 1318 typedef std::map<std::string, size_t> FunctionOffsetMap; |
| 1292 | 1319 |
| 1293 // A utility transform for extracting call site offsets from blocks. | 1320 // A utility transform for extracting call site offsets from blocks. |
| 1294 // Used by GetCallOffsets and ZebraBlockHeap tests. | 1321 // Used by GetCallOffsets and ZebraBlockHeap tests. |
| 1295 class ExtractCallTransform | 1322 class ExtractCallTransform |
| 1296 : public block_graph::BasicBlockSubGraphTransformInterface { | 1323 : public block_graph::BasicBlockSubGraphTransformInterface { |
| 1297 public: | 1324 public: |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1363 // Apply our dummy transform which simply extracts call addresses. | 1390 // Apply our dummy transform which simply extracts call addresses. |
| 1364 { | 1391 { |
| 1365 ExtractCallTransform bbtx(map); | 1392 ExtractCallTransform bbtx(map); |
| 1366 block_graph::transforms::ChainedBasicBlockTransforms tx; | 1393 block_graph::transforms::ChainedBasicBlockTransforms tx; |
| 1367 tx.AppendTransform(&bbtx); | 1394 tx.AppendTransform(&bbtx); |
| 1368 ASSERT_TRUE(block_graph::ApplyBlockGraphTransform( | 1395 ASSERT_TRUE(block_graph::ApplyBlockGraphTransform( |
| 1369 &tx, &policy, &bg, header)); | 1396 &tx, &policy, &bg, header)); |
| 1370 } | 1397 } |
| 1371 } | 1398 } |
| 1372 | 1399 |
| 1373 void LenientInstrumentAppIntegrationTest::AsanZebraHeapTest(bool enabled) { | 1400 void ParametrizedLenientInstrumentAppIntegrationTest::AsanZebraHeapTest( |
| 1401 bool enabled) { | |
| 1374 // Find the offset of the call we want to instrument. | 1402 // Find the offset of the call we want to instrument. |
| 1375 static const char kTest1[] = | 1403 static const char kTest1[] = |
| 1376 "testing::AsanReadPageAllocationTrailerBeforeFree"; | 1404 "testing::AsanReadPageAllocationTrailerBeforeFree"; |
| 1377 static const char kTest2[] = | 1405 static const char kTest2[] = |
| 1378 "testing::AsanWritePageAllocationBodyAfterFree"; | 1406 "testing::AsanWritePageAllocationBodyAfterFree"; |
| 1379 FunctionOffsetMap map({{kTest1, -1}, {kTest2, -1}}); | 1407 FunctionOffsetMap map({{kTest1, -1}, {kTest2, -1}}); |
| 1380 ASSERT_NO_FATAL_FAILURE(GetCallOffsets(input_dll_path_, &map)); | 1408 ASSERT_NO_FATAL_FAILURE(GetCallOffsets(input_dll_path_, &map)); |
| 1381 | 1409 |
| 1382 // Create an allocation filter. | 1410 // Create an allocation filter. |
| 1383 base::FilePath filter_path = temp_dir_.AppendASCII("allocation_filter.json"); | 1411 base::FilePath filter_path = temp_dir_.AppendASCII("allocation_filter.json"); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1400 OutOfProcessAsanErrorCheckAndValidateLog( | 1428 OutOfProcessAsanErrorCheckAndValidateLog( |
| 1401 testing::kAsanReadPageAllocationTrailerBeforeFreeAllocation, enabled, | 1429 testing::kAsanReadPageAllocationTrailerBeforeFreeAllocation, enabled, |
| 1402 kAsanAccessViolationLog, kAsanHeapBufferOverflow); | 1430 kAsanAccessViolationLog, kAsanHeapBufferOverflow); |
| 1403 OutOfProcessAsanErrorCheckAndValidateLog( | 1431 OutOfProcessAsanErrorCheckAndValidateLog( |
| 1404 testing::kAsanWritePageAllocationBodyAfterFree, enabled, | 1432 testing::kAsanWritePageAllocationBodyAfterFree, enabled, |
| 1405 kAsanAccessViolationLog, kAsanHeapUseAfterFree); | 1433 kAsanAccessViolationLog, kAsanHeapUseAfterFree); |
| 1406 } | 1434 } |
| 1407 | 1435 |
| 1408 } // namespace | 1436 } // namespace |
| 1409 | 1437 |
| 1410 TEST_F(InstrumentAppIntegrationTest, AsanEndToEnd) { | 1438 TEST_P(ParametrizedInstrumentAppIntegrationTest, AsanEndToEnd) { |
| 1411 // Disable the heap checking as this is implies touching all the shadow bytes | 1439 // Disable the heap checking as this is implies touching all the shadow bytes |
| 1412 // and this make those tests really slow. | 1440 // and this make those tests really slow. |
| 1413 cmd_line_.AppendSwitchASCII("asan-rtl-options", "--no_check_heap_on_failure"); | 1441 cmd_line_.AppendSwitchASCII("asan-rtl-options", "--no_check_heap_on_failure"); |
| 1414 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1442 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1415 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1443 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1416 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | 1444 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
| 1417 ASSERT_NO_FATAL_FAILURE(CheckTestDllImportsRedirected()); | 1445 ASSERT_NO_FATAL_FAILURE(CheckTestDllImportsRedirected()); |
| 1418 } | 1446 } |
| 1419 | 1447 |
| 1420 TEST_F(InstrumentAppIntegrationTest, AsanEndToEndNoLiveness) { | 1448 TEST_P(ParametrizedInstrumentAppIntegrationTest, AsanEndToEndNoLiveness) { |
| 1421 // Disable the heap checking as this is implies touching all the shadow bytes | 1449 // Disable the heap checking as this is implies touching all the shadow bytes |
| 1422 // and this make those tests really slow. | 1450 // and this make those tests really slow. |
| 1423 cmd_line_.AppendSwitchASCII("asan-rtl-options", "--no_check_heap_on_failure"); | 1451 cmd_line_.AppendSwitchASCII("asan-rtl-options", "--no_check_heap_on_failure"); |
| 1424 cmd_line_.AppendSwitch("no-liveness-analysis"); | 1452 cmd_line_.AppendSwitch("no-liveness-analysis"); |
| 1425 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1453 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1426 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1454 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1427 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | 1455 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
| 1428 } | 1456 } |
| 1429 | 1457 |
| 1430 TEST_F(InstrumentAppIntegrationTest, AsanEndToEndNoRedundancyAnalysis) { | 1458 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1459 AsanEndToEndNoRedundancyAnalysis) { | |
| 1431 // Disable the heap checking as this is implies touching all the shadow bytes | 1460 // Disable the heap checking as this is implies touching all the shadow bytes |
| 1432 // and this make those tests really slow. | 1461 // and this make those tests really slow. |
| 1433 cmd_line_.AppendSwitchASCII("asan-rtl-options", "--no_check_heap_on_failure"); | 1462 cmd_line_.AppendSwitchASCII("asan-rtl-options", "--no_check_heap_on_failure"); |
| 1434 cmd_line_.AppendSwitch("no-redundancy-analysis"); | 1463 cmd_line_.AppendSwitch("no-redundancy-analysis"); |
| 1435 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1464 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1436 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1465 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1437 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | 1466 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
| 1438 } | 1467 } |
| 1439 | 1468 |
| 1440 TEST_F(InstrumentAppIntegrationTest, AsanEndToEndNoFunctionInterceptors) { | 1469 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1470 AsanEndToEndNoFunctionInterceptors) { | |
| 1441 // Disable the heap checking as this is implies touching all the shadow bytes | 1471 // Disable the heap checking as this is implies touching all the shadow bytes |
| 1442 // and this make those tests really slow. | 1472 // and this make those tests really slow. |
| 1443 cmd_line_.AppendSwitchASCII("asan-rtl-options", "--no_check_heap_on_failure"); | 1473 cmd_line_.AppendSwitchASCII("asan-rtl-options", "--no_check_heap_on_failure"); |
| 1444 cmd_line_.AppendSwitch("no-interceptors"); | 1474 cmd_line_.AppendSwitch("no-interceptors"); |
| 1445 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1475 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1446 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1476 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1447 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | 1477 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
| 1448 } | 1478 } |
| 1449 | 1479 |
| 1450 TEST_F(InstrumentAppIntegrationTest, AsanEndToEndWithRtlOptions) { | 1480 TEST_P(ParametrizedInstrumentAppIntegrationTest, AsanEndToEndWithRtlOptions) { |
| 1451 cmd_line_.AppendSwitchASCII( | 1481 cmd_line_.AppendSwitchASCII( |
| 1452 "asan-rtl-options", | 1482 "asan-rtl-options", |
| 1453 "--quarantine_size=20000000 --quarantine_block_size=1000000 " | 1483 "--quarantine_size=20000000 --quarantine_block_size=1000000 " |
| 1454 "--no_check_heap_on_failure"); | 1484 "--no_check_heap_on_failure"); |
| 1455 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1485 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1456 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1486 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1457 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | 1487 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
| 1458 | 1488 |
| 1459 // Get the active runtime and validate its parameters. | 1489 // Get the active runtime and validate its parameters. |
| 1460 agent::asan::AsanRuntime* runtime = GetActiveAsanRuntime(); | 1490 agent::asan::AsanRuntime* runtime = GetActiveAsanRuntime(); |
| 1461 ASSERT_TRUE(runtime != NULL); | 1491 ASSERT_TRUE(runtime != NULL); |
| 1462 ASSERT_EQ(20000000u, runtime->params().quarantine_size); | 1492 ASSERT_EQ(20000000u, runtime->params().quarantine_size); |
| 1463 ASSERT_EQ(1000000u, runtime->params().quarantine_block_size); | 1493 ASSERT_EQ(1000000u, runtime->params().quarantine_block_size); |
| 1464 } | 1494 } |
| 1465 | 1495 |
| 1466 TEST_F(InstrumentAppIntegrationTest, | 1496 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1467 AsanEndToEndWithRtlOptionsOverrideWithEnvironment) { | 1497 AsanEndToEndWithRtlOptionsOverrideWithEnvironment) { |
| 1468 std::unique_ptr<base::Environment> env(base::Environment::Create()); | 1498 std::unique_ptr<base::Environment> env(base::Environment::Create()); |
| 1469 ASSERT_NE(env.get(), nullptr); | 1499 ASSERT_NE(env.get(), nullptr); |
| 1470 env->SetVar(::common::kSyzyAsanOptionsEnvVar, | 1500 env->SetVar(::common::kSyzyAsanOptionsEnvVar, |
| 1471 "--quarantine_block_size=800000 --ignored_stack_ids=0x1 " | 1501 "--quarantine_block_size=800000 --ignored_stack_ids=0x1 " |
| 1472 "--no_check_heap_on_failure"); | 1502 "--no_check_heap_on_failure"); |
| 1473 cmd_line_.AppendSwitchASCII( | 1503 cmd_line_.AppendSwitchASCII( |
| 1474 "asan-rtl-options", | 1504 "asan-rtl-options", |
| 1475 "--quarantine_size=20000000 --quarantine_block_size=1000000 " | 1505 "--quarantine_size=20000000 --quarantine_block_size=1000000 " |
| 1476 "--ignored_stack_ids=0x2"); | 1506 "--ignored_stack_ids=0x2"); |
| 1477 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1507 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1478 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1508 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1479 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | 1509 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
| 1480 | 1510 |
| 1481 // Get the active runtime and validate its parameters. | 1511 // Get the active runtime and validate its parameters. |
| 1482 agent::asan::AsanRuntime* runtime = GetActiveAsanRuntime(); | 1512 agent::asan::AsanRuntime* runtime = GetActiveAsanRuntime(); |
| 1483 ASSERT_TRUE(runtime != NULL); | 1513 ASSERT_TRUE(runtime != NULL); |
| 1484 ASSERT_EQ(20000000u, runtime->params().quarantine_size); | 1514 ASSERT_EQ(20000000u, runtime->params().quarantine_size); |
| 1485 ASSERT_EQ(800000u, runtime->params().quarantine_block_size); | 1515 ASSERT_EQ(800000u, runtime->params().quarantine_block_size); |
| 1486 ASSERT_THAT(runtime->params().ignored_stack_ids_set, | 1516 ASSERT_THAT(runtime->params().ignored_stack_ids_set, |
| 1487 testing::ElementsAre(0x1, 0x2)); | 1517 testing::ElementsAre(0x1, 0x2)); |
| 1488 | 1518 |
| 1489 env->UnSetVar(::common::kSyzyAsanOptionsEnvVar); | 1519 env->UnSetVar(::common::kSyzyAsanOptionsEnvVar); |
| 1490 } | 1520 } |
| 1491 | 1521 |
| 1492 TEST_F(InstrumentAppIntegrationTest, FullOptimizedAsanEndToEnd) { | 1522 TEST_P(ParametrizedInstrumentAppIntegrationTest, FullOptimizedAsanEndToEnd) { |
| 1493 // Disable the heap checking as this implies touching all the shadow bytes | 1523 // Disable the heap checking as this implies touching all the shadow bytes |
| 1494 // and this make these tests really slow. | 1524 // and this make these tests really slow. |
| 1495 cmd_line_.AppendSwitchASCII("asan-rtl-options", "--no_check_heap_on_failure"); | 1525 cmd_line_.AppendSwitchASCII("asan-rtl-options", "--no_check_heap_on_failure"); |
| 1496 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1526 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1497 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1527 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1498 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | 1528 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
| 1499 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckInterceptedFunctions()); | 1529 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckInterceptedFunctions()); |
| 1500 } | 1530 } |
| 1501 | 1531 |
| 1502 TEST_F(InstrumentAppIntegrationTest, | 1532 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1503 AsanInvalidAccessWithCorruptAllocatedBlockHeader) { | 1533 AsanInvalidAccessWithCorruptAllocatedBlockHeader) { |
| 1504 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1534 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1505 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1535 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1506 OutOfProcessAsanErrorCheckAndValidateLog( | 1536 OutOfProcessAsanErrorCheckAndValidateLog( |
| 1507 testing::kAsanInvalidAccessWithCorruptAllocatedBlockHeader, true, | 1537 testing::kAsanInvalidAccessWithCorruptAllocatedBlockHeader, true, |
| 1508 kAsanCorruptHeap, NULL); | 1538 kAsanCorruptHeap, NULL); |
| 1509 } | 1539 } |
| 1510 | 1540 |
| 1511 TEST_F(InstrumentAppIntegrationTest, AsanOverflowCallsCrashForException) { | 1541 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1542 AsanOverflowCallsCrashForException) { | |
| 1512 // Asan-detected violations go through CrashForException if it is available. | 1543 // Asan-detected violations go through CrashForException if it is available. |
| 1513 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1544 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1514 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1545 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1515 int exit_code = | 1546 int exit_code = |
| 1516 RunOutOfProcessFunction(L"crash_for_exception_harness.exe", | 1547 RunOutOfProcessFunction(L"crash_for_exception_harness.exe", |
| 1517 testing::kAsanRead8BufferOverflow, true); | 1548 testing::kAsanRead8BufferOverflow, true); |
| 1518 EXPECT_EQ(kExeCrashForExceptionExitCode, exit_code); | 1549 EXPECT_EQ(kExeCrashForExceptionExitCode, exit_code); |
| 1519 } | 1550 } |
| 1520 | 1551 |
| 1521 TEST_F(InstrumentAppIntegrationTest, | 1552 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1522 AsanInvalidAccessWithCorruptAllocatedBlockTrailer) { | 1553 AsanInvalidAccessWithCorruptAllocatedBlockTrailer) { |
| 1523 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1554 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1524 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1555 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1525 OutOfProcessAsanErrorCheckAndValidateLog( | 1556 OutOfProcessAsanErrorCheckAndValidateLog( |
| 1526 testing::kAsanInvalidAccessWithCorruptAllocatedBlockTrailer, true, | 1557 testing::kAsanInvalidAccessWithCorruptAllocatedBlockTrailer, true, |
| 1527 kAsanCorruptHeap, NULL); | 1558 kAsanCorruptHeap, NULL); |
| 1528 } | 1559 } |
| 1529 | 1560 |
| 1530 TEST_F(InstrumentAppIntegrationTest, | 1561 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1531 AsanInvalidAccessWithCorruptFreedBlock) { | 1562 AsanInvalidAccessWithCorruptFreedBlock) { |
| 1532 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1563 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1533 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1564 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1534 OutOfProcessAsanErrorCheckAndValidateLog( | 1565 OutOfProcessAsanErrorCheckAndValidateLog( |
| 1535 testing::kAsanInvalidAccessWithCorruptFreedBlock, true, kAsanCorruptHeap, | 1566 testing::kAsanInvalidAccessWithCorruptFreedBlock, true, kAsanCorruptHeap, |
| 1536 NULL); | 1567 NULL); |
| 1537 } | 1568 } |
| 1538 | 1569 |
| 1539 TEST_F(InstrumentAppIntegrationTest, AsanCorruptBlockWithPageProtections) { | 1570 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1571 AsanCorruptBlockWithPageProtections) { | |
| 1540 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1572 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1541 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1573 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1542 OutOfProcessAsanErrorCheckAndValidateLog( | 1574 OutOfProcessAsanErrorCheckAndValidateLog( |
| 1543 testing::kAsanCorruptBlockWithPageProtections, true, | 1575 testing::kAsanCorruptBlockWithPageProtections, true, |
| 1544 kAsanHeapUseAfterFree, kAsanCorruptHeap); | 1576 kAsanHeapUseAfterFree, kAsanCorruptHeap); |
| 1545 } | 1577 } |
| 1546 | 1578 |
| 1547 TEST_F(InstrumentAppIntegrationTest, SampledAllocationsAsanEndToEnd) { | 1579 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1580 SampledAllocationsAsanEndToEnd) { | |
| 1548 cmd_line_.AppendSwitchASCII("asan-rtl-options", | 1581 cmd_line_.AppendSwitchASCII("asan-rtl-options", |
| 1549 "--allocation_guard_rate=0.5 " | 1582 "--allocation_guard_rate=0.5 " |
| 1550 "--no_check_heap_on_failure"); | 1583 "--no_check_heap_on_failure"); |
| 1551 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1584 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1552 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1585 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1553 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckSampledAllocations()); | 1586 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckSampledAllocations()); |
| 1554 } | 1587 } |
| 1555 | 1588 |
| 1556 TEST_F(InstrumentAppIntegrationTest, AsanLargeBlockHeapEnabledTest) { | 1589 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1590 AsanLargeBlockHeapEnabledTest) { | |
| 1557 cmd_line_.AppendSwitchASCII("asan-rtl-options", | 1591 cmd_line_.AppendSwitchASCII("asan-rtl-options", |
| 1558 "--no_check_heap_on_failure " | 1592 "--no_check_heap_on_failure " |
| 1559 "--quarantine_size=4000000 " | 1593 "--quarantine_size=4000000 " |
| 1560 "--quarantine_block_size=2000000"); | 1594 "--quarantine_block_size=2000000"); |
| 1561 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1595 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1562 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1596 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1563 ASSERT_NO_FATAL_FAILURE(AsanLargeBlockHeapTests(true)); | 1597 ASSERT_NO_FATAL_FAILURE(AsanLargeBlockHeapTests(true)); |
| 1564 } | 1598 } |
| 1565 | 1599 |
| 1566 TEST_F(InstrumentAppIntegrationTest, AsanLargeBlockHeapDisabledTest) { | 1600 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1601 AsanLargeBlockHeapDisabledTest) { | |
| 1567 cmd_line_.AppendSwitchASCII("asan-rtl-options", | 1602 cmd_line_.AppendSwitchASCII("asan-rtl-options", |
| 1568 "--no_check_heap_on_failure " | 1603 "--no_check_heap_on_failure " |
| 1569 "--disable_large_block_heap"); | 1604 "--disable_large_block_heap"); |
| 1570 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1605 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1571 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1606 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1572 ASSERT_NO_FATAL_FAILURE(AsanLargeBlockHeapTests(false)); | 1607 ASSERT_NO_FATAL_FAILURE(AsanLargeBlockHeapTests(false)); |
| 1573 } | 1608 } |
| 1574 | 1609 |
| 1575 TEST_F(InstrumentAppIntegrationTest, AsanZebraHeapDisabledTest) { | 1610 TEST_P(ParametrizedInstrumentAppIntegrationTest, AsanZebraHeapDisabledTest) { |
| 1576 AsanZebraHeapTest(false); | 1611 AsanZebraHeapTest(false); |
| 1577 } | 1612 } |
| 1578 | 1613 |
| 1579 TEST_F(InstrumentAppIntegrationTest, AsanZebraHeapEnabledTest) { | 1614 TEST_P(ParametrizedInstrumentAppIntegrationTest, AsanZebraHeapEnabledTest) { |
| 1580 AsanZebraHeapTest(true); | 1615 AsanZebraHeapTest(true); |
| 1581 } | 1616 } |
| 1582 | 1617 |
| 1583 TEST_F(InstrumentAppIntegrationTest, AsanSymbolizerTestAsanBufferOverflow) { | 1618 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1619 AsanSymbolizerTestAsanBufferOverflow) { | |
| 1584 AsanSymbolizerTest(testing::kAsanRead8BufferOverflow, | 1620 AsanSymbolizerTest(testing::kAsanRead8BufferOverflow, |
| 1585 STRINGIFY(HEAP_BUFFER_OVERFLOW), | 1621 STRINGIFY(HEAP_BUFFER_OVERFLOW), |
| 1586 STRINGIFY(ASAN_READ_ACCESS), | 1622 STRINGIFY(ASAN_READ_ACCESS), |
| 1587 1, | 1623 1, |
| 1588 false); | 1624 false); |
| 1589 } | 1625 } |
| 1590 | 1626 |
| 1591 TEST_F(InstrumentAppIntegrationTest, AsanSymbolizerTestAsanBufferUnderflow) { | 1627 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1628 AsanSymbolizerTestAsanBufferUnderflow) { | |
| 1592 AsanSymbolizerTest(testing::kAsanWrite32BufferUnderflow, | 1629 AsanSymbolizerTest(testing::kAsanWrite32BufferUnderflow, |
| 1593 STRINGIFY(HEAP_BUFFER_UNDERFLOW), | 1630 STRINGIFY(HEAP_BUFFER_UNDERFLOW), |
| 1594 STRINGIFY(ASAN_WRITE_ACCESS), | 1631 STRINGIFY(ASAN_WRITE_ACCESS), |
| 1595 4, | 1632 4, |
| 1596 false); | 1633 false); |
| 1597 } | 1634 } |
| 1598 | 1635 |
| 1599 TEST_F(InstrumentAppIntegrationTest, AsanSymbolizerTestAsanUseAfterFree) { | 1636 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1637 AsanSymbolizerTestAsanUseAfterFree) { | |
| 1600 AsanSymbolizerTest(testing::kAsanRead64UseAfterFree, | 1638 AsanSymbolizerTest(testing::kAsanRead64UseAfterFree, |
| 1601 STRINGIFY(USE_AFTER_FREE), | 1639 STRINGIFY(USE_AFTER_FREE), |
| 1602 STRINGIFY(ASAN_READ_ACCESS), | 1640 STRINGIFY(ASAN_READ_ACCESS), |
| 1603 8, | 1641 8, |
| 1604 false); | 1642 false); |
| 1605 } | 1643 } |
| 1606 | 1644 |
| 1607 TEST_F(InstrumentAppIntegrationTest, AsanSymbolizerTestAsanCorruptBlock) { | 1645 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1646 AsanSymbolizerTestAsanCorruptBlock) { | |
| 1608 AsanSymbolizerTest(testing::kAsanCorruptBlock, | 1647 AsanSymbolizerTest(testing::kAsanCorruptBlock, |
| 1609 STRINGIFY(CORRUPT_BLOCK), | 1648 STRINGIFY(CORRUPT_BLOCK), |
| 1610 STRINGIFY(ASAN_UNKNOWN_ACCESS), | 1649 STRINGIFY(ASAN_UNKNOWN_ACCESS), |
| 1611 0, | 1650 0, |
| 1612 false); | 1651 false); |
| 1613 } | 1652 } |
| 1614 | 1653 |
| 1615 TEST_F(InstrumentAppIntegrationTest, | 1654 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1616 AsanSymbolizerTestAsanCorruptBlockInQuarantine) { | 1655 AsanSymbolizerTestAsanCorruptBlockInQuarantine) { |
| 1617 AsanSymbolizerTest(testing::kAsanCorruptBlockInQuarantine, | 1656 AsanSymbolizerTest(testing::kAsanCorruptBlockInQuarantine, |
| 1618 STRINGIFY(CORRUPT_BLOCK), | 1657 STRINGIFY(CORRUPT_BLOCK), |
| 1619 STRINGIFY(ASAN_UNKNOWN_ACCESS), | 1658 STRINGIFY(ASAN_UNKNOWN_ACCESS), |
| 1620 0, | 1659 0, |
| 1621 true); | 1660 true); |
| 1622 } | 1661 } |
| 1623 | 1662 |
| 1624 // These tests require corrupt heap checking to be enabled. | 1663 // These tests require corrupt heap checking to be enabled. |
| 1625 TEST_F(InstrumentAppIntegrationTest, AsanNearNullptrAccess) { | 1664 TEST_P(ParametrizedInstrumentAppIntegrationTest, AsanNearNullptrAccess) { |
| 1626 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1665 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1627 | 1666 |
| 1628 OutOfProcessAsanErrorCheckAndValidateLog( | 1667 OutOfProcessAsanErrorCheckAndValidateLog( |
| 1629 testing::kAsanNearNullptrAccessHeapCorruptionInstrumented, true, | 1668 testing::kAsanNearNullptrAccessHeapCorruptionInstrumented, true, |
| 1630 kAsanHandlingException, kAsanNearNullptrAccessHeapCorruption); | 1669 kAsanHandlingException, kAsanNearNullptrAccessHeapCorruption); |
| 1631 OutOfProcessAsanErrorCheckAndValidateLog( | 1670 OutOfProcessAsanErrorCheckAndValidateLog( |
| 1632 testing::kAsanNearNullptrAccessHeapCorruptionUninstrumented, true, | 1671 testing::kAsanNearNullptrAccessHeapCorruptionUninstrumented, true, |
| 1633 kAsanHandlingException, kAsanNearNullptrAccessHeapCorruption); | 1672 kAsanHandlingException, kAsanNearNullptrAccessHeapCorruption); |
| 1634 OutOfProcessAsanErrorCheckAndValidateLog( | 1673 OutOfProcessAsanErrorCheckAndValidateLog( |
| 1635 testing::kAsanNearNullptrAccessNoHeapCorruptionInstrumented, true, | 1674 testing::kAsanNearNullptrAccessNoHeapCorruptionInstrumented, true, |
| 1636 kAsanHandlingException, kAsanNearNullptrAccessNoHeapCorruption); | 1675 kAsanHandlingException, kAsanNearNullptrAccessNoHeapCorruption); |
| 1637 OutOfProcessAsanErrorCheckAndValidateLog( | 1676 OutOfProcessAsanErrorCheckAndValidateLog( |
| 1638 testing::kAsanNearNullptrAccessNoHeapCorruptionUninstrumented, true, | 1677 testing::kAsanNearNullptrAccessNoHeapCorruptionUninstrumented, true, |
| 1639 kAsanHandlingException, kAsanNearNullptrAccessNoHeapCorruption); | 1678 kAsanHandlingException, kAsanNearNullptrAccessNoHeapCorruption); |
| 1640 OutOfProcessAsanErrorCheckAndValidateLog( | 1679 OutOfProcessAsanErrorCheckAndValidateLog( |
| 1641 testing::kAsanNullptrAccessNoHeapCorruptionUninstrumented, true, | 1680 testing::kAsanNullptrAccessNoHeapCorruptionUninstrumented, true, |
| 1642 kAsanHandlingException, kAsanNearNullptrAccessNoHeapCorruption); | 1681 kAsanHandlingException, kAsanNearNullptrAccessNoHeapCorruption); |
| 1643 } | 1682 } |
| 1644 | 1683 |
| 1684 // Instantiate the test cases only with SYZYGY until some problems are fixed. | |
| 1685 INSTANTIATE_TEST_CASE_P(InstantiationName, | |
| 1686 ParametrizedInstrumentAppIntegrationTest, | |
| 1687 testing::Values(SYZYGY)); | |
| 1688 | |
| 1645 TEST_F(InstrumentAppIntegrationTest, BBEntryEndToEnd) { | 1689 TEST_F(InstrumentAppIntegrationTest, BBEntryEndToEnd) { |
| 1646 ASSERT_NO_FATAL_FAILURE(StartService()); | 1690 ASSERT_NO_FATAL_FAILURE(StartService()); |
| 1647 ASSERT_NO_FATAL_FAILURE(EndToEndTest("bbentry")); | 1691 ASSERT_NO_FATAL_FAILURE(EndToEndTest("bbentry")); |
| 1648 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1692 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1649 ASSERT_NO_FATAL_FAILURE(BBEntryInvokeTestDll()); | 1693 ASSERT_NO_FATAL_FAILURE(BBEntryInvokeTestDll()); |
| 1650 ASSERT_NO_FATAL_FAILURE(StopService()); | 1694 ASSERT_NO_FATAL_FAILURE(StopService()); |
| 1651 ASSERT_NO_FATAL_FAILURE(BBEntryCheckTestDll()); | 1695 ASSERT_NO_FATAL_FAILURE(BBEntryCheckTestDll()); |
| 1652 } | 1696 } |
| 1653 | 1697 |
| 1654 TEST_F(InstrumentAppIntegrationTest, BranchEndToEnd) { | 1698 TEST_F(InstrumentAppIntegrationTest, BranchEndToEnd) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1743 | 1787 |
| 1744 TEST_F(InstrumentAppIntegrationTest, DeferredFreeTLS) { | 1788 TEST_F(InstrumentAppIntegrationTest, DeferredFreeTLS) { |
| 1745 ASSERT_NO_FATAL_FAILURE(StartService()); | 1789 ASSERT_NO_FATAL_FAILURE(StartService()); |
| 1746 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1790 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1747 ASSERT_EQ(0, InvokeTestDllFunction(testing::kAsanDeferredFreeTLS)); | 1791 ASSERT_EQ(0, InvokeTestDllFunction(testing::kAsanDeferredFreeTLS)); |
| 1748 ASSERT_NO_FATAL_FAILURE(UnloadDll()); | 1792 ASSERT_NO_FATAL_FAILURE(UnloadDll()); |
| 1749 ASSERT_NO_FATAL_FAILURE(StopService()); | 1793 ASSERT_NO_FATAL_FAILURE(StopService()); |
| 1750 } | 1794 } |
| 1751 | 1795 |
| 1752 } // namespace integration_tests | 1796 } // namespace integration_tests |
| OLD | NEW |