summaryrefslogtreecommitdiffstats
path: root/lldb/test/Shell/BuildScript
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test/Shell/BuildScript')
-rw-r--r--lldb/test/Shell/BuildScript/compiler-full-path.test11
-rw-r--r--lldb/test/Shell/BuildScript/modes.test35
-rw-r--r--lldb/test/Shell/BuildScript/script-args.test32
-rw-r--r--lldb/test/Shell/BuildScript/toolchain-clang-cl.test49
-rw-r--r--lldb/test/Shell/BuildScript/toolchain-clang.test14
-rw-r--r--lldb/test/Shell/BuildScript/toolchain-msvc.test62
6 files changed, 203 insertions, 0 deletions
diff --git a/lldb/test/Shell/BuildScript/compiler-full-path.test b/lldb/test/Shell/BuildScript/compiler-full-path.test
new file mode 100644
index 00000000000..592024e690e
--- /dev/null
+++ b/lldb/test/Shell/BuildScript/compiler-full-path.test
@@ -0,0 +1,11 @@
+RUN: %build -n --mode=compile --verbose --arch=64 --compiler=/path/to/my/clang \
+RUN: -o foo foobar.c | FileCheck %s --check-prefix=CHECK-CLANG
+RUN: %build -n --mode=compile --verbose --arch=64 \
+RUN: --compiler=/path/to/my/x64/cl.exe -o foo foobar.c | \
+RUN: FileCheck %s --check-prefix=CHECK-MSVC
+
+CHECK-CLANG: Command Line: /path/to/my/clang
+CHECK-SAME: -o
+
+CHECK-MSVC: Command Line: /path/to/my/x64/cl.exe
+CHECK-SAME: /Fo
diff --git a/lldb/test/Shell/BuildScript/modes.test b/lldb/test/Shell/BuildScript/modes.test
new file mode 100644
index 00000000000..02311f712d7
--- /dev/null
+++ b/lldb/test/Shell/BuildScript/modes.test
@@ -0,0 +1,35 @@
+RUN: %build -n --verbose --arch=32 --mode=compile --compiler=any -o %t/foo.out foobar.c \
+RUN: | FileCheck --check-prefix=COMPILE %s
+
+RUN: %build -n --verbose --arch=32 --mode=compile --compiler=any --outdir %t foo.c bar.c \
+RUN: | FileCheck --check-prefix=COMPILE-MULTI %s
+
+RUN: %build -n --verbose --arch=32 --mode=link --compiler=any -o %t/foo.exe foobar.obj \
+RUN: | FileCheck --check-prefix=LINK %s
+
+RUN: %build -n --verbose --arch=32 --mode=link --compiler=any -o %t/foobar.exe foo.obj bar.obj \
+RUN: | FileCheck --check-prefix=LINK-MULTI %s
+
+RUN: %build -n --verbose --arch=32 --mode=compile-and-link --compiler=any -o %t/foobar.exe foobar.c \
+RUN: | FileCheck --check-prefix=BOTH %s
+
+RUN: %build -n --verbose --arch=32 --mode=compile-and-link --compiler=any -o %t/foobar.exe foo.c bar.c \
+RUN: | FileCheck --check-prefix=BOTH-MULTI %s
+
+
+COMPILE: compiling foobar.c -> foo.out
+
+COMPILE-MULTI: compiling foo.c -> foo.o{{(bj)?}}
+COMPILE-MULTI: compiling bar.c -> bar.o{{(bj)?}}
+
+
+LINK: linking foobar.obj -> foo.exe
+
+LINK-MULTI: linking foo.obj+bar.obj -> foobar.exe
+
+BOTH: compiling foobar.c -> [[OBJFOO:foobar.exe-foobar.o(bj)?]]
+BOTH: linking [[OBJFOO]] -> foobar.exe
+
+BOTH-MULTI: compiling foo.c -> [[OBJFOO:foobar.exe-foo.o(bj)?]]
+BOTH-MULTI: compiling bar.c -> [[OBJBAR:foobar.exe-bar.o(bj)?]]
+BOTH-MULTI: linking [[OBJFOO]]+[[OBJBAR]] -> foobar.exe
diff --git a/lldb/test/Shell/BuildScript/script-args.test b/lldb/test/Shell/BuildScript/script-args.test
new file mode 100644
index 00000000000..13e8a516094
--- /dev/null
+++ b/lldb/test/Shell/BuildScript/script-args.test
@@ -0,0 +1,32 @@
+RUN: %build -n --verbose --arch=32 --mode=compile --compiler=any -o %t/foo.out foobar.c \
+RUN: | FileCheck %s
+RUN: %build -n --verbose --arch=32 --mode=compile --compiler=any --outdir %t foo.c bar.c \
+RUN: | FileCheck --check-prefix=MULTI-INPUT %s
+
+
+CHECK: Script Arguments:
+CHECK-NEXT: Arch: 32
+CHECK: Compiler: any
+CHECK: Outdir: {{.*}}script-args.test.tmp
+CHECK: Output: {{.*}}script-args.test.tmp{{.}}foo.out
+CHECK: Nodefaultlib: False
+CHECK: Opt: none
+CHECK: Mode: compile
+CHECK: Clean: True
+CHECK: Verbose: True
+CHECK: Dryrun: True
+CHECK: Inputs: foobar.c
+
+MULTI-INPUT: Script Arguments:
+MULTI-INPUT-NEXT: Arch: 32
+MULTI-INPUT-NEXT: Compiler: any
+MULTI-INPUT-NEXT: Outdir: {{.*}}script-args.test.tmp
+MULTI-INPUT-NEXT: Output:
+MULTI-INPUT-NEXT: Nodefaultlib: False
+MULTI-INPUT-NEXT: Opt: none
+MULTI-INPUT-NEXT: Mode: compile
+MULTI-INPUT-NEXT: Clean: True
+MULTI-INPUT-NEXT: Verbose: True
+MULTI-INPUT-NEXT: Dryrun: True
+MULTI-INPUT-NEXT: Inputs: foo.c
+MULTI-INPUT-NEXT: bar.c
diff --git a/lldb/test/Shell/BuildScript/toolchain-clang-cl.test b/lldb/test/Shell/BuildScript/toolchain-clang-cl.test
new file mode 100644
index 00000000000..cc219aca158
--- /dev/null
+++ b/lldb/test/Shell/BuildScript/toolchain-clang-cl.test
@@ -0,0 +1,49 @@
+REQUIRES: lld, system-windows
+
+RUN: %build -n --verbose --arch=32 --compiler=clang-cl --mode=compile-and-link -o %t/foo.exe foobar.c \
+RUN: | FileCheck --check-prefix=CHECK-32 %s
+
+RUN: %build -n --verbose --arch=64 --compiler=clang-cl --mode=compile-and-link -o %t/foo.exe foobar.c \
+RUN: | FileCheck --check-prefix=CHECK-64 %s
+
+CHECK-32: Script Arguments:
+CHECK-32: Arch: 32
+CHECK-32: Compiler: clang-cl
+CHECK-32: Outdir: {{.*}}
+CHECK-32: Output: {{.*}}toolchain-clang-cl.test.tmp\foo.exe
+CHECK-32: Nodefaultlib: False
+CHECK-32: Opt: none
+CHECK-32: Mode: compile
+CHECK-32: Clean: True
+CHECK-32: Verbose: True
+CHECK-32: Dryrun: True
+CHECK-32: Inputs: foobar.c
+CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foobar.ilk
+CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe-foobar.obj
+CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.pdb
+CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe
+CHECK-32: compiling foobar.c -> foo.exe-foobar.obj
+CHECK-32: {{.*}}clang-cl{{(.exe)?}} -m32
+CHECK-32: linking foo.exe-foobar.obj -> foo.exe
+CHECK-32: {{.*}}lld-link
+
+CHECK-64: Script Arguments:
+CHECK-64: Arch: 64
+CHECK-64: Compiler: clang-cl
+CHECK-64: Outdir: {{.*}}
+CHECK-64: Output: {{.*}}toolchain-clang-cl.test.tmp\foo.exe
+CHECK-64: Nodefaultlib: False
+CHECK-64: Opt: none
+CHECK-64: Mode: compile
+CHECK-64: Clean: True
+CHECK-64: Verbose: True
+CHECK-64: Dryrun: True
+CHECK-64: Inputs: foobar.c
+CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foobar.ilk
+CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe-foobar.obj
+CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.pdb
+CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe
+CHECK-64: compiling foobar.c -> foo.exe-foobar.obj
+CHECK-64: {{.*}}clang-cl{{(.exe)?}} -m64
+CHECK-64: linking foo.exe-foobar.obj -> foo.exe
+CHECK-64: {{.*}}lld-link{{(.exe)?}}
diff --git a/lldb/test/Shell/BuildScript/toolchain-clang.test b/lldb/test/Shell/BuildScript/toolchain-clang.test
new file mode 100644
index 00000000000..eb2dbd54354
--- /dev/null
+++ b/lldb/test/Shell/BuildScript/toolchain-clang.test
@@ -0,0 +1,14 @@
+RUN: %build -n --verbose --arch=32 --compiler=clang --mode=compile-and-link -o %t/foo.exe foobar.c \
+RUN: | FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
+
+RUN: %build -n --verbose --arch=64 --compiler=clang --mode=compile-and-link -o %t/foo.exe foobar.c \
+RUN: | FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s
+
+CHECK: Cleaning {{.*}}toolchain-clang.test.tmp{{.}}foo.exe-foobar.o
+CHECK: Cleaning {{.*}}toolchain-clang.test.tmp{{.}}foo.exe
+CHECK: compiling foobar.c -> foo.exe-foobar.o
+CHECK-32: {{.*}}clang++{{(.exe)?}} -m32 -g -O0 -c -o {{.*}}foo.exe-foobar.o {{.*}}foobar.c
+CHECK-64: {{.*}}clang++{{(.exe)?}} -m64 -g -O0 -c -o {{.*}}foo.exe-foobar.o {{.*}}foobar.c
+CHECK: linking foo.exe-foobar.o -> foo.exe
+CHECK-32: {{.*}}clang++{{(.exe)?}} -m32 {{(-L.* )?(-Wl,-rpath,.* )?}}-o {{.*}}foo.exe {{.*}}foo.exe-foobar.o
+CHECK-64: {{.*}}clang++{{(.exe)?}} -m64 {{(-L.* )?(-Wl,-rpath,.* )?}}-o {{.*}}foo.exe {{.*}}foo.exe-foobar.o
diff --git a/lldb/test/Shell/BuildScript/toolchain-msvc.test b/lldb/test/Shell/BuildScript/toolchain-msvc.test
new file mode 100644
index 00000000000..85a8f0d62f0
--- /dev/null
+++ b/lldb/test/Shell/BuildScript/toolchain-msvc.test
@@ -0,0 +1,62 @@
+REQUIRES: system-windows, msvc
+
+RUN: %build -n --verbose --arch=32 --compiler=msvc --mode=compile-and-link -o %t/foo.exe foobar.c \
+RUN: | FileCheck --check-prefix=X86 %s
+
+RUN: %build -n --verbose --arch=64 --compiler=msvc --mode=compile-and-link -o %t/foo.exe foobar.c \
+RUN: | FileCheck --check-prefix=X64 %s
+
+X86: Script Arguments:
+X86: Arch: 32
+X86: Compiler: msvc
+X86: Outdir: {{.*}}
+X86: Output: {{.*}}toolchain-msvc.test.tmp\foo.exe
+X86: Nodefaultlib: False
+X86: Opt: none
+X86: Mode: compile
+X86: Clean: True
+X86: Verbose: True
+X86: Dryrun: True
+X86: Inputs: foobar.c
+X86: Cleaning {{.*}}toolchain-msvc.test.tmp\foobar.ilk
+X86: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.exe-foobar.obj
+X86: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.pdb
+X86: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.exe
+X86: compiling foobar.c -> foo.exe-foobar.obj
+X86: Command Line: {{.*}}\{{[Hh]ost[Xx]64}}\x86\cl.exe
+X86: linking foo.exe-foobar.obj -> foo.exe
+X86: Command Line: {{.*}}\{{[Hh]ost[Xx]64}}\x86\link.exe
+X86: Env
+X86: LIB = {{.*}}\ATLMFC\lib\x86
+X86: {{.*}}\lib\x86
+X86: {{.*}}\ucrt\x86
+X86: {{.*}}\um\x86
+X86: PATH = {{.*}}\bin\{{[Hh]ost[Xx]64}}\x64
+
+
+X64: Script Arguments:
+X64: Arch: 64
+X64: Compiler: msvc
+X64: Outdir: {{.*}}
+X64: Output: {{.*}}toolchain-msvc.test.tmp\foo.exe
+X64: Nodefaultlib: False
+X64: Opt: none
+X64: Mode: compile
+X64: Clean: True
+X64: Verbose: True
+X64: Dryrun: True
+X64: Inputs: foobar.c
+X64: Cleaning {{.*}}toolchain-msvc.test.tmp\foobar.ilk
+X64: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.exe-foobar.obj
+X64: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.pdb
+X64: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.exe
+X64: compiling foobar.c -> foo.exe-foobar.obj
+X64: Command Line: {{.*}}\{{[Hh]ost[Xx]64}}\x64\cl.exe
+X64: linking foo.exe-foobar.obj -> foo.exe
+X64: Command Line: {{.*}}\{{[Hh]ost[Xx]64}}\x64\link.exe
+X64: Env
+X64: LIB = {{.*}}\ATLMFC\lib\x64
+X64: {{.*}}\lib\x64
+X64: {{.*}}\ucrt\x64
+X64: {{.*}}\um\x64
+X64: PATH = {{.*}}\bin\{{[Hh]ost[Xx]64}}\x64
OpenPOWER on IntegriCloud