blob: 044a86f6331bf3e020f88c011b08180bb1714cc3 [file] [log] [blame]
Chandler Carruthfeee58c2010-10-20 07:00:47 +00001// Check for proper handling of --sysroot and -isysroot flags.
2
Chandler Carruth6b401952010-10-20 07:16:18 +00003// RUN: %clang -### -fsyntax-only -isysroot /foo/bar %s 2>&1 | \
Chandler Carruthfeee58c2010-10-20 07:00:47 +00004// RUN: FileCheck %s -check-prefix=ISYSROOT
NAKAMURA Takumib8bcce32011-03-18 03:21:33 +00005// ISYSROOT: "-isysroot" "{{[^"]*}}/foo/bar"
Chandler Carruthfeee58c2010-10-20 07:00:47 +00006
7// Check that we get both isysroot for headers, and pass --sysroot on to GCC to
8// produce the final binary.
Chandler Carruthd9d2a872010-10-20 08:24:03 +00009// RUN: %clang -### -ccc-host-triple x86_64-unknown-linux-gnu \
10// RUN: --sysroot=/foo/bar -o /dev/null %s 2>&1 | \
11// RUN: FileCheck %s -check-prefix=SYSROOT_EQ
NAKAMURA Takumib8bcce32011-03-18 03:21:33 +000012// SYSROOT_EQ: "-isysroot" "{{[^"]*}}/foo/bar"
13// SYSROOT_EQ: "--sysroot{{" "|=}}{{[^"]*}}/foo/bar"
Chandler Carruthfeee58c2010-10-20 07:00:47 +000014
15// Check for overriding the header sysroot by providing both --sysroot and
16// -isysroot.
Chandler Carruthd9d2a872010-10-20 08:24:03 +000017// RUN: %clang -### -ccc-host-triple x86_64-unknown-linux-gnu -isysroot /baz \
Chandler Carruth6b401952010-10-20 07:16:18 +000018// RUN: --sysroot=/foo/bar -o /dev/null %s 2>&1 | FileCheck %s \
Chandler Carruthfeee58c2010-10-20 07:00:47 +000019// RUN: -check-prefix=ISYSROOT_AND_SYSROOT
NAKAMURA Takumib8bcce32011-03-18 03:21:33 +000020// ISYSROOT_AND_SYSROOT: "-isysroot" "{{[^"]*}}/baz"
21// ISYSROOT_AND_SYSROOT: "--sysroot{{" "|=}}{{[^"]*}}/foo/bar"
Chandler Carruthfeee58c2010-10-20 07:00:47 +000022
23// Check that omitting the equals works as well.
Chandler Carruthd9d2a872010-10-20 08:24:03 +000024// RUN: %clang -### -ccc-host-triple x86_64-unknown-linux-gnu \
25// RUN: --sysroot /foo/bar -o /dev/null %s 2>&1 | \
26// RUN: FileCheck %s -check-prefix=SYSROOT_SEPARATE
NAKAMURA Takumib8bcce32011-03-18 03:21:33 +000027// SYSROOT_SEPARATE: "-isysroot" "{{[^"]*}}/foo/bar"
28// SYSROOT_SEPARATE: "--sysroot{{" "|=}}{{[^"]*}}/foo/bar"