summaryrefslogtreecommitdiffstats
path: root/clang/tools/ccc/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/tools/ccc/test')
-rw-r--r--clang/tools/ccc/test/ccc/Xarch.c8
-rw-r--r--clang/tools/ccc/test/ccc/argument-types.c16
-rw-r--r--clang/tools/ccc/test/ccc/hello.c7
-rw-r--r--clang/tools/ccc/test/ccc/integrated-cpp.c3
-rw-r--r--clang/tools/ccc/test/ccc/invalid.c1
-rw-r--r--clang/tools/ccc/test/ccc/phases.c46
-rw-r--r--clang/tools/ccc/test/ccc/universal-hello.c7
7 files changed, 88 insertions, 0 deletions
diff --git a/clang/tools/ccc/test/ccc/Xarch.c b/clang/tools/ccc/test/ccc/Xarch.c
new file mode 100644
index 00000000000..55014a757c7
--- /dev/null
+++ b/clang/tools/ccc/test/ccc/Xarch.c
@@ -0,0 +1,8 @@
+// RUN: xcc -### -fsyntax-only -Xarch_i386 -Wall -Xarch_ppc -Wunused -arch i386 -arch ppc %s > %t &&
+// RUN: grep '"-Xarch"' %t | count 0 &&
+// RUN: grep '"-Wall"' %t | count 1 &&
+// RUN: grep '"-arch" "i386"' %t | count 1 &&
+// RUN: grep '"-Wall"' %t | grep '"-arch" "i386"' | count 1 &&
+// RUN: grep '"-Wunused"' %t | count 1 &&
+// RUN: grep '"-arch" "ppc"' %t | count 1 &&
+// RUN: grep '"-Wunused"' %t | grep '"-arch" "ppc"' | count 1
diff --git a/clang/tools/ccc/test/ccc/argument-types.c b/clang/tools/ccc/test/ccc/argument-types.c
new file mode 100644
index 00000000000..2de1593a9bb
--- /dev/null
+++ b/clang/tools/ccc/test/ccc/argument-types.c
@@ -0,0 +1,16 @@
+// Input argument:
+// RUN: xcc -ccc-print-options %s | grep 'Name: "<input>", Values: {"%s"}' | count 1 &&
+
+// Joined or separate arguments:
+// RUN: xcc -ccc-print-options -xc -x c | grep 'Name: "-x", Values: {"c"}' | count 2 &&
+
+// Joined and separate arguments:
+// RUN: xcc -ccc-print-options -Xarch_mips -run | grep 'Name: "-Xarch_", Values: {"mips", "-run"}' | count 1 &&
+
+// Multiple arguments:
+// RUN: xcc -ccc-print-options -sectorder 1 2 3 | grep 'Name: "-sectorder", Values: {"1", "2", "3"}' | count 1 &&
+
+// Unknown argument:
+// RUN: xcc -ccc-print-options -=== | grep 'Name: "<unknown>", Values: {"-==="}' | count 1 &&
+
+// RUN: true
diff --git a/clang/tools/ccc/test/ccc/hello.c b/clang/tools/ccc/test/ccc/hello.c
new file mode 100644
index 00000000000..96f59f6747c
--- /dev/null
+++ b/clang/tools/ccc/test/ccc/hello.c
@@ -0,0 +1,7 @@
+// RUN: xcc %s -o %t &&
+// RUN: %t | grep "Hello, World"
+
+int main() {
+ printf("Hello, World!\n");
+ return 0;
+}
diff --git a/clang/tools/ccc/test/ccc/integrated-cpp.c b/clang/tools/ccc/test/ccc/integrated-cpp.c
new file mode 100644
index 00000000000..47508610d9e
--- /dev/null
+++ b/clang/tools/ccc/test/ccc/integrated-cpp.c
@@ -0,0 +1,3 @@
+// RUN: xcc -fsyntax-only -### %s | count 1 &&
+// RUN: xcc -fsyntax-only -### %s -no-integrated-cpp | count 2 &&
+// RUN: xcc -fsyntax-only -### %s -save-temps | count 2
diff --git a/clang/tools/ccc/test/ccc/invalid.c b/clang/tools/ccc/test/ccc/invalid.c
new file mode 100644
index 00000000000..3620b458ad2
--- /dev/null
+++ b/clang/tools/ccc/test/ccc/invalid.c
@@ -0,0 +1 @@
+// RUN: not xcc -### -c -o %t %s %s
diff --git a/clang/tools/ccc/test/ccc/phases.c b/clang/tools/ccc/test/ccc/phases.c
new file mode 100644
index 00000000000..2d350c2f258
--- /dev/null
+++ b/clang/tools/ccc/test/ccc/phases.c
@@ -0,0 +1,46 @@
+// One C file.
+// RUN: xcc -ccc-no-driver-driver -ccc-print-phases a.c > %t &&
+// RUN: grep '0: input, "a.c", c' %t &&
+// RUN: grep '1: preprocessor, {0}, cpp-output' %t &&
+// RUN: grep '2: compiler, {1}, assembler' %t &&
+// RUN: grep '3: assembler, {2}, object' %t &&
+// RUN: grep '4: linker, {3}, image' %t &&
+
+// PCH.
+// RUN: xcc -ccc-no-driver-driver -ccc-print-phases -x c-header a.h > %t &&
+// RUN: grep '0: input, "a.h", c-header' %t &&
+// RUN: grep '1: preprocessor, {0}, c-header-cpp-output' %t &&
+// RUN: grep '2: precompiler, {1}, precompiled-header' %t &&
+
+// Assembler w/ and w/o preprocessor.
+// RUN: xcc -ccc-no-driver-driver -ccc-print-phases -x assembler a.s > %t &&
+// RUN: grep '0: input, "a.s", assembler' %t &&
+// RUN: grep '1: assembler, {0}, object' %t &&
+// RUN: grep '2: linker, {1}, image' %t &&
+// RUN: xcc -ccc-no-driver-driver -ccc-print-phases -x assembler-with-cpp a.s > %t &&
+// RUN: grep '0: input, "a.s", assembler-with-cpp' %t &&
+// RUN: grep '1: preprocessor, {0}, assembler' %t &&
+// RUN: grep '2: assembler, {1}, object' %t &&
+// RUN: grep '3: linker, {2}, image' %t &&
+
+// Check the various ways of early termination.
+// RUN: xcc -ccc-no-driver-driver -ccc-print-phases -E a.c > %t &&
+// RUN: not grep ': compiler, ' %t &&
+// RUN: xcc -ccc-no-driver-driver -ccc-print-phases -fsyntax-only a.c > %t &&
+// RUN: grep ': compiler, {1}, nothing' %t &&
+// RUN: not grep ': assembler, ' %t &&
+// RUN: xcc -ccc-no-driver-driver -ccc-print-phases -S a.c > %t &&
+// RUN: not grep ': assembler, ' %t &&
+// RUN: xcc -ccc-no-driver-driver -ccc-print-phases -c a.c > %t &&
+// RUN: not grep ': linker, ' %t &&
+
+// Multiple output files.
+// RUN: xcc -ccc-no-driver-driver -ccc-print-phases -c a.c b.c > %t &&
+// RUN: grep ': assembler,' %t | count 2 &&
+
+// FIXME: Only for darwin.
+// Treat -filelist as a linker input.
+// RUN: xcc -ccc-no-driver-driver -ccc-print-phases -filelist /dev/null > %t &&
+// RUN: grep '1: linker, {0}, image' %t &&
+
+// RUN: true
diff --git a/clang/tools/ccc/test/ccc/universal-hello.c b/clang/tools/ccc/test/ccc/universal-hello.c
new file mode 100644
index 00000000000..a482e536ace
--- /dev/null
+++ b/clang/tools/ccc/test/ccc/universal-hello.c
@@ -0,0 +1,7 @@
+// RUN: xcc -arch ppc -arch i386 -arch x86_64 %s -o %t &&
+// RUN: %t | grep "Hello, World"
+
+int main() {
+ printf("Hello, World!\n");
+ return 0;
+}
OpenPOWER on IntegriCloud