summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/lit.cfg2
-rw-r--r--llvm/test/tools/llvm-symbolizer/print_context.c22
2 files changed, 24 insertions, 0 deletions
diff --git a/llvm/test/lit.cfg b/llvm/test/lit.cfg
index 5cc4d6e0456..e06c10f6421 100644
--- a/llvm/test/lit.cfg
+++ b/llvm/test/lit.cfg
@@ -194,6 +194,7 @@ config.substitutions.append( ('%llvmshlibdir', config.llvm_shlib_dir) )
config.substitutions.append( ('%shlibext', config.llvm_shlib_ext) )
config.substitutions.append( ('%exeext', config.llvm_exe_ext) )
config.substitutions.append( ('%python', config.python_executable) )
+config.substitutions.append( ('%host_cc', config.host_cc) )
# OCaml substitutions.
# Support tests for both native and bytecode builds.
@@ -276,6 +277,7 @@ for pattern in [r"\bbugpoint\b(?!-)",
r"\bllvm-split\b",
r"\bllvm-tblgen\b",
r"\bllvm-c-test\b",
+ NOJUNK + r"\bllvm-symbolizer\b",
NOJUNK + r"\bopt\b",
r"\bFileCheck\b",
r"\bobj2yaml\b",
diff --git a/llvm/test/tools/llvm-symbolizer/print_context.c b/llvm/test/tools/llvm-symbolizer/print_context.c
new file mode 100644
index 00000000000..f1860e91988
--- /dev/null
+++ b/llvm/test/tools/llvm-symbolizer/print_context.c
@@ -0,0 +1,22 @@
+// REQUIRES: x86_64-linux
+// RUN: %host_cc -O0 -g %s -o %t 2>&1
+// RUN: %t 2>&1 | llvm-symbolizer -print-source-context-lines=5 -obj=%t | FileCheck %s --check-prefix=CHECK
+
+#include <stdio.h>
+
+int inc(int a) {
+ return a + 1;
+}
+
+int main() {
+ printf("%p\n", inc);
+ return 0;
+}
+
+// CHECK: inc
+// CHECK: print_context.c:7
+// CHECK: 5 : #include
+// CHECK: 6 :
+// CHECK: 7 >: int inc
+// CHECK: 8 : return
+// CHECK: 9 : }
OpenPOWER on IntegriCloud