46 lines · plain
1; RUN: opt -module-hash -module-summary %s -o %t.o2; RUN: opt -module-hash -module-summary %p/Inputs/cache.ll -o %t2.o3 4; RUN: rm -rf %t && mkdir %t5 6;; Check cache policies of the number of files.7;; Case 1: A value of 0 disables the number of files based pruning. Therefore, there is no warning.8; RUN: wasm-ld --verbose --thinlto-cache-dir=%t --thinlto-cache-policy=prune_interval=0s:cache_size_files=0 %t2.o %t.o -o %t3 2>&1 | FileCheck %s --implicit-check-not=warning:9;; Case 2: If the total number of the files created by the current link job is less than the maximum number of files, there is no warning.10; RUN: wasm-ld --verbose --thinlto-cache-dir=%t --thinlto-cache-policy=prune_interval=0s:cache_size_files=3 %t2.o %t.o -o %t3 2>&1 | FileCheck %s --implicit-check-not=warning:11;; Case 3: If the total number of the files created by the current link job exceeds the maximum number of files, a warning is given.12; RUN: wasm-ld --thinlto-cache-dir=%t --thinlto-cache-policy=prune_interval=0s:cache_size_files=1 %t2.o %t.o -o %t3 2>&1 | FileCheck %s --check-prefixes=NUM,WARN13 14;; Check cache policies of the cache size.15;; Case 1: A value of 0 disables the absolute size-based pruning. Therefore, there is no warning.16; RUN: wasm-ld --verbose --thinlto-cache-dir=%t --thinlto-cache-policy=prune_interval=0s:cache_size_bytes=0 %t2.o %t.o -o %t3 2>&1 | FileCheck %s --implicit-check-not=warning:17 18;; Get the total size of created cache files.19; RUN: rm -rf %t && mkdir %t && cd %t20; RUN: wasm-ld --thinlto-cache-dir=%t --thinlto-cache-policy=prune_interval=0s:cache_size_bytes=32k %t2.o %t.o -o %t3 2>&121; RUN: %python -c "import os, sys; size=sum(os.path.getsize(filename) for filename in os.listdir('.') if os.path.isfile(filename) and filename.startswith('llvmcache-')); print(size+5); print(size-5)" > %t.size.txt22 23;; Case 2: If the total size of the cache files created by the current link job is less than the maximum size for the cache directory in bytes, there is no warning.24; RUN: echo -n "--thinlto-cache-policy=prune_interval=0s:cache_size_bytes=" > %t.response25; RUN: head -1 %t.size.txt >> %t.response26; RUN: wasm-ld --verbose --thinlto-cache-dir=%t @%t.response %t2.o %t.o -o %t3 2>&1 | FileCheck %s --implicit-check-not=warning:27 28;; Case 3: If the total size of the cache files created by the current link job exceeds the maximum size for the cache directory in bytes, a warning is given.29; RUN: echo -n "--thinlto-cache-policy=prune_interval=0s:cache_size_bytes=" > %t.response30; RUN: tail -1 %t.size.txt >> %t.response31; RUN: wasm-ld --verbose --thinlto-cache-dir=%t @%t.response %t2.o %t.o -o %t3 2>&1 | FileCheck %s --check-prefixes=SIZE,WARN32 33;; Check emit two warnings if pruning happens due to reach both the size and number limits.34; RUN: wasm-ld --thinlto-cache-dir=%t --thinlto-cache-policy=prune_interval=0s:cache_size_files=1:cache_size_bytes=1 %t2.o %t.o -o %t3 2>&1 | FileCheck %s --check-prefixes=NUM,SIZE,WARN35 36; NUM: warning: ThinLTO cache pruning happens since the number of{{.*}}--thinlto-cache-policy37; SIZE: warning: ThinLTO cache pruning happens since the total size of{{.*}}--thinlto-cache-policy38; WARN-NOT: warning: ThinLTO cache pruning happens{{.*}}--thinlto-cache-policy39 40target triple = "wasm32-unknown-unknown-wasm"41 42define void @globalfunc() #0 {43entry:44 ret void45}46