summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-01-13 20:02:03 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-01-13 20:02:03 +0000
commitfc411a9eb44c912f867b49a08d4ea98be89681d9 (patch)
tree83d2530c824b866f040519d74b68316c571e0986 /test
parent4e3a0d5a8f750527f2f433019967f8f8214c558a (diff)
Notes
Diffstat (limited to 'test')
-rw-r--r--test/cfi/CMakeLists.txt4
-rw-r--r--test/msan/insertvalue_origin.cc1
-rw-r--r--test/profile/Linux/instrprof-basic.c31
-rw-r--r--test/profile/Linux/instrprof-dlopen.test34
-rw-r--r--test/profile/Linux/instrprof-dynamic-one-shared.test23
-rw-r--r--test/profile/Linux/instrprof-dynamic-two-shared.test24
-rw-r--r--test/profile/Linux/lit.local.cfg37
-rw-r--r--test/profile/instrprof-shared.test2
-rw-r--r--test/profile/instrprof-value-prof.c164
-rw-r--r--test/profile/instrprof-version-mismatch.c11
-rw-r--r--test/safestack/overflow.c4
-rw-r--r--test/sanitizer_common/TestCases/Linux/closedir.c5
-rw-r--r--test/tsan/mmap_stress.cc41
-rw-r--r--test/ubsan/TestCases/Integer/suppressions.cpp18
14 files changed, 274 insertions, 125 deletions
diff --git a/test/cfi/CMakeLists.txt b/test/cfi/CMakeLists.txt
index c4f7eb92c524a..5626a6e50ed79 100644
--- a/test/cfi/CMakeLists.txt
+++ b/test/cfi/CMakeLists.txt
@@ -6,10 +6,12 @@ configure_lit_site_cfg(
set(CFI_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND CFI_TEST_DEPS
- cfi
opt
ubsan
)
+ if(COMPILER_RT_HAS_CFI)
+ list(APPEND CFI_TEST_DEPS cfi)
+ endif()
if(LLVM_ENABLE_PIC AND LLVM_BINUTILS_INCDIR)
list(APPEND CFI_TEST_DEPS
LLVMgold
diff --git a/test/msan/insertvalue_origin.cc b/test/msan/insertvalue_origin.cc
index 96d27f08937e0..a0c70023f2f6f 100644
--- a/test/msan/insertvalue_origin.cc
+++ b/test/msan/insertvalue_origin.cc
@@ -4,7 +4,6 @@
// RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
// Test origin propagation through insertvalue IR instruction.
-// REQUIRES: stable-runtime
#include <stdio.h>
#include <stdint.h>
diff --git a/test/profile/Linux/instrprof-basic.c b/test/profile/Linux/instrprof-basic.c
new file mode 100644
index 0000000000000..7ae683d9bd9ea
--- /dev/null
+++ b/test/profile/Linux/instrprof-basic.c
@@ -0,0 +1,31 @@
+// RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t -O3 %s
+// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
+// RUN: llvm-profdata merge -o %t.profdata %t.profraw
+// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
+
+int begin(int i) {
+ // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
+ if (i)
+ return 0;
+ return 1;
+}
+
+int end(int i) {
+ // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
+ if (i)
+ return 0;
+ return 1;
+}
+
+int main(int argc, const char *argv[]) {
+ begin(0);
+ end(1);
+
+ // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
+ if (argc)
+ return 0;
+ return 1;
+}
+
+// CHECK: ![[PD1]] = !{!"branch_weights", i32 1, i32 2}
+// CHECK: ![[PD2]] = !{!"branch_weights", i32 2, i32 1}
diff --git a/test/profile/Linux/instrprof-dlopen.test b/test/profile/Linux/instrprof-dlopen.test
new file mode 100644
index 0000000000000..618367c5defb8
--- /dev/null
+++ b/test/profile/Linux/instrprof-dlopen.test
@@ -0,0 +1,34 @@
+RUN: mkdir -p %t.d
+RUN: %clang_profgen -o %t.d/func.shared -fPIC -shared -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections %S/../Inputs/instrprof-dlopen-func.c
+RUN: %clang_profgen -o %t.d/func2.shared -fPIC -shared -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections %S/../Inputs/instrprof-dlopen-func2.c
+RUN: %clang -o %t-local -fPIC -DDLOPEN_FUNC_DIR=\"%t.d\" -DDLOPEN_FLAGS="RTLD_LAZY | RTLD_LOCAL" %S/../Inputs/instrprof-dlopen-main.c
+RUN: %clang -o %t-global -fPIC -DDLOPEN_FUNC_DIR=\"%t.d\" -DDLOPEN_FLAGS="RTLD_LAZY | RTLD_GLOBAL" %S/../Inputs/instrprof-dlopen-main.c
+
+RUN: %clang -c -o %t.d/main.o %S/../Inputs/instrprof-dlopen-main.c
+RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t-static %S/../Inputs/instrprof-dlopen-func.c %S/../Inputs/instrprof-dlopen-func2.c %t.d/main.o
+
+RUN: env LLVM_PROFILE_FILE=%t-static.profraw %run %t-static
+RUN: env LLVM_PROFILE_FILE=%t-local.profraw %run %t-local
+RUN: env LLVM_PROFILE_FILE=%t-global.profraw %run %t-global
+
+RUN: llvm-profdata merge -o %t-static.profdata %t-static.profraw
+RUN: llvm-profdata merge -o %t-local.profdata %t-local.profraw
+RUN: llvm-profdata merge -o %t-global.profdata %t-global.profraw
+
+RUN: %clang_profuse=%t-static.profdata -o %t-func.static.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func.c
+RUN: %clang_profuse=%t-local.profdata -o %t-func.local.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func.c
+RUN: %clang_profuse=%t-global.profdata -o %t-func.global.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func.c
+RUN: diff %t-func.static.ll %t-func.local.ll
+RUN: diff %t-func.static.ll %t-func.global.ll
+
+RUN: %clang_profuse=%t-static.profdata -o %t-func2.static.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func2.c
+RUN: %clang_profuse=%t-local.profdata -o %t-func2.local.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func2.c
+RUN: %clang_profuse=%t-global.profdata -o %t-func2.global.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func2.c
+RUN: diff %t-func2.static.ll %t-func2.local.ll
+RUN: diff %t-func2.static.ll %t-func2.global.ll
+
+RUN: %clang_profuse=%t-static.profdata -o %t-main.static.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-main.c
+RUN: %clang_profuse=%t-local.profdata -o %t-main.local.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-main.c
+RUN: %clang_profuse=%t-local.profdata -o %t-main.global.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-main.c
+RUN: diff %t-main.static.ll %t-main.local.ll
+RUN: diff %t-main.static.ll %t-main.global.ll
diff --git a/test/profile/Linux/instrprof-dynamic-one-shared.test b/test/profile/Linux/instrprof-dynamic-one-shared.test
new file mode 100644
index 0000000000000..52f40bf9bee1b
--- /dev/null
+++ b/test/profile/Linux/instrprof-dynamic-one-shared.test
@@ -0,0 +1,23 @@
+RUN: mkdir -p %t.d
+RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t.d/a.shared -fPIC -shared %S/../Inputs/instrprof-dynamic-a.cpp
+RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t-shared -fPIC -rpath %t.d %t.d/a.shared %S/../Inputs/instrprof-dynamic-b.cpp %S/../Inputs/instrprof-dynamic-main.cpp
+
+RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t-static %S/../Inputs/instrprof-dynamic-a.cpp %S/../Inputs/instrprof-dynamic-b.cpp %S/../Inputs/instrprof-dynamic-main.cpp
+
+RUN: env LLVM_PROFILE_FILE=%t-static.profraw %run %t-static
+RUN: env LLVM_PROFILE_FILE=%t-shared.profraw %run %t-shared
+
+RUN: llvm-profdata merge -o %t-static.profdata %t-static.profraw
+RUN: llvm-profdata merge -o %t-shared.profdata %t-shared.profraw
+
+RUN: %clang_profuse=%t-static.profdata -o %t-a.static.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-a.cpp
+RUN: %clang_profuse=%t-shared.profdata -o %t-a.shared.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-a.cpp
+RUN: diff %t-a.static.ll %t-a.shared.ll
+
+RUN: %clang_profuse=%t-static.profdata -o %t-b.static.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-b.cpp
+RUN: %clang_profuse=%t-shared.profdata -o %t-b.shared.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-b.cpp
+RUN: diff %t-b.static.ll %t-b.shared.ll
+
+RUN: %clang_profuse=%t-static.profdata -o %t-main.static.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-main.cpp
+RUN: %clang_profuse=%t-shared.profdata -o %t-main.shared.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-main.cpp
+RUN: diff %t-main.static.ll %t-main.shared.ll
diff --git a/test/profile/Linux/instrprof-dynamic-two-shared.test b/test/profile/Linux/instrprof-dynamic-two-shared.test
new file mode 100644
index 0000000000000..949914603ba46
--- /dev/null
+++ b/test/profile/Linux/instrprof-dynamic-two-shared.test
@@ -0,0 +1,24 @@
+RUN: mkdir -p %t.d
+RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t.d/a.shared -fPIC -shared %S/../Inputs/instrprof-dynamic-a.cpp
+RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t.d/b.shared -fPIC -shared %S/../Inputs/instrprof-dynamic-b.cpp
+RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t-shared -fPIC -rpath %t.d %t.d/a.shared %t.d/b.shared %S/../Inputs/instrprof-dynamic-main.cpp
+
+RUN: %clang_profgen -o %t-static %S/../Inputs/instrprof-dynamic-a.cpp %S/../Inputs/instrprof-dynamic-b.cpp %S/../Inputs/instrprof-dynamic-main.cpp
+
+RUN: env LLVM_PROFILE_FILE=%t-static.profraw %run %t-static
+RUN: env LLVM_PROFILE_FILE=%t-shared.profraw %run %t-shared
+
+RUN: llvm-profdata merge -o %t-static.profdata %t-static.profraw
+RUN: llvm-profdata merge -o %t-shared.profdata %t-shared.profraw
+
+RUN: %clang_profuse=%t-static.profdata -o %t-a.static.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-a.cpp
+RUN: %clang_profuse=%t-shared.profdata -o %t-a.shared.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-a.cpp
+RUN: diff %t-a.static.ll %t-a.shared.ll
+
+RUN: %clang_profuse=%t-static.profdata -o %t-b.static.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-b.cpp
+RUN: %clang_profuse=%t-shared.profdata -o %t-b.shared.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-b.cpp
+RUN: diff %t-b.static.ll %t-b.shared.ll
+
+RUN: %clang_profuse=%t-static.profdata -o %t-main.static.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-main.cpp
+RUN: %clang_profuse=%t-shared.profdata -o %t-main.shared.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-main.cpp
+RUN: diff %t-main.static.ll %t-main.shared.ll
diff --git a/test/profile/Linux/lit.local.cfg b/test/profile/Linux/lit.local.cfg
new file mode 100644
index 0000000000000..c8c79fc7d8a77
--- /dev/null
+++ b/test/profile/Linux/lit.local.cfg
@@ -0,0 +1,37 @@
+import subprocess
+
+def getRoot(config):
+ if not config.parent:
+ return config
+ return getRoot(config.parent)
+
+
+def is_gold_linker_available():
+
+ if not config.gold_executable:
+ return False
+ try:
+ ld_cmd = subprocess.Popen([config.gold_executable, '--help'], stdout = subprocess.PIPE)
+ ld_out = ld_cmd.stdout.read().decode()
+ ld_cmd.wait()
+ except:
+ return False
+
+ if not '-plugin' in ld_out:
+ return False
+
+ clang_cmd = subprocess.Popen([config.clang, '-fuse-ld=gold', '-xc', '-'],
+ stdin = subprocess.PIPE,
+ stdout = subprocess.PIPE,
+ stderr = subprocess.PIPE)
+ clang_err = clang_cmd.communicate('int main() { return 0; }')[1]
+
+ if not 'invalid linker' in clang_err:
+ return True
+
+ return False
+
+root = getRoot(config)
+
+if root.host_os not in ['Linux'] or not is_gold_linker_available():
+ config.unsupported = True
diff --git a/test/profile/instrprof-shared.test b/test/profile/instrprof-shared.test
index 851578b0f2c0a..b3f0b9ab4bcc9 100644
--- a/test/profile/instrprof-shared.test
+++ b/test/profile/instrprof-shared.test
@@ -3,7 +3,7 @@ This test produces three shared libraries:
1. libt-instr.so is instrumented
2. libt-no-instr1.so is not instrumented
-3. libt-no-instr2.so is compiled with instrumentation enabled, but the object file is built
+3. libt-no-instr2.so is built with profile rt linked in (via -u<hook>), but the object file is built
with instrumentation turned off.
After the libraries are built, the main program is then built with/without instrumentation and linked
diff --git a/test/profile/instrprof-value-prof.c b/test/profile/instrprof-value-prof.c
index 3ccecbe755937..f09e1ac432f18 100644
--- a/test/profile/instrprof-value-prof.c
+++ b/test/profile/instrprof-value-prof.c
@@ -6,9 +6,7 @@
// RUN: llvm-profdata merge -o %t-merged.profdata %t.profraw %t-2.profdata
// RUN: llvm-profdata show --all-functions -ic-targets %t-2.profdata | FileCheck %s -check-prefix=NO-VALUE
// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata | FileCheck %s
-// value profile merging current do sorting based on target values -- this will destroy the order of the target
-// in the list leading to comparison problem. For now just check a small subset of output.
-// RUN: llvm-profdata show --all-functions -ic-targets %t-merged.profdata | FileCheck %s -check-prefix=MERGE
+// RUN: llvm-profdata show --all-functions -ic-targets %t-merged.profdata | FileCheck %s
//
// RUN: env LLVM_PROFILE_FILE=%t-3.profraw LLVM_VP_BUFFER_SIZE=1 %run %t 1
// RUN: env LLVM_PROFILE_FILE=%t-4.profraw LLVM_VP_BUFFER_SIZE=8 %run %t 1
@@ -126,128 +124,102 @@ int main(int argc, const char *argv[]) {
// NO-VALUE: Indirect Call Site Count: 127
// NO-VALUE-NEXT: Indirect Target Results:
-// MERGE-LABEL: caller_1_1_1_1_2_2_1:
-// MERGE: Indirect Call Site Count: 6
-// MERGE: Indirect Target Results:
-// MERGE: [ 1, callee_1_1_1, 1 ]
-// MERGE: [ 2, callee_1_1_1, 1 ]
-// MERGE: [ 2, callee_1_1_2, 2 ]
-// MERGE: [ 3, callee_1_1_1, 1 ]
-// MERGE: [ 3, callee_1_1_2, 2 ]
-// MERGE: [ 3, callee_1_2_1, 3 ]
-// MERGE: [ 4, callee_1_1_1, 1 ]
-// MERGE: [ 4, callee_1_1_2, 2 ]
-// MERGE: [ 4, callee_1_2_1, 3 ]
-// MERGE: [ 4, callee_1_2_2, 4 ]
-// MERGE: [ 5, callee_1_1_1, 1 ]
-// MERGE: [ 5, callee_1_1_2, 2 ]
-// MERGE: [ 5, callee_1_2_1, 3 ]
-// MERGE: [ 5, callee_1_2_2, 4 ]
-// MERGE: [ 5, callee_2_1_1, 5 ]
-// MERGE-LABEL: caller_2_2_2_2_2_2_2:
-// MERGE: Indirect Call Site Count: 127
-// MERGE-NEXT: Indirect Target Results:
-// MERGE-NEXT: [ 1, callee_1_1_1, 1 ]
-// MERGE: [ 2, callee_1_1_1, 1 ]
-// MERGE: [ 2, callee_1_1_2, 2 ]
-// MERGE: [ 3, callee_1_1_1, 1 ]
-// MERGE: [ 3, callee_1_1_2, 2 ]
-// MERGE: [ 3, callee_1_2_1, 3 ]
// CHECK-LABEL: caller_1_1_1_1_2_2_1:
// CHECK: Indirect Call Site Count: 6
// CHECK-NEXT: Indirect Target Results:
// CHECK-NEXT: [ 1, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 2, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 2, callee_1_1_2, 2 ]
-// CHECK-NEXT: [ 3, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 3, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 2, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 3, callee_1_2_1, 3 ]
-// CHECK-NEXT: [ 4, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 4, callee_1_1_2, 2 ]
-// CHECK-NEXT: [ 4, callee_1_2_1, 3 ]
+// CHECK-NEXT: [ 3, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 3, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 4, callee_1_2_2, 4 ]
-// CHECK-NEXT: [ 5, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 5, callee_1_1_2, 2 ]
-// CHECK-NEXT: [ 5, callee_1_2_1, 3 ]
-// CHECK-NEXT: [ 5, callee_1_2_2, 4 ]
+// CHECK-NEXT: [ 4, callee_1_2_1, 3 ]
+// CHECK-NEXT: [ 4, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 4, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 5, callee_2_1_1, 5 ]
+// CHECK-NEXT: [ 5, callee_1_2_2, 4 ]
+// CHECK-NEXT: [ 5, callee_1_2_1, 3 ]
+// CHECK-NEXT: [ 5, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 5, callee_1_1_1, 1 ]
// CHECK-LABEL: caller_2_2_2_2_2_2_2:
// CHECK: Indirect Call Site Count: 127
// CHECK-NEXT: Indirect Target Results:
// CHECK-NEXT: [ 1, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 2, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 2, callee_1_1_2, 2 ]
-// CHECK-NEXT: [ 3, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 3, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 2, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 3, callee_1_2_1, 3 ]
-// CHECK-NEXT: [ 4, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 4, callee_1_1_2, 2 ]
-// CHECK-NEXT: [ 4, callee_1_2_1, 3 ]
+// CHECK-NEXT: [ 3, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 3, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 4, callee_1_2_2, 4 ]
-// CHECK-NEXT: [ 5, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 5, callee_1_1_2, 2 ]
-// CHECK-NEXT: [ 5, callee_1_2_1, 3 ]
-// CHECK-NEXT: [ 5, callee_1_2_2, 4 ]
+// CHECK-NEXT: [ 4, callee_1_2_1, 3 ]
+// CHECK-NEXT: [ 4, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 4, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 5, callee_2_1_1, 5 ]
-// CHECK-NEXT: [ 6, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 6, callee_1_1_2, 2 ]
-// CHECK-NEXT: [ 6, callee_1_2_1, 3 ]
-// CHECK-NEXT: [ 6, callee_1_2_2, 4 ]
-// CHECK-NEXT: [ 6, callee_2_1_1, 5 ]
+// CHECK-NEXT: [ 5, callee_1_2_2, 4 ]
+// CHECK-NEXT: [ 5, callee_1_2_1, 3 ]
+// CHECK-NEXT: [ 5, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 5, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 6, callee_2_1_2, 6 ]
-// CHECK-NEXT: [ 7, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 7, callee_1_1_2, 2 ]
-// CHECK-NEXT: [ 7, callee_1_2_1, 3 ]
-// CHECK-NEXT: [ 7, callee_1_2_2, 4 ]
-// CHECK-NEXT: [ 7, callee_2_1_1, 5 ]
-// CHECK-NEXT: [ 7, callee_2_1_2, 6 ]
+// CHECK-NEXT: [ 6, callee_2_1_1, 5 ]
+// CHECK-NEXT: [ 6, callee_1_2_2, 4 ]
+// CHECK-NEXT: [ 6, callee_1_2_1, 3 ]
+// CHECK-NEXT: [ 6, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 6, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 7, callee_2_2_1, 7 ]
+// CHECK-NEXT: [ 7, callee_2_1_2, 6 ]
+// CHECK-NEXT: [ 7, callee_2_1_1, 5 ]
+// CHECK-NEXT: [ 7, callee_1_2_2, 4 ]
+// CHECK-NEXT: [ 7, callee_1_2_1, 3 ]
+// CHECK-NEXT: [ 7, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 7, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 9, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 10, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 10, callee_1_1_2, 2 ]
-// CHECK-NEXT: [ 11, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 11, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 10, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 11, callee_1_2_1, 3 ]
-// CHECK-NEXT: [ 12, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 12, callee_1_1_2, 2 ]
-// CHECK-NEXT: [ 12, callee_1_2_1, 3 ]
+// CHECK-NEXT: [ 11, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 11, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 12, callee_1_2_2, 4 ]
-// CHECK-NEXT: [ 13, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 13, callee_1_1_2, 2 ]
-// CHECK-NEXT: [ 13, callee_1_2_1, 3 ]
-// CHECK-NEXT: [ 13, callee_1_2_2, 4 ]
+// CHECK-NEXT: [ 12, callee_1_2_1, 3 ]
+// CHECK-NEXT: [ 12, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 12, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 13, callee_2_1_1, 5 ]
-// CHECK-NEXT: [ 14, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 14, callee_1_1_2, 2 ]
-// CHECK-NEXT: [ 14, callee_1_2_1, 3 ]
-// CHECK-NEXT: [ 14, callee_1_2_2, 4 ]
-// CHECK-NEXT: [ 14, callee_2_1_1, 5 ]
+// CHECK-NEXT: [ 13, callee_1_2_2, 4 ]
+// CHECK-NEXT: [ 13, callee_1_2_1, 3 ]
+// CHECK-NEXT: [ 13, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 13, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 14, callee_2_1_2, 6 ]
-// CHECK-NEXT: [ 15, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 15, callee_1_1_2, 2 ]
-// CHECK-NEXT: [ 15, callee_1_2_1, 3 ]
-// CHECK-NEXT: [ 15, callee_1_2_2, 4 ]
-// CHECK-NEXT: [ 15, callee_2_1_1, 5 ]
-// CHECK-NEXT: [ 15, callee_2_1_2, 6 ]
+// CHECK-NEXT: [ 14, callee_2_1_1, 5 ]
+// CHECK-NEXT: [ 14, callee_1_2_2, 4 ]
+// CHECK-NEXT: [ 14, callee_1_2_1, 3 ]
+// CHECK-NEXT: [ 14, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 14, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 15, callee_2_2_1, 7 ]
+// CHECK-NEXT: [ 15, callee_2_1_2, 6 ]
+// CHECK-NEXT: [ 15, callee_2_1_1, 5 ]
+// CHECK-NEXT: [ 15, callee_1_2_2, 4 ]
+// CHECK-NEXT: [ 15, callee_1_2_1, 3 ]
+// CHECK-NEXT: [ 15, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 15, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 17, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 18, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 18, callee_1_1_2, 2 ]
-// CHECK-NEXT: [ 19, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 19, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 18, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 19, callee_1_2_1, 3 ]
-// CHECK-NEXT: [ 20, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 20, callee_1_1_2, 2 ]
-// CHECK-NEXT: [ 20, callee_1_2_1, 3 ]
+// CHECK-NEXT: [ 19, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 19, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 20, callee_1_2_2, 4 ]
-// CHECK-NEXT: [ 21, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 21, callee_1_1_2, 2 ]
-// CHECK-NEXT: [ 21, callee_1_2_1, 3 ]
-// CHECK-NEXT: [ 21, callee_1_2_2, 4 ]
+// CHECK-NEXT: [ 20, callee_1_2_1, 3 ]
+// CHECK-NEXT: [ 20, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 20, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 21, callee_2_1_1, 5 ]
-// CHECK-NEXT: [ 22, callee_1_1_1, 1 ]
-// CHECK-NEXT: [ 22, callee_1_1_2, 2 ]
-// CHECK-NEXT: [ 22, callee_1_2_1, 3 ]
-// CHECK-NEXT: [ 22, callee_1_2_2, 4 ]
+// CHECK-NEXT: [ 21, callee_1_2_2, 4 ]
+// CHECK-NEXT: [ 21, callee_1_2_1, 3 ]
+// CHECK-NEXT: [ 21, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 21, callee_1_1_1, 1 ]
+// CHECK-NEXT: [ 22, callee_2_1_2, 6 ]
// CHECK-NEXT: [ 22, callee_2_1_1, 5 ]
+// CHECK-NEXT: [ 22, callee_1_2_2, 4 ]
+// CHECK-NEXT: [ 22, callee_1_2_1, 3 ]
+// CHECK-NEXT: [ 22, callee_1_1_2, 2 ]
+// CHECK-NEXT: [ 22, callee_1_1_1, 1 ]
diff --git a/test/profile/instrprof-version-mismatch.c b/test/profile/instrprof-version-mismatch.c
new file mode 100644
index 0000000000000..49ce41177d3a5
--- /dev/null
+++ b/test/profile/instrprof-version-mismatch.c
@@ -0,0 +1,11 @@
+// RUN: %clang_profgen -o %t -O3 %s
+// RUN: LLVM_PROFILE_VERBOSE_ERRORS=1 %run %t 1 2>&1 | FileCheck %s
+
+// override the version variable with a bogus version:
+unsigned long long __llvm_profile_raw_version = 10000;
+int main(int argc, const char *argv[]) {
+ if (argc < 2)
+ return 1;
+ return 0;
+}
+// CHECK: LLVM Profile: runtime and instrumentation version mismatch
diff --git a/test/safestack/overflow.c b/test/safestack/overflow.c
index 27436947e49cf..62f86536916ef 100644
--- a/test/safestack/overflow.c
+++ b/test/safestack/overflow.c
@@ -17,9 +17,13 @@ void fct(volatile int *buffer)
int main(int argc, char **argv)
{
+ int prebuf[7];
int value1 = 42;
int buffer[5];
int value2 = 42;
+ int postbuf[7];
+ fct(prebuf + 1);
+ fct(postbuf + 1);
fct(buffer);
return value1 != 42 || value2 != 42;
}
diff --git a/test/sanitizer_common/TestCases/Linux/closedir.c b/test/sanitizer_common/TestCases/Linux/closedir.c
new file mode 100644
index 0000000000000..990628db40273
--- /dev/null
+++ b/test/sanitizer_common/TestCases/Linux/closedir.c
@@ -0,0 +1,5 @@
+// Check that closedir(NULL) is ok.
+// RUN: %clang -O2 %s -o %t && %run %t
+#include <sys/types.h>
+#include <dirent.h>
+int main() { closedir(0); }
diff --git a/test/tsan/mmap_stress.cc b/test/tsan/mmap_stress.cc
index 5e3904adf90ba..e01e7e92b8f93 100644
--- a/test/tsan/mmap_stress.cc
+++ b/test/tsan/mmap_stress.cc
@@ -9,8 +9,11 @@ void *SubWorker(void *arg) {
for (int i = 0; i < 500; i++) {
int *ptr = (int*)mmap(0, kMmapSize, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON, -1, 0);
+ if (ptr == MAP_FAILED)
+ exit(printf("mmap failed: %d\n", errno));
*ptr = 42;
- munmap(ptr, kMmapSize);
+ if (munmap(ptr, kMmapSize))
+ exit(printf("munmap failed: %d\n", errno));
}
return 0;
}
@@ -18,29 +21,41 @@ void *SubWorker(void *arg) {
void *Worker1(void *arg) {
(void)arg;
pthread_t th[4];
- for (int i = 0; i < 4; i++)
- pthread_create(&th[i], 0, SubWorker, 0);
- for (int i = 0; i < 4; i++)
- pthread_join(th[i], 0);
+ for (int i = 0; i < 4; i++) {
+ if (pthread_create(&th[i], 0, SubWorker, 0))
+ exit(printf("pthread_create failed: %d\n", errno));
+ }
+ for (int i = 0; i < 4; i++) {
+ if (pthread_join(th[i], 0))
+ exit(printf("pthread_join failed: %d\n", errno));
+ }
return 0;
}
void *Worker(void *arg) {
(void)arg;
pthread_t th[4];
- for (int i = 0; i < 4; i++)
- pthread_create(&th[i], 0, Worker1, 0);
- for (int i = 0; i < 4; i++)
- pthread_join(th[i], 0);
+ for (int i = 0; i < 4; i++) {
+ if (pthread_create(&th[i], 0, Worker1, 0))
+ exit(printf("pthread_create failed: %d\n", errno));
+ }
+ for (int i = 0; i < 4; i++) {
+ if (pthread_join(th[i], 0))
+ exit(printf("pthread_join failed: %d\n", errno));
+ }
return 0;
}
int main() {
pthread_t th[4];
- for (int i = 0; i < 4; i++)
- pthread_create(&th[i], 0, Worker, 0);
- for (int i = 0; i < 4; i++)
- pthread_join(th[i], 0);
+ for (int i = 0; i < 4; i++) {
+ if (pthread_create(&th[i], 0, Worker, 0))
+ exit(printf("pthread_create failed: %d\n", errno));
+ }
+ for (int i = 0; i < 4; i++) {
+ if (pthread_join(th[i], 0))
+ exit(printf("pthread_join failed: %d\n", errno));
+ }
fprintf(stderr, "DONE\n");
}
diff --git a/test/ubsan/TestCases/Integer/suppressions.cpp b/test/ubsan/TestCases/Integer/suppressions.cpp
index e2f632d0725ca..e6ae626db3d73 100644
--- a/test/ubsan/TestCases/Integer/suppressions.cpp
+++ b/test/ubsan/TestCases/Integer/suppressions.cpp
@@ -1,31 +1,23 @@
-// XFAIL: win32
-// On Windows, %t starts with c:\. lit's ShLexer helpfully strips the
-// quotes in the suppressions="%t..." lines below, so the UBSAN_OPTIONS
-// env var that ubsan effectively sees is halt_on_error=1:suppressions=c:\...
-// without any quotes. Since : is ubsan's UBSAN_OPTIONS separator, this
-// confuses sanitizer_flag_parser.
-// FIXME: Figure out how to make this test go on Windows.
-
// RUN: %clangxx -fsanitize=integer -g0 %s -o %t
// Fails without any suppression.
// RUN: %env_ubsan_opts=halt_on_error=1 not %run %t 2>&1 | FileCheck %s
// RUN: echo "signed-integer-overflow:%t" > %t.wrong-supp
-// RUN: %env_ubsan_opts=halt_on_error=1:suppressions="%t.wrong-supp" not %run %t 2>&1 | FileCheck %s
+// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.wrong-supp"' not %run %t 2>&1 | FileCheck %s
// RUN: echo "unsigned-integer-overflow:do_overflow" > %t.func-supp
-// RUN: %env_ubsan_opts=halt_on_error=1:suppressions="%t.func-supp" %run %t
+// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.func-supp"' %run %t
// RUN: echo "unsigned-integer-overflow:%t" > %t.module-supp
-// RUN: %env_ubsan_opts=halt_on_error=1:suppressions="%t.module-supp" %run %t
+// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.module-supp"' %run %t
// Note: file-level suppressions should work even without debug info.
// RUN: echo "unsigned-integer-overflow:%s" > %t.file-supp
-// RUN: %env_ubsan_opts=halt_on_error=1:suppressions="%t.file-supp" %run %t
+// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.file-supp"' %run %t
// Suppressions don't work for unrecoverable kinds.
// RUN: %clangxx -fsanitize=integer -fno-sanitize-recover=integer %s -o %t-norecover
-// RUN: %env_ubsan_opts=halt_on_error=1:suppressions="%t.module-supp" not %run %t-norecover 2>&1 | FileCheck %s
+// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.module-supp"' not %run %t-norecover 2>&1 | FileCheck %s
#include <stdint.h>