Chromium Code Reviews| Index: base/tools_sanity_unittest.cc |
| =================================================================== |
| --- base/tools_sanity_unittest.cc (revision 108853) |
| +++ base/tools_sanity_unittest.cc (working copy) |
| @@ -123,12 +123,37 @@ |
| } |
| #ifdef ADDRESS_SANITIZER |
| -TEST(ToolsSanityTest, DISABLED_AddressSanitizerCrashTest) { |
| +TEST(ToolsSanityTest, DISABLED_AddressSanitizerNullDerefCrashTest) { |
| // Intentionally crash to make sure AddressSanitizer is running. |
| // This test should not be ran on bots. |
| int* volatile zero = NULL; |
| *zero = 0; |
| } |
| + |
| +TEST(ToolsSanityTest, DISABLED_AddressSanitizerLocalOOBCrashTest) { |
| + // Intentionally crash to make sure AddressSanitizer is instrumenting |
| + // the local variables. |
| + // This test should not be ran on bots. |
| + int volatile array[5]; |
|
Nico
2011/11/07 15:32:26
You probably don't need this volatile
Alexander Potapenko
2011/11/07 16:10:44
Done.
|
| + // Work around the OOB warning reported by Clang. |
| + int volatile *access = &(array[5]); |
|
Nico
2011/11/07 15:32:26
This volatile probably needs to be to the right of
Alexander Potapenko
2011/11/07 16:10:44
Done.
|
| + *access = 43; |
| +} |
| + |
| +namespace { |
| + int volatile g_asan_test_global_array[10]; |
|
Nico
2011/11/07 15:32:26
You shouldn't need this volatile either. Also, don
|
| +} // namespace |
| + |
| +TEST(ToolsSanityTest, DISABLED_AddressSanitizerGlobalOOBCrashTest) { |
| + // Intentionally crash to make sure AddressSanitizer is instrumenting |
| + // the global variables. |
| + // This test should not be ran on bots. |
| + |
| + // Work around the OOB warning reported by Clang. |
| + int volatile *access = g_asan_test_global_array - 1; |
|
Nico
2011/11/07 15:32:26
To the right of * as well.
Alexander Potapenko
2011/11/07 16:10:44
Done.
|
| + *access = 43; |
| +} |
| + |
| #endif |
| namespace { |