summaryrefslogtreecommitdiff
path: root/test/Tooling
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2013-12-22 00:07:40 +0000
committerDimitry Andric <dim@FreeBSD.org>2013-12-22 00:07:40 +0000
commitbfef399519ca9b8a4b4c6b563253bad7e0eeffe0 (patch)
treedf8df0b0067b381eab470a3b8f28d14a552a6340 /test/Tooling
parent6a0372513edbc473b538d2f724efac50405d6fef (diff)
Notes
Diffstat (limited to 'test/Tooling')
-rw-r--r--test/Tooling/Inputs/lit.local.cfg1
-rw-r--r--test/Tooling/auto-detect-from-source-parent-of-cwd.cpp6
-rw-r--r--test/Tooling/auto-detect-from-source-parent.cpp2
-rw-r--r--test/Tooling/auto-detect-from-source.cpp2
-rw-r--r--test/Tooling/clang-check-analyzer.cpp4
-rw-r--r--test/Tooling/clang-check-args.cpp2
-rw-r--r--test/Tooling/clang-check-autodetect-dir.cpp2
-rw-r--r--test/Tooling/clang-check-builtin-headers.cpp2
-rw-r--r--test/Tooling/clang-check-chdir.cpp2
-rw-r--r--test/Tooling/clang-check-extra-arg.cpp5
-rw-r--r--test/Tooling/clang-check-pwd.cpp6
-rw-r--r--test/Tooling/clang-check-rel-path.cpp10
-rw-r--r--test/Tooling/clang-check-strip-o.cpp11
-rw-r--r--test/Tooling/clang-check.cpp2
-rw-r--r--test/Tooling/ms-asm-no-target.cpp13
-rw-r--r--test/Tooling/multi-jobs.cpp5
16 files changed, 64 insertions, 11 deletions
diff --git a/test/Tooling/Inputs/lit.local.cfg b/test/Tooling/Inputs/lit.local.cfg
deleted file mode 100644
index e6f55eef7af5..000000000000
--- a/test/Tooling/Inputs/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = []
diff --git a/test/Tooling/auto-detect-from-source-parent-of-cwd.cpp b/test/Tooling/auto-detect-from-source-parent-of-cwd.cpp
index 6b632b0a0d81..d7ec3f60ac7c 100644
--- a/test/Tooling/auto-detect-from-source-parent-of-cwd.cpp
+++ b/test/Tooling/auto-detect-from-source-parent-of-cwd.cpp
@@ -2,11 +2,15 @@
// RUN: mkdir -p %t/abc/def/ijk/qwe
// RUN: echo "[{\"directory\":\".\",\"command\":\"clang++ -c %t/abc/def/ijk/qwe/test.cpp\",\"file\":\"%t/abc/def/ijk/qwe/test.cpp\"}]" | sed -e 's/\\/\\\\/g' > %t/compile_commands.json
// RUN: cp "%s" "%t/abc/def/ijk/qwe/test.cpp"
-// RUN: PWD="%t/abc/def" clang-check "ijk/qwe/test.cpp" 2>&1 | FileCheck %s
+// RUN: ln -sf %t/abc/def %t/abc/def2
+// RUN: cd %t/abc/def2
+// RUN: not env PWD="%t/abc/def" clang-check "ijk/qwe/test.cpp" 2>&1 | FileCheck %s
// CHECK: C++ requires
+// CHECK: /abc/def/ijk/qwe/test.cpp
invalid;
// REQUIRES: shell
// PR15590
// XFAIL: win64
+// XFAIL: mingw
diff --git a/test/Tooling/auto-detect-from-source-parent.cpp b/test/Tooling/auto-detect-from-source-parent.cpp
index f1dbc0fa6743..5f27d5ab8051 100644
--- a/test/Tooling/auto-detect-from-source-parent.cpp
+++ b/test/Tooling/auto-detect-from-source-parent.cpp
@@ -2,7 +2,7 @@
// RUN: mkdir -p %t/abc/def/ijk/qwe
// RUN: echo "[{\"directory\":\".\",\"command\":\"clang++ -c %t/abc/def/ijk/qwe/test.cpp\",\"file\":\"%t/abc/def/ijk/qwe/test.cpp\"}]" | sed -e 's/\\/\\\\/g' > %t/compile_commands.json
// RUN: cp "%s" "%t/abc/def/ijk/qwe/test.cpp"
-// RUN: clang-check "%t/abc/def/ijk/qwe/test.cpp" 2>&1 | FileCheck %s
+// RUN: not clang-check "%t/abc/def/ijk/qwe/test.cpp" 2>&1 | FileCheck %s
// CHECK: C++ requires
invalid;
diff --git a/test/Tooling/auto-detect-from-source.cpp b/test/Tooling/auto-detect-from-source.cpp
index 77e06e781c93..6ff39acdc8c2 100644
--- a/test/Tooling/auto-detect-from-source.cpp
+++ b/test/Tooling/auto-detect-from-source.cpp
@@ -2,7 +2,7 @@
// RUN: mkdir %t
// RUN: echo "[{\"directory\":\".\",\"command\":\"clang++ -c %t/test.cpp\",\"file\":\"%t/test.cpp\"}]" | sed -e 's/\\/\\\\/g' > %t/compile_commands.json
// RUN: cp "%s" "%t/test.cpp"
-// RUN: clang-check "%t/test.cpp" 2>&1 | FileCheck %s
+// RUN: not clang-check "%t/test.cpp" 2>&1 | FileCheck %s
// CHECK: C++ requires
invalid;
diff --git a/test/Tooling/clang-check-analyzer.cpp b/test/Tooling/clang-check-analyzer.cpp
new file mode 100644
index 000000000000..16cf7ce603ba
--- /dev/null
+++ b/test/Tooling/clang-check-analyzer.cpp
@@ -0,0 +1,4 @@
+// RUN: clang-check -analyze "%s" -- -c 2>&1 | FileCheck %s
+
+// CHECK: Dereference of null pointer
+int a(int *x) { if(x){} *x = 47; }
diff --git a/test/Tooling/clang-check-args.cpp b/test/Tooling/clang-check-args.cpp
index 66950ae10391..202b23711865 100644
--- a/test/Tooling/clang-check-args.cpp
+++ b/test/Tooling/clang-check-args.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-check "%s" -- -c 2>&1 | FileCheck %s
+// RUN: not clang-check "%s" -- -c 2>&1 | FileCheck %s
// CHECK: C++ requires
invalid;
diff --git a/test/Tooling/clang-check-autodetect-dir.cpp b/test/Tooling/clang-check-autodetect-dir.cpp
index 39a0c386fe8e..8ef3f3d01734 100644
--- a/test/Tooling/clang-check-autodetect-dir.cpp
+++ b/test/Tooling/clang-check-autodetect-dir.cpp
@@ -2,7 +2,7 @@
// RUN: mkdir -p %t/abc/def
// RUN: echo "[{\"directory\":\".\",\"command\":\"clang++ -c %t/test.cpp\",\"file\":\"%t/test.cpp\"}]" | sed -e 's/\\/\\\\/g' > %t/compile_commands.json
// RUN: cp "%s" "%t/test.cpp"
-// RUN: clang-check -p "%t/abc/def" "%t/test.cpp" 2>&1|FileCheck %s
+// RUN: not clang-check -p "%t/abc/def" "%t/test.cpp" 2>&1|FileCheck %s
// FIXME: Make the above easier.
// CHECK: C++ requires
diff --git a/test/Tooling/clang-check-builtin-headers.cpp b/test/Tooling/clang-check-builtin-headers.cpp
index ed2bea0d656d..76fc9c4b3d01 100644
--- a/test/Tooling/clang-check-builtin-headers.cpp
+++ b/test/Tooling/clang-check-builtin-headers.cpp
@@ -3,7 +3,7 @@
// Add a path that doesn't exist as argv[0] for the compile command line:
// RUN: echo '[{"directory":".","command":"/random/tool -c %t/test.cpp","file":"%t/test.cpp"}]' | sed -e 's/\\/\//g' > %t/compile_commands.json
// RUN: cp "%s" "%t/test.cpp"
-// RUN: clang-check -p "%t" "%t/test.cpp" 2>&1|FileCheck %s
+// RUN: not clang-check -p "%t" "%t/test.cpp" 2>&1|FileCheck %s
// FIXME: Make the above easier.
#include <stddef.h>
diff --git a/test/Tooling/clang-check-chdir.cpp b/test/Tooling/clang-check-chdir.cpp
index c8113233fa25..fbe8a19aa152 100644
--- a/test/Tooling/clang-check-chdir.cpp
+++ b/test/Tooling/clang-check-chdir.cpp
@@ -5,7 +5,7 @@
// RUN: echo "[{\"directory\":\"%t\",\"command\":\"clang -c test.cpp -I.\",\"file\":\"%t/test.cpp\"}]" | sed -e 's/\\/\//g' > %t/compile_commands.json
// RUN: cp "%s" "%t/test.cpp"
// RUN: touch "%t/clang-check-test.h"
-// RUN: clang-check -p "%t" "%t/test.cpp" 2>&1|FileCheck %s
+// RUN: not clang-check -p "%t" "%t/test.cpp" 2>&1|FileCheck %s
// FIXME: Make the above easier.
#include "clang-check-test.h"
diff --git a/test/Tooling/clang-check-extra-arg.cpp b/test/Tooling/clang-check-extra-arg.cpp
new file mode 100644
index 000000000000..f6715358453f
--- /dev/null
+++ b/test/Tooling/clang-check-extra-arg.cpp
@@ -0,0 +1,5 @@
+// RUN: clang-check "%s" -extra-arg=-Wunimplemented-warning -extra-arg-before=-Wunimplemented-warning-before -- -c 2>&1 | FileCheck %s
+
+// CHECK: unknown warning option '-Wunimplemented-warning-before'
+// CHECK: unknown warning option '-Wunimplemented-warning'
+int a(){}
diff --git a/test/Tooling/clang-check-pwd.cpp b/test/Tooling/clang-check-pwd.cpp
index 463ed40b3e50..d85b9b1ae472 100644
--- a/test/Tooling/clang-check-pwd.cpp
+++ b/test/Tooling/clang-check-pwd.cpp
@@ -2,12 +2,16 @@
// RUN: mkdir %t
// RUN: echo "[{\"directory\":\".\",\"command\":\"clang++ -c %t/test.cpp\",\"file\":\"%t/test.cpp\"}]" | sed -e 's/\\/\\\\/g' > %t/compile_commands.json
// RUN: cp "%s" "%t/test.cpp"
-// RUN: PWD="%t" clang-check -p "%t" "test.cpp" 2>&1|FileCheck %s
+// RUN: ln -sf %t %t.foobar
+// RUN: cd %t
+// RUN: not env PWD="%t.foobar" clang-check -p "%t" "test.cpp" 2>&1|FileCheck %s
// FIXME: Make the above easier.
// CHECK: C++ requires
+// CHECK: .foobar/test.cpp
invalid;
// REQUIRES: shell
// PR15590
// XFAIL: win64
+// XFAIL: mingw
diff --git a/test/Tooling/clang-check-rel-path.cpp b/test/Tooling/clang-check-rel-path.cpp
new file mode 100644
index 000000000000..23a9345b99b3
--- /dev/null
+++ b/test/Tooling/clang-check-rel-path.cpp
@@ -0,0 +1,10 @@
+// This block test a compilation database with files relative to the directory
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: echo '[{"directory":"%t","command":"clang++ -c test.cpp","file":"test.cpp"}]' | sed -e 's/\\/\//g' > %t/compile_commands.json
+// RUN: cp "%s" "%t/test.cpp"
+// RUN: not clang-check -p "%t" "%t/test.cpp" 2>&1|FileCheck %s
+// FIXME: Make the above easier.
+
+// CHECK: C++ requires
+invalid;
diff --git a/test/Tooling/clang-check-strip-o.cpp b/test/Tooling/clang-check-strip-o.cpp
new file mode 100644
index 000000000000..e33367bea54b
--- /dev/null
+++ b/test/Tooling/clang-check-strip-o.cpp
@@ -0,0 +1,11 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: echo '[{"directory":".","command":"clang++ -c %t/test.cpp -o foo -ofoo","file":"%t/test.cpp"}]' | sed -e 's/\\/\//g' > %t/compile_commands.json
+// RUN: cp "%s" "%t/test.cpp"
+// RUN: not clang-check -p "%t" "%t/test.cpp" -extra-arg=-v 2>&1|FileCheck %s
+// FIXME: Make the above easier.
+
+// CHECK: Invocation
+// CHECK-NOT: {{ -v}}
+// CHECK: C++ requires
+invalid;
diff --git a/test/Tooling/clang-check.cpp b/test/Tooling/clang-check.cpp
index 56835b3bf986..e3fb49c41772 100644
--- a/test/Tooling/clang-check.cpp
+++ b/test/Tooling/clang-check.cpp
@@ -2,7 +2,7 @@
// RUN: mkdir %t
// RUN: echo '[{"directory":".","command":"clang++ -c %t/test.cpp","file":"%t/test.cpp"}]' | sed -e 's/\\/\//g' > %t/compile_commands.json
// RUN: cp "%s" "%t/test.cpp"
-// RUN: clang-check -p "%t" "%t/test.cpp" 2>&1|FileCheck %s
+// RUN: not clang-check -p "%t" "%t/test.cpp" 2>&1|FileCheck %s
// FIXME: Make the above easier.
// CHECK: C++ requires
diff --git a/test/Tooling/ms-asm-no-target.cpp b/test/Tooling/ms-asm-no-target.cpp
new file mode 100644
index 000000000000..68930b159680
--- /dev/null
+++ b/test/Tooling/ms-asm-no-target.cpp
@@ -0,0 +1,13 @@
+// RUN: not clang-check "%s" -- -fasm-blocks -target x86_64-apple-darwin10 2>&1 | FileCheck -check-prefix=CHECK-X86 %s
+// RUN: not clang-check "%s" -- -fasm-blocks -target powerpc-apple-darwin10 2>&1 | FileCheck -check-prefix=CHECK-PPC %s
+
+// Test that we diagnose instead of crashing when the application hasn't
+// initialized LLVM targets supporting the MS-style inline asm parser.
+// Also test that the ordinary error is emitted on unsupported architectures.
+
+void Break() {
+ __asm { int 3 }
+}
+
+// CHECK-X86: error: MS-style inline assembly is not available
+// CHECK-PPC: error: Unsupported architecture 'powerpc' for MS-style inline assembly
diff --git a/test/Tooling/multi-jobs.cpp b/test/Tooling/multi-jobs.cpp
index 1e6bce113fd5..cef84439f0da 100644
--- a/test/Tooling/multi-jobs.cpp
+++ b/test/Tooling/multi-jobs.cpp
@@ -1,4 +1,7 @@
-// RUN: clang-check "%s" -- -no-integrated-as -c 2>&1 | FileCheck %s
+// RUN: not clang-check "%s" -- -no-integrated-as -c 2>&1 | FileCheck %s
// CHECK: C++ requires
invalid;
+
+// MSVC targeted drivers (*-win32) are incapable of invoking external assembler.
+// XFAIL: win32