xref: /minix3/external/bsd/llvm/dist/clang/test/Modules/rebuild.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// RUN: rm -rf %t
2*0a6a1f1dSLionel Sambuc
3*0a6a1f1dSLionel Sambuc// Build Module and set its timestamp
4*0a6a1f1dSLionel Sambuc// RUN: echo '@import Module;' | %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash -fsyntax-only -F %S/Inputs -x objective-c -
5*0a6a1f1dSLionel Sambuc// RUN: touch -m -a -t 201101010000 %t/Module.pcm
6*0a6a1f1dSLionel Sambuc// RUN: cp %t/Module.pcm %t/Module.pcm.saved
7*0a6a1f1dSLionel Sambuc// RUN: wc -c %t/Module.pcm > %t/Module.size.saved
8*0a6a1f1dSLionel Sambuc
9*0a6a1f1dSLionel Sambuc// Build DependsOnModule
10*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash -fsyntax-only -F %S/Inputs %s
11*0a6a1f1dSLionel Sambuc// RUN: diff %t/Module.pcm %t/Module.pcm.saved
12*0a6a1f1dSLionel Sambuc// RUN: cp %t/DependsOnModule.pcm %t/DependsOnModule.pcm.saved
13*0a6a1f1dSLionel Sambuc
14*0a6a1f1dSLionel Sambuc// Rebuild Module, reset its timestamp, and verify its size hasn't changed
15*0a6a1f1dSLionel Sambuc// RUN: rm %t/Module.pcm
16*0a6a1f1dSLionel Sambuc// RUN: echo '@import Module;' | %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash -fsyntax-only -F %S/Inputs -x objective-c -
17*0a6a1f1dSLionel Sambuc// RUN: touch -m -a -t 201101010000 %t/Module.pcm
18*0a6a1f1dSLionel Sambuc// RUN: wc -c %t/Module.pcm > %t/Module.size
19*0a6a1f1dSLionel Sambuc// RUN: diff %t/Module.size %t/Module.size.saved
20*0a6a1f1dSLionel Sambuc// RUN: cp %t/Module.pcm %t/Module.pcm.saved.2
21*0a6a1f1dSLionel Sambuc
22*0a6a1f1dSLionel Sambuc// But the signature at least is expected to change, so we rebuild DependsOnModule.
23*0a6a1f1dSLionel Sambuc// NOTE: if we change how the signature is created, this test may need updating.
24*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash -fsyntax-only -F %S/Inputs %s
25*0a6a1f1dSLionel Sambuc// RUN: diff %t/Module.pcm %t/Module.pcm.saved.2
26*0a6a1f1dSLionel Sambuc// RUN: not diff %t/DependsOnModule.pcm %t/DependsOnModule.pcm.saved
27*0a6a1f1dSLionel Sambuc
28*0a6a1f1dSLionel Sambuc// Rebuild Module, reset its timestamp, and verify its size hasn't changed
29*0a6a1f1dSLionel Sambuc// RUN: rm %t/Module.pcm
30*0a6a1f1dSLionel Sambuc// RUN: echo '@import Module;' | %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash -fsyntax-only -F %S/Inputs -x objective-c -
31*0a6a1f1dSLionel Sambuc// RUN: touch -m -a -t 201101010000 %t/Module.pcm
32*0a6a1f1dSLionel Sambuc// RUN: wc -c %t/Module.pcm > %t/Module.size
33*0a6a1f1dSLionel Sambuc// RUN: diff %t/Module.size %t/Module.size.saved
34*0a6a1f1dSLionel Sambuc// RUN: cp %t/Module.pcm %t/Module.pcm.saved.2
35*0a6a1f1dSLionel Sambuc
36*0a6a1f1dSLionel Sambuc// Verify again with Module pre-imported.
37*0a6a1f1dSLionel Sambuc// NOTE: if we change how the signature is created, this test may need updating.
38*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash -fsyntax-only -F %S/Inputs %s
39*0a6a1f1dSLionel Sambuc// RUN: diff %t/Module.pcm %t/Module.pcm.saved.2
40*0a6a1f1dSLionel Sambuc// RUN: not diff %t/DependsOnModule.pcm %t/DependsOnModule.pcm.saved
41*0a6a1f1dSLionel Sambuc
42*0a6a1f1dSLionel Sambuc#ifdef PREIMPORT
43*0a6a1f1dSLionel Sambuc@import Module;
44*0a6a1f1dSLionel Sambuc#endif
45*0a6a1f1dSLionel Sambuc@import DependsOnModule;
46