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

Side by Side Diff: base/tools_sanity_unittest.cc

Issue 1264053002: CFI: Add a death test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build config Created 5 years, 4 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
« no previous file with comments | « no previous file | build/common.gypi » ('j') | 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/debug/asan_invalid_access.h" 10 #include "base/debug/asan_invalid_access.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 } 332 }
333 333
334 TEST(ToolsSanityTest, AtomicsAreIgnored) { 334 TEST(ToolsSanityTest, AtomicsAreIgnored) {
335 base::subtle::Atomic32 shared = 0; 335 base::subtle::Atomic32 shared = 0;
336 ReleaseStoreThread thread1(&shared); 336 ReleaseStoreThread thread1(&shared);
337 AcquireLoadThread thread2(&shared); 337 AcquireLoadThread thread2(&shared);
338 RunInParallel(&thread1, &thread2); 338 RunInParallel(&thread1, &thread2);
339 EXPECT_EQ(kMagicValue, shared); 339 EXPECT_EQ(kMagicValue, shared);
340 } 340 }
341 341
342 #if defined(CFI_ENFORCEMENT)
343 TEST(ToolsSanityTest, BadCast) {
344 class A {
345 virtual void f() {}
346 };
347
348 class B {
349 virtual void f() {}
350 };
351
352 A a;
353 EXPECT_DEATH((void)(B*)&a, "ILL_ILLOPN");
354 }
355 #endif
356
342 } // namespace base 357 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698