summaryrefslogtreecommitdiffstats
path: root/test/LLVMC/C
diff options
context:
space:
mode:
Diffstat (limited to 'test/LLVMC/C')
-rw-r--r--test/LLVMC/C/dg.exp5
-rw-r--r--test/LLVMC/C/emit-llvm.c4
-rw-r--r--test/LLVMC/C/hello.c12
-rw-r--r--test/LLVMC/C/include.c9
-rw-r--r--test/LLVMC/C/opt-test.c12
-rw-r--r--test/LLVMC/C/sink.c12
-rw-r--r--test/LLVMC/C/wall.c12
7 files changed, 66 insertions, 0 deletions
diff --git a/test/LLVMC/C/dg.exp b/test/LLVMC/C/dg.exp
new file mode 100644
index 0000000..a9be28a
--- /dev/null
+++ b/test/LLVMC/C/dg.exp
@@ -0,0 +1,5 @@
+load_lib llvm.exp
+
+if [ llvm_gcc_supports c ] then {
+ RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
+}
diff --git a/test/LLVMC/C/emit-llvm.c b/test/LLVMC/C/emit-llvm.c
new file mode 100644
index 0000000..38bbba6
--- /dev/null
+++ b/test/LLVMC/C/emit-llvm.c
@@ -0,0 +1,4 @@
+// RUN: llvmc -c -emit-llvm -o - %s | llvm-dis | grep "@f0()" | count 1
+
+int f0(void) {
+}
diff --git a/test/LLVMC/C/hello.c b/test/LLVMC/C/hello.c
new file mode 100644
index 0000000..b2d903f
--- /dev/null
+++ b/test/LLVMC/C/hello.c
@@ -0,0 +1,12 @@
+/*
+ * Check that we can compile helloworld
+ * RUN: llvmc %s -o %t
+ * RUN: %abs_tmp | grep hello
+ */
+
+#include <stdio.h>
+
+int main() {
+ printf("hello\n");
+ return 0;
+}
diff --git a/test/LLVMC/C/include.c b/test/LLVMC/C/include.c
new file mode 100644
index 0000000..07ae761
--- /dev/null
+++ b/test/LLVMC/C/include.c
@@ -0,0 +1,9 @@
+/*
+ * Check that the 'include' options work.
+ * RUN: echo "int x;\n" > %t1.inc
+ * RUN: llvmc -include %t1.inc -fsyntax-only %s
+ */
+
+int f0(void) {
+ return x;
+}
diff --git a/test/LLVMC/C/opt-test.c b/test/LLVMC/C/opt-test.c
new file mode 100644
index 0000000..d69dc9b
--- /dev/null
+++ b/test/LLVMC/C/opt-test.c
@@ -0,0 +1,12 @@
+/*
+ * Check that the -opt switch works.
+ * RUN: llvmc %s -opt -o %t
+ * RUN: %abs_tmp | grep hello
+ */
+
+#include <stdio.h>
+
+int main() {
+ printf("hello\n");
+ return 0;
+}
diff --git a/test/LLVMC/C/sink.c b/test/LLVMC/C/sink.c
new file mode 100644
index 0000000..bdff340
--- /dev/null
+++ b/test/LLVMC/C/sink.c
@@ -0,0 +1,12 @@
+/*
+ * Check that the 'sink' options work.
+ * RUN: llvmc -v -Wall %s -o %t |& grep "Wall"
+ * RUN: %abs_tmp | grep hello
+ */
+
+#include <stdio.h>
+
+int main() {
+ printf("hello\n");
+ return 0;
+}
diff --git a/test/LLVMC/C/wall.c b/test/LLVMC/C/wall.c
new file mode 100644
index 0000000..f676099
--- /dev/null
+++ b/test/LLVMC/C/wall.c
@@ -0,0 +1,12 @@
+/*
+ * Check that -Wall works as intended
+ * RUN: llvmc -Wall %s -o %t
+ * RUN: %abs_tmp | grep hello
+ */
+
+#include <stdio.h>
+
+int main() {
+ printf("hello\n");
+ return 0;
+}
OpenPOWER on IntegriCloud