Skip to content

Commit 3f61402

Browse files
authored
[clang][DependencyScanning] Add Test Coverage of StabeDirs during By-Name Lookups (#168143)
This PR adds some test coverage for `StableDirs` during by-name lookups.
1 parent 46565f3 commit 3f61402

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// UNSUPPORTED: system-windows
2+
// RUN: rm -rf %t
3+
// RUN: split-file %s %t
4+
5+
// Verify the stable dir path.
6+
//--- Sysroot/usr/include/SysA/module.modulemap
7+
module SysA {
8+
header "SysA.h"
9+
}
10+
11+
//--- Sysroot/usr/include/SysA/SysA.h
12+
int SysVal = 42;
13+
14+
//--- cdb.json.template
15+
[{
16+
"file": "",
17+
"directory": "DIR",
18+
"command": "clang -fmodules -fmodules-cache-path=DIR/cache -isysroot DIR/Sysroot -IDIR/Sysroot/usr/include -x c"
19+
}]
20+
21+
// RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
22+
// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full -module-names=SysA > %t/result.json
23+
// RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s
24+
25+
// CHECK: {
26+
// CHECK-NEXT: "modules": [
27+
// CHECK-NEXT: {
28+
// CHECK-NEXT: "is-in-stable-directories": true,
29+
// CHECK-NEXT: "clang-module-deps": [],
30+
// CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/Sysroot/usr/include/SysA/module.modulemap",
31+
// CHECK-NEXT: "command-line": [
32+
// CHECK: ],
33+
// CHECK-NEXT: "context-hash": "{{.*}}",
34+
// CHECK-NEXT: "file-deps": [
35+
// CHECK-NEXT: "[[PREFIX]]/Sysroot/usr/include/SysA/module.modulemap",
36+
// CHECK-NEXT: "[[PREFIX]]/Sysroot/usr/include/SysA/SysA.h"
37+
// CHECK-NEXT: ],
38+
// CHECK-NEXT: "link-libraries": [],
39+
// CHECK-NEXT: "name": "SysA"
40+
// CHECK-NEXT: }
41+
// CHECK-NEXT: ],
42+
// CHECK-NEXT: "translation-units": []
43+
// CHECK-NEXT: }

0 commit comments

Comments
 (0)