|
1 | 1 | // REQUIRES: shell
|
2 | 2 |
|
3 | 3 | // RUN: rm -rf %t && mkdir -p %t
|
4 |
| -// RUN: llvm-cas --cas %t/cas --ingest --data %s > %t/casid |
5 |
| -// |
6 |
| -// RUN: %clang -cc1 -triple x86_64-apple-macos11 \ |
7 |
| -// RUN: -fcas-path %t/cas -fcas-fs @%t/casid -fcache-compile-job \ |
8 |
| -// RUN: -fcas-plugin-path %llvmshlibdir/libCASPluginTest%pluginext \ |
9 |
| -// RUN: -fcas-plugin-option upstream-path=%t/cas-upstream -fcas-plugin-option no-logging \ |
10 |
| -// RUN: -dependency-file %t/t1.d -MT deps -emit-obj -o %t/output1.o %s |
11 |
| -// RUN: %clang -cc1 -triple x86_64-apple-macos11 \ |
12 |
| -// RUN: -fcas-path %t/cas -fcas-fs @%t/casid -fcache-compile-job \ |
13 |
| -// RUN: -fcas-plugin-path %llvmshlibdir/libCASPluginTest%pluginext \ |
| 4 | +// RUN: split-file %s %t |
| 5 | +// RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json |
| 6 | + |
| 7 | +// RUN: clang-scan-deps -compilation-database %t/cdb.json \ |
| 8 | +// RUN: -format experimental-include-tree-full \ |
| 9 | +// RUN: -cas-path %t/cas -fcas-plugin-path %llvmshlibdir/libCASPluginTest%pluginext \ |
14 | 10 | // RUN: -fcas-plugin-option upstream-path=%t/cas-upstream -fcas-plugin-option no-logging \
|
15 |
| -// RUN: -serialize-diagnostic-file %t/t1.dia -dependency-file %t/t1.d -MT deps \ |
16 |
| -// RUN: -Rcompile-job-cache-hit -emit-obj -o %t/output1.o %s 2> %t/output1.txt |
| 11 | +// RUN: > %t/deps.json |
| 12 | + |
| 13 | +// RUN: %deps-to-rsp %t/deps.json --tu-index 0 > %t/cc1.rsp |
| 14 | + |
| 15 | +// RUN: (cd %t; %clang @%t/cc1.rsp) |
| 16 | +// RUN: (cd %t; %clang @%t/cc1.rsp -Rcompile-job-cache-hit \ |
| 17 | +// RUN: -serialize-diagnostic-file %t/t1.dia 2> %t/output1.txt) |
17 | 18 |
|
18 | 19 | // Verify the warning was recorded and we compare populated .dia files.
|
19 | 20 | // RUN: c-index-test -read-diagnostics %t/t1.dia 2>&1 | FileCheck %s --check-prefix=DIAGS
|
|
25 | 26 |
|
26 | 27 | // Delete the "local" cache and use the "upstream" one to re-materialize the outputs locally.
|
27 | 28 | // RUN: rm -rf %t/cas
|
| 29 | + |
| 30 | +// Re-run the scan to populate the include-tree in the cas |
| 31 | +// RUN: clang-scan-deps -compilation-database %t/cdb.json \ |
| 32 | +// RUN: -format experimental-include-tree-full \ |
| 33 | +// RUN: -cas-path %t/cas -fcas-plugin-path %llvmshlibdir/libCASPluginTest%pluginext \ |
| 34 | +// RUN: -fcas-plugin-option upstream-path=%t/cas-upstream -fcas-plugin-option no-logging \ |
| 35 | +// RUN: > %t/deps2.json |
| 36 | +// RUN: diff -u %t/deps.json %t/deps2.json |
| 37 | + |
| 38 | + |
28 | 39 | // RUN: c-index-test core -materialize-cached-job -cas-path %t/cas @%t/cache-key \
|
29 | 40 | // RUN: -fcas-plugin-path %llvmshlibdir/libCASPluginTest%pluginext \
|
30 | 41 | // RUN: -fcas-plugin-option upstream-path=%t/cas-upstream -fcas-plugin-option no-logging
|
31 | 42 |
|
32 | 43 | // RUN: c-index-test core -replay-cached-job -cas-path %t/cas @%t/cache-key \
|
33 | 44 | // RUN: -fcas-plugin-path %llvmshlibdir/libCASPluginTest%pluginext \
|
34 | 45 | // RUN: -fcas-plugin-option no-logging \
|
35 |
| -// RUN: -- -cc1 \ |
| 46 | +// RUN: -working-dir %t \ |
| 47 | +// RUN: -- @%t/cc1.rsp \ |
36 | 48 | // RUN: -serialize-diagnostic-file %t/t2.dia -Rcompile-job-cache-hit \
|
37 |
| -// RUN: -dependency-file %t/t2.d -MT deps \ |
38 |
| -// RUN: -o %t/output2.o 2> %t/output2.txt |
| 49 | +// RUN: -dependency-file %t/t2.d -o %t/output2.o 2> %t/output2.txt |
39 | 50 |
|
40 | 51 | // RUN: diff %t/output1.o %t/output2.o
|
41 | 52 | // RUN: diff -u %t/output1.txt %t/output2.txt
|
42 | 53 | // RUN: diff %t/t1.dia %t/t2.dia
|
43 | 54 | // RUN: diff -u %t/t1.d %t/t2.d
|
44 | 55 |
|
45 |
| -// Check with `-working-dir` flag. |
| 56 | +// Check with different `-working-dir` flag. |
46 | 57 | // RUN: mkdir -p %t/a/b
|
47 | 58 | // RUN: cd %t/a
|
48 | 59 | // RUN: c-index-test core -replay-cached-job -cas-path %t/cas @%t/cache-key \
|
49 | 60 | // RUN: -fcas-plugin-path %llvmshlibdir/libCASPluginTest%pluginext \
|
50 | 61 | // RUN: -fcas-plugin-option no-logging \
|
51 | 62 | // RUN: -working-dir %t/a/b \
|
52 |
| -// RUN: -- -cc1 %t/a/b \ |
| 63 | +// RUN: -- @%t/cc1.rsp \ |
53 | 64 | // RUN: -serialize-diagnostic-file rel.dia -Rcompile-job-cache-hit \
|
54 |
| -// RUN: -dependency-file rel.d -MT deps \ |
55 |
| -// RUN: -o reloutput.o |
| 65 | +// RUN: -dependency-file rel.d -o reloutput.o |
56 | 66 |
|
57 | 67 | // RUN: diff %t/output1.o %t/a/b/reloutput.o
|
58 | 68 | // RUN: diff -u %t/t1.d %t/a/b/rel.d
|
59 | 69 | // FIXME: Get clang's `-working-directory` to affect relative path for serialized diagnostics.
|
60 | 70 |
|
| 71 | +//--- cdb.json.template |
| 72 | +[{ |
| 73 | + "directory": "DIR", |
| 74 | + "command": "clang -c DIR/main.c -target x86_64-apple-macos11 -MD -MF t1.d -MT deps -o output1.o", |
| 75 | + "file": "DIR/main.c" |
| 76 | +}] |
| 77 | + |
| 78 | +//--- main.c |
61 | 79 | #warning some warning
|
0 commit comments