47 lines · plain
1// NetBSD: noatime mounts currently inhibit 'touch -a' updates2// UNSUPPORTED: system-netbsd3 4// Test the automatic pruning of module cache entries.5#ifdef IMPORT_DEPENDS_ON_MODULE6@import DependsOnModule;7#else8@import Module;9#endif10 11// Clear out the module cache12// RUN: rm -rf %t13// Run Clang twice so we end up creating the timestamp file (the second time).14// 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 -verify15// 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 -verify16// RUN: ls %t | grep modules.timestamp17// RUN: ls -R %t | grep ^Module.*pcm18// RUN: ls -R %t | grep DependsOnModule.*pcm19 20// Set the timestamp back more than two days. We should try to prune,21// but nothing gets pruned because the module files are new enough.22// RUN: touch -m -a -t 201101010000 %t/modules.timestamp 23// 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 -verify24// RUN: ls %t | grep modules.timestamp25// RUN: ls -R %t | grep ^Module.*pcm26// RUN: ls -R %t | grep DependsOnModule.*pcm27 28// Set the DependsOnModule access time back more than four days.29// This shouldn't prune anything, because the timestamp has been updated, so30// the pruning mechanism won't fire.31// RUN: find %t -name DependsOnModule*.pcm | sed -e 's/\\/\//g' | xargs touch -a -t 20110101000032// 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 -verify33// RUN: ls %t | grep modules.timestamp34// RUN: ls -R %t | grep ^Module.*pcm35// RUN: ls -R %t | grep DependsOnModule.*pcm36 37// Set both timestamp and DependsOnModule.pcm back beyond the cutoff.38// This should trigger pruning, which will remove DependsOnModule but not Module.39// RUN: touch -m -a -t 201101010000 %t/modules.timestamp 40// RUN: find %t -name DependsOnModule*.pcm | sed -e 's/\\/\//g' | xargs touch -a -t 20110101000041// 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 -verify42// RUN: ls %t | grep modules.timestamp43// RUN: ls -R %t | grep ^Module.*pcm44// RUN: ls -R %t | not grep DependsOnModule.*pcm45 46// expected-no-diagnostics47