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

Side by Side Diff: base/tools_sanity_unittest.cc

Issue 217023002: Fix an ADDRESS_SANITIZER guard so that it works with SyzyASAN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 } // namespace 88 } // namespace
89 89
90 // A memory leak detector should report an error in this test. 90 // A memory leak detector should report an error in this test.
91 TEST(ToolsSanityTest, MemoryLeak) { 91 TEST(ToolsSanityTest, MemoryLeak) {
92 // Without the |volatile|, clang optimizes away the next two lines. 92 // Without the |volatile|, clang optimizes away the next two lines.
93 int* volatile leak = new int[256]; // Leak some memory intentionally. 93 int* volatile leak = new int[256]; // Leak some memory intentionally.
94 leak[4] = 1; // Make sure the allocated memory is used. 94 leak[4] = 1; // Make sure the allocated memory is used.
95 } 95 }
96 96
97 #if defined(ADDRESS_SANITIZER) && (defined(OS_IOS) || defined(OS_WIN)) 97 #if (defined(ADDRESS_SANITIZER) && defined(OS_IOS)) || defined(SYZYASAN)
98 // Because iOS doesn't support death tests, each of the following tests will 98 // Because iOS doesn't support death tests, each of the following tests will
99 // crash the whole program under Asan. On Windows Asan is based on SyzyAsan, the 99 // crash the whole program under Asan. On Windows Asan is based on SyzyAsan; the
100 // error report mecanism is different than with Asan so those test will fail. 100 // error report mechanism is different than with Asan so these tests will fail.
101 #define MAYBE_AccessesToNewMemory DISABLED_AccessesToNewMemory 101 #define MAYBE_AccessesToNewMemory DISABLED_AccessesToNewMemory
102 #define MAYBE_AccessesToMallocMemory DISABLED_AccessesToMallocMemory 102 #define MAYBE_AccessesToMallocMemory DISABLED_AccessesToMallocMemory
103 #else 103 #else
104 #define MAYBE_AccessesToNewMemory AccessesToNewMemory 104 #define MAYBE_AccessesToNewMemory AccessesToNewMemory
105 #define MAYBE_AccessesToMallocMemory AccessesToMallocMemory 105 #define MAYBE_AccessesToMallocMemory AccessesToMallocMemory
106 #define MAYBE_ArrayDeletedWithoutBraces ArrayDeletedWithoutBraces 106 #define MAYBE_ArrayDeletedWithoutBraces ArrayDeletedWithoutBraces
107 #define MAYBE_SingleElementDeletedWithBraces SingleElementDeletedWithBraces 107 #define MAYBE_SingleElementDeletedWithBraces SingleElementDeletedWithBraces
108 #endif 108 #endif
109 109
110 // The following tests pass with Clang r170392, but not r172454, which 110 // The following tests pass with Clang r170392, but not r172454, which
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 TEST(ToolsSanityTest, AtomicsAreIgnored) { 275 TEST(ToolsSanityTest, AtomicsAreIgnored) {
276 base::subtle::Atomic32 shared = 0; 276 base::subtle::Atomic32 shared = 0;
277 ReleaseStoreThread thread1(&shared); 277 ReleaseStoreThread thread1(&shared);
278 AcquireLoadThread thread2(&shared); 278 AcquireLoadThread thread2(&shared);
279 RunInParallel(&thread1, &thread2); 279 RunInParallel(&thread1, &thread2);
280 EXPECT_EQ(kMagicValue, shared); 280 EXPECT_EQ(kMagicValue, shared);
281 } 281 }
282 282
283 } // namespace base 283 } // 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