|
1 |
| -; REQUIRES: shell |
2 |
| - |
3 | 1 | ; RUN: opt -module-hash -module-summary %s -o %t.o
|
4 | 2 | ; RUN: opt -module-hash -module-summary %p/Inputs/cache.ll -o %t2.o
|
5 | 3 |
|
|
20 | 18 | ;; Get the total size of created cache files.
|
21 | 19 | ; RUN: rm -rf %t && mkdir %t && cd %t
|
22 | 20 | ; RUN: wasm-ld --thinlto-cache-dir=%t --thinlto-cache-policy=prune_interval=0s:cache_size_bytes=32k %t2.o %t.o -o %t3 2>&1
|
23 |
| -; RUN: %python -c "import os, sys; print(sum(os.path.getsize(filename) for filename in os.listdir('.') if os.path.isfile(filename) and filename.startswith('llvmcache-')))" > %t.size.txt |
| 21 | +; 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.txt |
24 | 22 |
|
25 | 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.
|
26 |
| -; RUN: wasm-ld --verbose --thinlto-cache-dir=%t --thinlto-cache-policy=prune_interval=0s:cache_size_bytes=$(($(cat %t.size.txt) + 5)) %t2.o %t.o -o %t3 2>&1 | FileCheck %s --implicit-check-not=warning: |
| 24 | +; RUN: echo -n "--thinlto-cache-policy=prune_interval=0s:cache_size_bytes=" > %t.response |
| 25 | +; RUN: head -1 %t.size.txt >> %t.response |
| 26 | +; 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 | 27 |
|
28 | 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: wasm-ld --verbose --thinlto-cache-dir=%t --thinlto-cache-policy=prune_interval=0s:cache_size_bytes=$(($(cat %t.size.txt) - 5)) %t2.o %t.o -o %t3 2>&1 | FileCheck %s --check-prefixes=SIZE,WARN |
| 29 | +; RUN: echo -n "--thinlto-cache-policy=prune_interval=0s:cache_size_bytes=" > %t.response |
| 30 | +; RUN: tail -1 %t.size.txt >> %t.response |
| 31 | +; RUN: wasm-ld --verbose --thinlto-cache-dir=%t @%t.response %t2.o %t.o -o %t3 2>&1 | FileCheck %s --check-prefixes=SIZE,WARN |
30 | 32 |
|
31 | 33 | ;; Check emit two warnings if pruning happens due to reach both the size and number limits.
|
32 | 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,WARN
|
|
0 commit comments