From df17244ffa7da26616f4c440a730524a4e96ee1f Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Wed, 10 Oct 2018 17:37:32 +0000 Subject: [PATCH] Change the timestamp of llvmcache-foo file to meet the thinLTO prune policy The case will randomly fail if we test it with command " while llvm-lit test/tools/gold/X86/cache.ll ; do true; done". It is because the llvmcache-foo file is younger than llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6. But due to timestamp precision reason their timestamp is the same. Given the same timestamp, the file prune policy is to remove bigger size file first, so mostly foo file is removed for its bigger size. And the files size is under threshold after deleting foo file. That's what test case expect. However sometimes, the precision is enough to measure that timestamp of llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6 are smaller than foo, so llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6 are deleted first. Since the files size is still above the file size threshold after deleting the 2 files, the foo file is also deleted. And then the test case fails, because it expect only one file should be deleted instead of 3. The fix is to change the timestamp of llvmcache-foo file to meet the thinLTO prune policy. Patch by Luo Yuanke. Differential Revision: https://reviews.llvm.org/D52452 llvm-svn: 344158 --- llvm/test/tools/gold/X86/cache.ll | 3 +++ 1 file changed, 3 insertions(+) diff --git a/llvm/test/tools/gold/X86/cache.ll b/llvm/test/tools/gold/X86/cache.ll index 51ffee282b1e..4446aa6d8878 100644 --- a/llvm/test/tools/gold/X86/cache.ll +++ b/llvm/test/tools/gold/X86/cache.ll @@ -53,6 +53,9 @@ ; RUN: ls %t.cache | count 5 +; Increase the age of llvmcache-foo +; RUN: touch -r %t.cache/llvmcache-foo -d '-2 minutes' %t.cache/llvmcache-foo + ; This should remove it. ; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ ; RUN: --plugin-opt=thinlto \