Skip to content

Commit a709fe8

Browse files
committed
Have an individual stable dir test.
1 parent 6ee7595 commit a709fe8

File tree

2 files changed

+45
-25
lines changed

2 files changed

+45
-25
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: }

clang/test/ClangScanDeps/modules-full-by-mult-mod-names.c

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,43 +22,20 @@ module root1 { header "root1.h"}
2222
// This is here to verify that the "root" directory doesn't clash with name of
2323
// the "root" module.
2424

25-
// Verify the stable dir path.
26-
//--- Sysroot/usr/include/SysA/module.modulemap
27-
module SysA {
28-
header "SysA.h"
29-
}
30-
31-
//--- Sysroot/usr/include/SysA/SysA.h
32-
int SysVal = 42;
33-
3425
//--- cdb.json.template
3526
[{
3627
"file": "",
3728
"directory": "DIR",
38-
"command": "clang -fmodules -fmodules-cache-path=DIR/cache -I DIR -isysroot DIR/Sysroot -IDIR/Sysroot/usr/include -x c"
29+
"command": "clang -fmodules -fmodules-cache-path=DIR/cache -I DIR -x c"
3930
}]
4031

4132
// RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
42-
// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full -module-names=SysA,root,root1,direct > %t/result.json
33+
// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full -module-names=root,root1,direct > %t/result.json
4334
// RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s
4435

4536
// CHECK: {
4637
// CHECK-NEXT: "modules": [
4738
// CHECK-NEXT: {
48-
// CHECK-NEXT: "is-in-stable-directories": true,
49-
// CHECK-NEXT: "clang-module-deps": [],
50-
// CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/Sysroot/usr/include/SysA/module.modulemap",
51-
// CHECK-NEXT: "command-line": [
52-
// CHECK: ],
53-
// CHECK-NEXT: "context-hash": "{{.*}}",
54-
// CHECK-NEXT: "file-deps": [
55-
// CHECK-NEXT: "[[PREFIX]]/Sysroot/usr/include/SysA/module.modulemap",
56-
// CHECK-NEXT: "[[PREFIX]]/Sysroot/usr/include/SysA/SysA.h"
57-
// CHECK-NEXT: ],
58-
// CHECK-NEXT: "link-libraries": [],
59-
// CHECK-NEXT: "name": "SysA"
60-
// CHECK-NEXT: },
61-
// CHECK-NEXT: {
6239
// CHECK-NEXT: "clang-module-deps": [
6340
// CHECK-NEXT: {
6441
// CHECK-NEXT: "context-hash": "{{.*}}",

0 commit comments

Comments
 (0)