diff options
author | dim <dim@FreeBSD.org> | 2013-04-08 18:45:10 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-04-08 18:45:10 +0000 |
commit | c72c57c9e9b69944e3e009cd5e209634839581d3 (patch) | |
tree | 4fc2f184c499d106f29a386c452b49e5197bf63d /test/Modules/prune.m | |
parent | 5b20025c30d23d521e12c1f33ec8fa6b821952cd (diff) | |
download | FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.zip FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.tar.gz |
Vendor import of clang trunk r178860:
http://llvm.org/svn/llvm-project/cfe/trunk@178860
Diffstat (limited to 'test/Modules/prune.m')
-rw-r--r-- | test/Modules/prune.m | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/Modules/prune.m b/test/Modules/prune.m new file mode 100644 index 0000000..8af7e6c --- /dev/null +++ b/test/Modules/prune.m @@ -0,0 +1,46 @@ +// Test the automatic pruning of module cache entries. +#ifdef IMPORT_DEPENDS_ON_MODULE +@import DependsOnModule; +#else +@import Module; +#endif + +// We need 'touch' and 'find' for this test to work. +// REQUIRES: shell + +// Clear out the module cache +// RUN: rm -rf %t +// Run Clang twice so we end up creating the timestamp file (the second time). +// RUN: %clang_cc1 -DIMPORT_DEPENDS_ON_MODULE -fmodules-ignore-macro=DIMPORT_DEPENDS_ON_MODULE -fmodules -F %S/Inputs -fmodules-cache-path=%t %s -verify +// RUN: %clang_cc1 -DIMPORT_DEPENDS_ON_MODULE -fmodules-ignore-macro=DIMPORT_DEPENDS_ON_MODULE -fmodules -F %S/Inputs -fmodules-cache-path=%t %s -verify +// RUN: ls %t | grep modules.timestamp +// RUN: ls -R %t | grep ^Module.pcm +// RUN: ls -R %t | grep DependsOnModule.pcm + +// Set the timestamp back more than two days. We should try to prune, +// but nothing gets pruned because the module files are new enough. +// RUN: touch -m -a -t 201101010000 %t/modules.timestamp +// RUN: %clang_cc1 -fmodules -F %S/Inputs -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify +// RUN: ls %t | grep modules.timestamp +// RUN: ls -R %t | grep ^Module.pcm +// RUN: ls -R %t | grep DependsOnModule.pcm + +// Set the DependsOnModule access time back more than four days. +// This shouldn't prune anything, because the timestamp has been updated, so +// the pruning mechanism won't fire. +// RUN: find %t -name DependsOnModule.pcm | xargs touch -a -t 201101010000 +// RUN: %clang_cc1 -fmodules -F %S/Inputs -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify +// RUN: ls %t | grep modules.timestamp +// RUN: ls -R %t | grep ^Module.pcm +// RUN: ls -R %t | grep DependsOnModule.pcm + +// Set both timestamp and DependsOnModule.pcm back beyond the cutoff. +// This should trigger pruning, which will remove DependsOnModule but not Module. +// RUN: touch -m -a -t 201101010000 %t/modules.timestamp +// RUN: find %t -name DependsOnModule.pcm | xargs touch -a -t 201101010000 +// RUN: %clang_cc1 -fmodules -F %S/Inputs -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify +// RUN: ls %t | grep modules.timestamp +// RUN: ls -R %t | grep ^Module.pcm +// RUN: ls -R %t | not grep DependsOnModule.pcm + +// expected-no-diagnostics |