Skip to content

Commit edbb972

Browse files
committed
[MSan] Switch to common aligned allocs tests.
Summary: Switch to aligned_alloc and posix_memalign tests in sanitizer_common and delete the MSan-specific ones. Reviewers: vitalybuka Subscribers: srhines, kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D47968 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334340 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent c6bb0cc commit edbb972

File tree

5 files changed

+8
-53
lines changed

5 files changed

+8
-53
lines changed

test/msan/Linux/aligned_alloc-alignment.cc

Lines changed: 0 additions & 26 deletions
This file was deleted.

test/msan/posix_memalign-alignment.cc

Lines changed: 0 additions & 22 deletions
This file was deleted.

test/sanitizer_common/TestCases/Linux/aligned_alloc-alignment.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
// RUN: %clangxx -O0 %s -o %t
1+
// RUN: %clangxx %collect_stack_traces -O0 %s -o %t
22
// RUN: %env_tool_opts=allocator_may_return_null=0 not %run %t 17 2>&1 | FileCheck %s
33
// RUN: %env_tool_opts=allocator_may_return_null=0 not %run %t 0 2>&1 | FileCheck %s
44
// RUN: %env_tool_opts=allocator_may_return_null=1 %run %t 17 2>&1 | FileCheck %s --check-prefix=CHECK-NULL
55
// RUN: %env_tool_opts=allocator_may_return_null=1 %run %t 0 2>&1 | FileCheck %s --check-prefix=CHECK-NULL
66

7-
// UNSUPPORTED: android, msan, tsan, ubsan
8-
97
// REQUIRES: stable-runtime
108

9+
// UNSUPPORTED: android, tsan, ubsan
10+
1111
#include <assert.h>
1212
#include <stdio.h>
1313
#include <stdlib.h>

test/sanitizer_common/TestCases/Posix/posix_memalign-alignment.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
// RUN: %clangxx -O0 %s -o %t
1+
// RUN: %clangxx %collect_stack_traces -O0 %s -o %t
22
// RUN: %env_tool_opts=allocator_may_return_null=0 not %run %t 17 2>&1 | FileCheck %s
33
// RUN: %env_tool_opts=allocator_may_return_null=0 not %run %t 0 2>&1 | FileCheck %s
44
// RUN: %env_tool_opts=allocator_may_return_null=1 %run %t 17 2>&1 | FileCheck %s --check-prefix=CHECK-NULL
55
// RUN: %env_tool_opts=allocator_may_return_null=1 %run %t 0 2>&1 | FileCheck %s --check-prefix=CHECK-NULL
66

77
// REQUIRES: stable-runtime
88

9-
// UNSUPPORTED: msan, tsan, ubsan
9+
// UNSUPPORTED: tsan, ubsan
1010

1111
#include <assert.h>
1212
#include <stdio.h>

test/sanitizer_common/lit.common.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ config.test_source_root = os.path.join(os.path.dirname(__file__), "TestCases")
66
config.name = "SanitizerCommon-" + config.name_suffix
77

88
default_tool_options = []
9+
collect_stack_traces = ""
910
if config.tool_name == "asan":
1011
tool_cflags = ["-fsanitize=address"]
1112
tool_options = "ASAN_OPTIONS"
@@ -15,6 +16,7 @@ elif config.tool_name == "tsan":
1516
elif config.tool_name == "msan":
1617
tool_cflags = ["-fsanitize=memory"]
1718
tool_options = "MSAN_OPTIONS"
19+
collect_stack_traces = "-fsanitize-memory-track-origins"
1820
elif config.tool_name == "lsan":
1921
tool_cflags = ["-fsanitize=leak"]
2022
tool_options = "LSAN_OPTIONS"
@@ -52,6 +54,7 @@ def build_invocation(compile_flags):
5254

5355
config.substitutions.append( ("%clang ", build_invocation(clang_cflags)) )
5456
config.substitutions.append( ("%clangxx ", build_invocation(clang_cxxflags)) )
57+
config.substitutions.append( ("%collect_stack_traces", collect_stack_traces) )
5558
config.substitutions.append( ("%tool_name", config.tool_name) )
5659
config.substitutions.append( ("%tool_options", tool_options) )
5760
config.substitutions.append( ('%env_tool_opts=',

0 commit comments

Comments
 (0)