Skip to content

Commit 7f030e9

Browse files
committed
[clang][cas] Add missing test for vfsoverlay + cas-fs caching
We forgot to add a test when this case was fixed. (cherry picked from commit 22f238e)
1 parent 9d45ef6 commit 7f030e9

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Check cas-fs-based caching works with vfsoverlay files.
2+
3+
// RUN: rm -rf %t
4+
// RUN: split-file %s %t
5+
// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
6+
// RUN: sed -e "s|DIR|%/t|g" %t/vfs.yaml.template > %t/vfs.yaml
7+
8+
// RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 \
9+
// RUN: -format experimental-full -mode preprocess-dependency-directives \
10+
// RUN: -cas-path %t/cas -action-cache-path %t/cache > %t/deps.json
11+
12+
// RUN: %deps-to-rsp %t/deps.json --module-name=A > %t/A.rsp
13+
// RUN: %deps-to-rsp %t/deps.json --tu-index 0 > %t/tu.rsp
14+
// RUN: %clang @%t/A.rsp
15+
// RUN: %clang @%t/tu.rsp
16+
17+
//--- cdb.json.template
18+
[{
19+
"directory": "DIR",
20+
"command": "clang -fsyntax-only DIR/tu.c -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fimplicit-module-maps -ivfsoverlay DIR/vfs.yaml",
21+
"file": "DIR/tu.c"
22+
}]
23+
24+
//--- vfs.yaml.template
25+
{
26+
"version": 0,
27+
"case-sensitive": "false",
28+
"roots": [
29+
{
30+
"name": "DIR/A",
31+
"type": "directory"
32+
"contents": [
33+
{
34+
"external-contents": "DIR/elsewhere1/A.modulemap",
35+
"name": "module.modulemap",
36+
"type": "file"
37+
}
38+
]
39+
}
40+
]
41+
}
42+
43+
//--- elsewhere1/A.modulemap
44+
module A { header "A.h" }
45+
46+
//--- A/A.h
47+
typedef int A_t;
48+
49+
//--- tu.c
50+
#include "A/A.h"
51+
A_t a = 0;

0 commit comments

Comments
 (0)