2018-12-05 19:17:50 +08:00
|
|
|
// NetBSD: noatime mounts currently inhibit 'touch -a' updates
|
|
|
|
// UNSUPPORTED: system-netbsd
|
|
|
|
|
2013-03-26 05:19:16 +08:00
|
|
|
// Test the automatic pruning of module cache entries.
|
|
|
|
#ifdef IMPORT_DEPENDS_ON_MODULE
|
|
|
|
@import DependsOnModule;
|
|
|
|
#else
|
|
|
|
@import Module;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Clear out the module cache
|
|
|
|
// RUN: rm -rf %t
|
|
|
|
// Run Clang twice so we end up creating the timestamp file (the second time).
|
2017-12-22 10:53:30 +08:00
|
|
|
// RUN: %clang_cc1 -DIMPORT_DEPENDS_ON_MODULE -Wno-private-module -fmodules-ignore-macro=DIMPORT_DEPENDS_ON_MODULE -fmodules -fimplicit-module-maps -F %S/Inputs -fmodules-cache-path=%t %s -verify
|
|
|
|
// RUN: %clang_cc1 -DIMPORT_DEPENDS_ON_MODULE -Wno-private-module -fmodules-ignore-macro=DIMPORT_DEPENDS_ON_MODULE -fmodules -fimplicit-module-maps -F %S/Inputs -fmodules-cache-path=%t %s -verify
|
2013-03-26 05:19:16 +08:00
|
|
|
// RUN: ls %t | grep modules.timestamp
|
2014-04-15 02:00:01 +08:00
|
|
|
// RUN: ls -R %t | grep ^Module.*pcm
|
|
|
|
// RUN: ls -R %t | grep DependsOnModule.*pcm
|
2013-03-26 05:19:16 +08:00
|
|
|
|
|
|
|
// Set the timestamp back more than two days. We should try to prune,
|
|
|
|
// but nothing gets pruned because the module files are new enough.
|
2013-03-26 05:27:57 +08:00
|
|
|
// RUN: touch -m -a -t 201101010000 %t/modules.timestamp
|
2017-12-22 10:53:30 +08:00
|
|
|
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -Wno-private-module -F %S/Inputs -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify
|
2013-03-26 05:19:16 +08:00
|
|
|
// RUN: ls %t | grep modules.timestamp
|
2014-04-15 02:00:01 +08:00
|
|
|
// RUN: ls -R %t | grep ^Module.*pcm
|
|
|
|
// RUN: ls -R %t | grep DependsOnModule.*pcm
|
2013-03-26 05:19:16 +08:00
|
|
|
|
|
|
|
// 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.
|
2016-10-21 07:11:45 +08:00
|
|
|
// RUN: find %t -name DependsOnModule*.pcm | sed -e 's/\\/\//g' | xargs touch -a -t 201101010000
|
2017-12-22 10:53:30 +08:00
|
|
|
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -F %S/Inputs -Wno-private-module -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify
|
2013-03-26 05:19:16 +08:00
|
|
|
// RUN: ls %t | grep modules.timestamp
|
2014-04-15 02:00:01 +08:00
|
|
|
// RUN: ls -R %t | grep ^Module.*pcm
|
|
|
|
// RUN: ls -R %t | grep DependsOnModule.*pcm
|
2013-03-26 05:19:16 +08:00
|
|
|
|
|
|
|
// Set both timestamp and DependsOnModule.pcm back beyond the cutoff.
|
|
|
|
// This should trigger pruning, which will remove DependsOnModule but not Module.
|
2013-03-26 05:27:57 +08:00
|
|
|
// RUN: touch -m -a -t 201101010000 %t/modules.timestamp
|
2016-10-21 07:11:45 +08:00
|
|
|
// RUN: find %t -name DependsOnModule*.pcm | sed -e 's/\\/\//g' | xargs touch -a -t 201101010000
|
2017-12-22 10:53:30 +08:00
|
|
|
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -F %S/Inputs -Wno-private-module -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify
|
2013-03-26 05:19:16 +08:00
|
|
|
// RUN: ls %t | grep modules.timestamp
|
2014-04-15 02:00:01 +08:00
|
|
|
// RUN: ls -R %t | grep ^Module.*pcm
|
|
|
|
// RUN: ls -R %t | not grep DependsOnModule.*pcm
|
2013-03-26 05:19:16 +08:00
|
|
|
|
|
|
|
// expected-no-diagnostics
|