]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Modules/prune.m
Vendor import of clang trunk r290819:
[FreeBSD/FreeBSD.git] / test / Modules / prune.m
1 // Test the automatic pruning of module cache entries.
2 #ifdef IMPORT_DEPENDS_ON_MODULE
3 @import DependsOnModule;
4 #else
5 @import Module;
6 #endif
7
8 // Clear out the module cache
9 // RUN: rm -rf %t
10 // Run Clang twice so we end up creating the timestamp file (the second time).
11 // RUN: %clang_cc1 -DIMPORT_DEPENDS_ON_MODULE -fmodules-ignore-macro=DIMPORT_DEPENDS_ON_MODULE -fmodules -fimplicit-module-maps -F %S/Inputs -fmodules-cache-path=%t %s -verify
12 // RUN: %clang_cc1 -DIMPORT_DEPENDS_ON_MODULE -fmodules-ignore-macro=DIMPORT_DEPENDS_ON_MODULE -fmodules -fimplicit-module-maps -F %S/Inputs -fmodules-cache-path=%t %s -verify
13 // RUN: ls %t | grep modules.timestamp
14 // RUN: ls -R %t | grep ^Module.*pcm
15 // RUN: ls -R %t | grep DependsOnModule.*pcm
16
17 // Set the timestamp back more than two days. We should try to prune,
18 // but nothing gets pruned because the module files are new enough.
19 // RUN: touch -m -a -t 201101010000 %t/modules.timestamp 
20 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -F %S/Inputs -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify
21 // RUN: ls %t | grep modules.timestamp
22 // RUN: ls -R %t | grep ^Module.*pcm
23 // RUN: ls -R %t | grep DependsOnModule.*pcm
24
25 // Set the DependsOnModule access time back more than four days.
26 // This shouldn't prune anything, because the timestamp has been updated, so
27 // the pruning mechanism won't fire.
28 // RUN: find %t -name DependsOnModule*.pcm | sed -e 's/\\/\//g' | xargs touch -a -t 201101010000
29 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -F %S/Inputs -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify
30 // RUN: ls %t | grep modules.timestamp
31 // RUN: ls -R %t | grep ^Module.*pcm
32 // RUN: ls -R %t | grep DependsOnModule.*pcm
33
34 // Set both timestamp and DependsOnModule.pcm back beyond the cutoff.
35 // This should trigger pruning, which will remove DependsOnModule but not Module.
36 // RUN: touch -m -a -t 201101010000 %t/modules.timestamp 
37 // RUN: find %t -name DependsOnModule*.pcm | sed -e 's/\\/\//g' | xargs touch -a -t 201101010000
38 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -F %S/Inputs -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify
39 // RUN: ls %t | grep modules.timestamp
40 // RUN: ls -R %t | grep ^Module.*pcm
41 // RUN: ls -R %t | not grep DependsOnModule.*pcm
42
43 // expected-no-diagnostics