blob: b0a10bfca442e945106f36a79d2902d629b50f7a [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.
Sebastian Pop9ec60df2012-01-20 22:01:23 +00009// RUN: %clang -### -target x86_64-unknown-linux-gnu \
Chandler Carruthd9d2a872010-10-20 08:24:03 +000010// 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.
Sebastian Pop9ec60df2012-01-20 22:01:23 +000017// RUN: %clang -### -target 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.
Sebastian Pop9ec60df2012-01-20 22:01:23 +000024// RUN: %clang -### -target x86_64-unknown-linux-gnu \
Chandler Carruthd9d2a872010-10-20 08:24:03 +000025// 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"