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
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
11 ; We should just get the timestamp file
12 ; RUN: ls %t.cache | count 1
15 ; Verify that enabling caching is working with module with hash.
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
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
26 ; Two cached objects, plus a timestamp file
27 ; RUN: ls %t.cache | count 3
30 ; Create two files that would be removed by cache pruning due to age.
31 ; We should only remove files matching the pattern "llvmcache-*".
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
40 ; Two cached objects, plus a timestamp file and "foo", minus the file we removed.
41 ; RUN: ls %t.cache | count 4
44 ; Create a file of size 64KB.
45 ; RUN: %python -c "print(' ' * 65536)" > %t.cache/llvmcache-foo
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
56 ; Increase the age of llvmcache-foo
57 ; RUN: touch -r %t.cache/llvmcache-foo -d '-2 minutes' %t.cache/llvmcache-foo
59 ; This should remove it.
60 ; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
61 ; RUN: --plugin-opt=thinlto \
62 ; RUN: --plugin-opt=save-temps \
63 ; RUN: --plugin-opt=cache-dir=%t.cache \
64 ; RUN: --plugin-opt=cache-policy=cache_size_bytes=32k:prune_interval=0s \
65 ; RUN: -o %t4.o %t2.o %t.o
66 ; RUN: ls %t.cache | count 4
67 ; With save-temps we can confirm that the cached files were copied into temp
68 ; files to avoid a race condition with the cached files being pruned, since the
69 ; gold plugin-api only accepts native objects passed back as files.
74 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
75 target triple = "x86_64-unknown-linux-gnu"
77 define void @globalfunc() #0 {