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

Side by Side Diff: base/tools_sanity_unittest.cc

Issue 12089018: Disable ToolsSanityTest.ArrayDeletedWithoutBraces and ToolsSanityTest.SingleElementDeletedWithBraces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // This file contains intentional memory errors, some of which may lead to 5 // This file contains intentional memory errors, some of which may lead to
6 // crashes if the test is ran without special memory testing tools. We use these 6 // crashes if the test is ran without special memory testing tools. We use these
7 // errors to verify the sanity of the tools. 7 // errors to verify the sanity of the tools.
8 8
9 #include "base/atomicops.h" 9 #include "base/atomicops.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 int* volatile leak = new int[256]; // Leak some memory intentionally. 83 int* volatile leak = new int[256]; // Leak some memory intentionally.
84 leak[4] = 1; // Make sure the allocated memory is used. 84 leak[4] = 1; // Make sure the allocated memory is used.
85 } 85 }
86 86
87 #if defined(ADDRESS_SANITIZER) && (defined(OS_IOS) || defined(OS_WIN)) 87 #if defined(ADDRESS_SANITIZER) && (defined(OS_IOS) || defined(OS_WIN))
88 // Because iOS doesn't support death tests, each of the following tests will 88 // Because iOS doesn't support death tests, each of the following tests will
89 // crash the whole program under Asan. On Windows Asan is based on SyzyAsan, the 89 // crash the whole program under Asan. On Windows Asan is based on SyzyAsan, the
90 // error report mecanism is different than with Asan so those test will fail. 90 // error report mecanism is different than with Asan so those test will fail.
91 #define MAYBE_AccessesToNewMemory DISABLED_AccessesToNewMemory 91 #define MAYBE_AccessesToNewMemory DISABLED_AccessesToNewMemory
92 #define MAYBE_AccessesToMallocMemory DISABLED_AccessesToMallocMemory 92 #define MAYBE_AccessesToMallocMemory DISABLED_AccessesToMallocMemory
93 #define MAYBE_ArrayDeletedWithoutBraces DISABLED_ArrayDeletedWithoutBraces
94 #define MAYBE_SingleElementDeletedWithBraces \
95 DISABLED_SingleElementDeletedWithBraces
96 #else 93 #else
97 #define MAYBE_AccessesToNewMemory AccessesToNewMemory 94 #define MAYBE_AccessesToNewMemory AccessesToNewMemory
98 #define MAYBE_AccessesToMallocMemory AccessesToMallocMemory 95 #define MAYBE_AccessesToMallocMemory AccessesToMallocMemory
99 #define MAYBE_ArrayDeletedWithoutBraces ArrayDeletedWithoutBraces 96 #define MAYBE_ArrayDeletedWithoutBraces ArrayDeletedWithoutBraces
100 #define MAYBE_SingleElementDeletedWithBraces SingleElementDeletedWithBraces 97 #define MAYBE_SingleElementDeletedWithBraces SingleElementDeletedWithBraces
101 #endif 98 #endif
99
100 // The following tests pass with Clang r170392, but not r172454, which
101 // makes AddressSanitizer detect errors in them. We disable these tests under
102 // AddressSanitizer until we fully switch to Clang r172454. After that the
103 // tests should be put back under the (defined(OS_IOS) || defined(OS_WIN))
104 // clause above.
105 // See also http://crbug.com/172614.
106 #if defined(ADDRESS_SANITIZER)
107 #define MAYBE_SingleElementDeletedWithBraces \
108 DISABLED_SingleElementDeletedWithBraces
109 #define MAYBE_ArrayDeletedWithoutBraces DISABLED_ArrayDeletedWithoutBraces
110 #endif
102 TEST(ToolsSanityTest, MAYBE_AccessesToNewMemory) { 111 TEST(ToolsSanityTest, MAYBE_AccessesToNewMemory) {
103 char *foo = new char[10]; 112 char *foo = new char[10];
104 MakeSomeErrors(foo, 10); 113 MakeSomeErrors(foo, 10);
105 delete [] foo; 114 delete [] foo;
106 // Use after delete. 115 // Use after delete.
107 HARMFUL_ACCESS(foo[5] = 0, "heap-use-after-free"); 116 HARMFUL_ACCESS(foo[5] = 0, "heap-use-after-free");
108 } 117 }
109 118
110 TEST(ToolsSanityTest, MAYBE_AccessesToMallocMemory) { 119 TEST(ToolsSanityTest, MAYBE_AccessesToMallocMemory) {
111 char *foo = reinterpret_cast<char*>(malloc(10)); 120 char *foo = reinterpret_cast<char*>(malloc(10));
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 263
255 TEST(ToolsSanityTest, AtomicsAreIgnored) { 264 TEST(ToolsSanityTest, AtomicsAreIgnored) {
256 base::subtle::Atomic32 shared = 0; 265 base::subtle::Atomic32 shared = 0;
257 ReleaseStoreThread thread1(&shared); 266 ReleaseStoreThread thread1(&shared);
258 AcquireLoadThread thread2(&shared); 267 AcquireLoadThread thread2(&shared);
259 RunInParallel(&thread1, &thread2); 268 RunInParallel(&thread1, &thread2);
260 EXPECT_EQ(kMagicValue, shared); 269 EXPECT_EQ(kMagicValue, shared);
261 } 270 }
262 271
263 } // namespace base 272 } // namespace base
OLDNEW
« 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