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

Unified Diff: base/tools_sanity_unittest.cc

Issue 8491013: More sanity unittests to make sure AddressSanitizer is instrumenting the code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698