|
1 | 1 | #include "foo.h"
|
| 2 | +#include "bar.h" |
2 | 3 |
|
3 | 4 | // Clear the module cache.
|
4 | 5 | // RUN: rm -rf %t
|
|
9 | 10 | // Create a module. We will use -I or -isystem to determine whether to treat
|
10 | 11 | // foo.h as a system header.
|
11 | 12 | // RUN: echo 'void meow(void);' > %t/Inputs/foo.h
|
| 13 | +// RUN: echo 'void woof(void);' > %t/Inputs/bar.h |
12 | 14 | // RUN: echo 'module Foo { header "foo.h" }' > %t/Inputs/module.map
|
| 15 | +// RUN: echo 'extern module Bar "bar.modulemap"' >> %t/Inputs/module.map |
| 16 | +// RUN: echo 'module Bar { header "bar.h" }' > %t/Inputs/bar.modulemap |
13 | 17 |
|
14 | 18 | // ===
|
15 | 19 | // Compile the module.
|
16 | 20 | // RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -isystem %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s
|
17 | 21 | // RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache-user -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s
|
18 | 22 | // RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp
|
| 23 | +// RUN: ls -R %t/modules-cache | grep Bar.pcm.timestamp |
19 | 24 | // RUN: ls -R %t/modules-cache-user | grep Foo.pcm.timestamp
|
| 25 | +// RUN: ls -R %t/modules-cache-user | grep Bar.pcm.timestamp |
20 | 26 | // RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-before.pcm
|
| 27 | +// RUN: cp %t/modules-cache/Bar.pcm %t/modules-to-compare/Bar-before.pcm |
21 | 28 | // RUN: cp %t/modules-cache-user/Foo.pcm %t/modules-to-compare/Foo-before-user.pcm
|
| 29 | +// RUN: cp %t/modules-cache-user/Bar.pcm %t/modules-to-compare/Bar-before-user.pcm |
22 | 30 |
|
23 | 31 | // ===
|
24 | 32 | // Use it, and make sure that we did not recompile it.
|
25 | 33 | // RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -isystem %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s
|
26 | 34 | // RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache-user -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s
|
27 | 35 | // RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp
|
| 36 | +// RUN: ls -R %t/modules-cache | grep Bar.pcm.timestamp |
28 | 37 | // RUN: ls -R %t/modules-cache-user | grep Foo.pcm.timestamp
|
| 38 | +// RUN: ls -R %t/modules-cache-user | grep Bar.pcm.timestamp |
29 | 39 | // RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-after.pcm
|
| 40 | +// RUN: cp %t/modules-cache/Bar.pcm %t/modules-to-compare/Bar-after.pcm |
30 | 41 | // RUN: cp %t/modules-cache-user/Foo.pcm %t/modules-to-compare/Foo-after-user.pcm
|
| 42 | +// RUN: cp %t/modules-cache-user/Bar.pcm %t/modules-to-compare/Bar-after-user.pcm |
31 | 43 |
|
32 | 44 | // RUN: diff %t/modules-to-compare/Foo-before.pcm %t/modules-to-compare/Foo-after.pcm
|
| 45 | +// RUN: diff %t/modules-to-compare/Bar-before.pcm %t/modules-to-compare/Bar-after.pcm |
33 | 46 | // RUN: diff %t/modules-to-compare/Foo-before-user.pcm %t/modules-to-compare/Foo-after-user.pcm
|
| 47 | +// RUN: diff %t/modules-to-compare/Bar-before-user.pcm %t/modules-to-compare/Bar-after-user.pcm |
34 | 48 |
|
35 | 49 | // ===
|
36 | 50 | // Change the sources.
|
37 | 51 | // RUN: echo 'void meow2(void);' > %t/Inputs/foo.h
|
| 52 | +// RUN: echo 'module Bar { header "bar.h" export * }' > %t/Inputs/bar.modulemap |
38 | 53 |
|
39 | 54 | // ===
|
40 |
| -// Use the module, and make sure that we did not recompile it if foo.h is a |
41 |
| -// system header, even though the sources changed. |
| 55 | +// Use the module, and make sure that we did not recompile it if foo.h or |
| 56 | +// module.map are system files, even though the sources changed. |
42 | 57 | // RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -isystem %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s
|
43 | 58 | // RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache-user -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s
|
44 | 59 | // RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp
|
| 60 | +// RUN: ls -R %t/modules-cache | grep Bar.pcm.timestamp |
45 | 61 | // RUN: ls -R %t/modules-cache-user | grep Foo.pcm.timestamp
|
| 62 | +// RUN: ls -R %t/modules-cache-user | grep Bar.pcm.timestamp |
46 | 63 | // RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-after.pcm
|
| 64 | +// RUN: cp %t/modules-cache/Bar.pcm %t/modules-to-compare/Bar-after.pcm |
47 | 65 | // RUN: cp %t/modules-cache-user/Foo.pcm %t/modules-to-compare/Foo-after-user.pcm
|
| 66 | +// RUN: cp %t/modules-cache-user/Bar.pcm %t/modules-to-compare/Bar-after-user.pcm |
48 | 67 |
|
49 | 68 | // RUN: diff %t/modules-to-compare/Foo-before.pcm %t/modules-to-compare/Foo-after.pcm
|
| 69 | +// RUN: diff %t/modules-to-compare/Bar-before.pcm %t/modules-to-compare/Bar-after.pcm |
50 | 70 | // When foo.h is a user header, we will always validate it.
|
51 | 71 | // RUN: not diff %t/modules-to-compare/Foo-before-user.pcm %t/modules-to-compare/Foo-after-user.pcm
|
| 72 | +// RUN: not diff %t/modules-to-compare/Bar-before-user.pcm %t/modules-to-compare/Bar-after-user.pcm |
52 | 73 |
|
53 | 74 | // ===
|
54 | 75 | // Recompile the module if the today's date is before 01 January 2100.
|
55 | 76 | // RUN: %clang_cc1 -cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -isystem %t/Inputs -fbuild-session-timestamp=4102441200 -fmodules-validate-once-per-build-session %s
|
56 | 77 | // RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp
|
| 78 | +// RUN: ls -R %t/modules-cache | grep Bar.pcm.timestamp |
57 | 79 | // RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-after.pcm
|
| 80 | +// RUN: cp %t/modules-cache/Bar.pcm %t/modules-to-compare/Bar-after.pcm |
58 | 81 |
|
59 | 82 | // RUN: not diff %t/modules-to-compare/Foo-before.pcm %t/modules-to-compare/Foo-after.pcm
|
| 83 | +// RUN: not diff %t/modules-to-compare/Bar-before.pcm %t/modules-to-compare/Bar-after.pcm |
0 commit comments