xref: /llvm-project/llvm/test/tools/llvm-debuginfod-find/cache.test (revision 099f4e236c24ad42e56a6811e0ea4ed54ca00906)
1REQUIRES: curl
2UNSUPPORTED: system-windows
3
4RUN: rm -rf %t/*
5RUN: mkdir -p %t/buildid/012345678901234{5,6}
6RUN: echo 'f' > %t/buildid/0123456789012345/debuginfo
7RUN: cp %t/buildid/012345678901234{5,6}/debuginfo
8RUN: mkdir %t/cache
9RUN: env DEBUGINFOD_CACHE_PATH=%t/cache DEBUGINFOD_URLS=file://%t \
10RUN:   llvm-debuginfod-find --debuginfo 0123456789012345 > /dev/null
11RUN: ls %t/cache | FileCheck --check-prefix=FIRST --match-full-lines --implicit-check-not {{.}} %s
12
13# Set policy to discard all but one file.
14RUN: env DEBUGINFOD_CACHE_POLICY=prune_interval=0s:cache_size_files=1 \
15RUN:     DEBUGINFOD_CACHE_PATH=%t/cache DEBUGINFOD_URLS=file://%t \
16RUN:     llvm-debuginfod-find --debuginfo 0123456789012346 > /dev/null
17RUN: ls %t/cache | FileCheck --check-prefix=SECOND --match-full-lines --implicit-check-not {{.}} %s
18
19# Add the first file back to the cache.
20RUN: env DEBUGINFOD_CACHE_PATH=%t/cache DEBUGINFOD_URLS=file://%t \
21RUN:     llvm-debuginfod-find --debuginfo 0123456789012345 > /dev/null
22RUN: ls %t/cache | FileCheck --check-prefix=BOTH --match-full-lines --implicit-check-not {{.}} %s
23
24# An invalid cache policy has no effect.
25RUN: env DEBUGINFOD_CACHE_POLICY=invalid:prune_interval=0s:cache_size_files=1 \
26RUN:     DEBUGINFOD_CACHE_PATH=%t/cache DEBUGINFOD_URLS=file://%t \
27RUN:     llvm-debuginfod-find --debuginfo 0123456789012346 > /dev/null
28RUN: ls %t/cache | FileCheck --check-prefix=BOTH --match-full-lines --implicit-check-not {{.}} %s
29
30FIRST: llvmcache-10846399329613630737
31FIRST: llvmcache.timestamp
32
33SECOND: llvmcache-10192351353398627645
34SECOND: llvmcache.timestamp
35
36BOTH: llvmcache-10192351353398627645
37BOTH: llvmcache-10846399329613630737
38BOTH: llvmcache.timestamp
39