blob: 41d69894a7ba08b4bff6369ac36f411231abb06a [file] [log] [blame]
Alex Lorenz8679ef42019-08-26 17:59:41 +00001// REQUIRES: x86-registered-target
2// RUN: rm -rf %t.cdb
3// RUN: %clang -target x86_64-apple-macos10.15 -c %s -o - -gen-cdb-fragment-path %t.cdb
4// RUN: ls %t.cdb | FileCheck --check-prefix=CHECK-LS %s
5// CHECK-LS: gen-cdb-fragment.c.{{.*}}.json
6
7// RUN: cat %t.cdb/*.json | FileCheck --check-prefix=CHECK %s
8// CHECK: { "directory": "{{.*}}", "file": "{{.*}}gen-cdb-fragment.c", "output": "-", "arguments": [{{.*}}, "--target=x86_64-apple-macos10.15"{{.*}}]},
9// RUN: cat %t.cdb/*.json | FileCheck --check-prefix=CHECK-FLAG %s
10// CHECK-FLAG-NOT: -gen-cdb-fragment-path
11
12// RUN: rm -rf %t.cdb
13// RUN: mkdir %t.cdb
14// RUN: ls %t.cdb | not FileCheck --check-prefix=CHECK-LS %s
15// RUN: %clang -target x86_64-apple-macos10.15 -S %s -o - -gen-cdb-fragment-path %t.cdb
16// RUN: ls %t.cdb | FileCheck --check-prefix=CHECK-LS %s
17
Jan Korousf8907fa2019-10-15 17:51:59 +000018// Working directory arg is respected.
19// RUN: rm -rf %t.cdb
20// RUN: mkdir %t.cdb
21// RUN: %clang -target x86_64-apple-macos10.15 -working-directory %t.cdb -c %s -o - -gen-cdb-fragment-path "."
22// RUN: ls %t.cdb | FileCheck --check-prefix=CHECK-LS %s
23// RUN: cat %t.cdb/*.json | FileCheck --check-prefix=CHECK-CWD %s
24// CHECK-CWD: "directory": "{{.*}}.cdb"
25
Alex Lorenz8679ef42019-08-26 17:59:41 +000026// -### does not emit the CDB fragment
27// RUN: rm -rf %t.cdb
28// RUN: mkdir %t.cdb
29// RUN: %clang -target x86_64-apple-macos10.15 -S %s -o - -gen-cdb-fragment-path %t.cdb -###
30// RUN: ls %t.cdb | not FileCheck --check-prefix=CHECK-LS %s
31
32// -MJ is preferred over -gen-cdb-fragment-path
33// RUN: rm -rf %t.cdb
34// RUN: mkdir %t.cdb
35// RUN: %clang -target x86_64-apple-macos10.15 -S %s -o - -gen-cdb-fragment-path %t.cdb -MJ %t.out
36// RUN: ls %t.cdb | not FileCheck --check-prefix=CHECK-LS %s
37// RUN: FileCheck %s < %t.out