From: Sam McCall Date: Wed, 7 Dec 2016 09:19:07 +0000 (+0000) Subject: Compilation database test: don't try to output to CWD X-Git-Tag: llvmorg-4.0.0-rc1~2783 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=59336a0a45c64bef27adf2476274466134693723;p=platform%2Fupstream%2Fllvm.git Compilation database test: don't try to output to CWD Summary: Write output from compilation database test to %T rather than the working dir. Sometimes CWD isn't writable! Also specify no-canonical-prefixes so that clang has 'clang' in the name. Reviewers: bkramer Subscribers: joerg, cfe-commits Differential Revision: https://reviews.llvm.org/D27504 llvm-svn: 288892 --- diff --git a/clang/test/Driver/compilation_database.c b/clang/test/Driver/compilation_database.c index 89c76d6..d5bafd4 100644 --- a/clang/test/Driver/compilation_database.c +++ b/clang/test/Driver/compilation_database.c @@ -1,8 +1,9 @@ -// RUN: %clang -MD -MP --sysroot=somewhere -c -x c %s -xc++ %s -Wall -MJ - 2>&1 | FileCheck %s -// RUN: not %clang -c -x c %s -MJ %s/non-existant 2>&1 | FileCheck --check-prefix=ERROR %s +// RUN: cd "%T" +// RUN: %clang -MD -MP --sysroot=somewhere -c -x c %s -xc++ %s -Wall -MJ - -no-canonical-prefixes 2>&1 | FileCheck %s +// RUN: not %clang -c -x c %s -MJ %s/non-existant -no-canonical-prefixes 2>&1 | FileCheck --check-prefix=ERROR %s -// CHECK: { "directory": "[[CWD:[^"]+]]", "file": "[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": "compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc", "[[SRC]]", "--sysroot=somewhere", "-c", "-Wall",{{.*}} "--target={{[^"]+}}"]}, -// CHECK: { "directory": "[[CWD:[^"]+]]", "file": "[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": "compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc++", "[[SRC]]", "--sysroot=somewhere", "-c", "-Wall",{{.*}} "--target={{[^"]+}}"]}, +// CHECK: { "directory": "{{.*}}", "file": "[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": "compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc", "[[SRC]]", "--sysroot=somewhere", "-c", "-Wall",{{.*}} "--target={{[^"]+}}"]}, +// CHECK: { "directory": "{{.*}}", "file": "[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": "compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc++", "[[SRC]]", "--sysroot=somewhere", "-c", "-Wall",{{.*}} "--target={{[^"]+}}"]}, // ERROR: error: compilation database '{{.*}}/non-existant' could not be opened: int main(void) {