1; Verify that enabling caching is ignoring module when we emit them without hash. 2; RUN: opt -module-summary %s -o %t.o 3; RUN: opt -module-summary %p/Inputs/cache.ll -o %t2.o 4 5; RUN: rm -Rf %t.cache 6; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ 7; RUN: --plugin-opt=thinlto \ 8; RUN: --plugin-opt=cache-dir=%t.cache \ 9; RUN: -o %t3.o %t2.o %t.o 10 11; We should just get the timestamp file 12; RUN: ls %t.cache | count 1 13 14 15; Verify that enabling caching is working with module with hash. 16 17; RUN: opt -module-hash -module-summary %s -o %t.o 18; RUN: opt -module-hash -module-summary %p/Inputs/cache.ll -o %t2.o 19 20; RUN: rm -Rf %t.cache 21; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ 22; RUN: --plugin-opt=thinlto \ 23; RUN: --plugin-opt=cache-dir=%t.cache \ 24; RUN: -o %t3.o %t2.o %t.o 25 26; Two cached objects, plus a timestamp file 27; RUN: ls %t.cache | count 3 28 29 30; Create two files that would be removed by cache pruning due to age. 31; We should only remove files matching the pattern "llvmcache-*". 32 33; RUN: touch -t 197001011200 %t.cache/llvmcache-foo %t.cache/foo 34; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ 35; RUN: --plugin-opt=thinlto \ 36; RUN: --plugin-opt=cache-dir=%t.cache \ 37; RUN: --plugin-opt=cache-policy=prune_after=1h:prune_interval=0s \ 38; RUN: -o %t3.o %t2.o %t.o 39 40; Two cached objects, plus a timestamp file and "foo", minus the file we removed. 41; RUN: ls %t.cache | count 4 42 43 44; Create a file of size 64KB. 45; RUN: %python -c "print(' ' * 65536)" > %t.cache/llvmcache-foo 46 47; This should leave the file in place. 48; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ 49; RUN: --plugin-opt=thinlto \ 50; RUN: --plugin-opt=cache-dir=%t.cache \ 51; RUN: --plugin-opt=cache-policy=cache_size_bytes=128k:prune_interval=0s \ 52; RUN: -o %t3.o %t2.o %t.o 53; RUN: ls %t.cache | count 5 54 55 56; This should remove it. 57; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ 58; RUN: --plugin-opt=thinlto \ 59; RUN: --plugin-opt=save-temps \ 60; RUN: --plugin-opt=cache-dir=%t.cache \ 61; RUN: --plugin-opt=cache-policy=cache_size_bytes=32k:prune_interval=0s \ 62; RUN: -o %t4.o %t2.o %t.o 63; RUN: ls %t.cache | count 4 64; With save-temps we can confirm that the cached files were copied into temp 65; files to avoid a race condition with the cached files being pruned, since the 66; gold plugin-api only accepts native objects passed back as files. 67; RUN: ls %t4.o.o1 68; RUN: ls %t4.o.o2 69 70 71target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 72target triple = "x86_64-unknown-linux-gnu" 73 74define void @globalfunc() #0 { 75entry: 76 ret void 77} 78