Skip to content

Commit 1818c94

Browse files
committed
test: showcase impact of cache disabled
1 parent a88ec65 commit 1818c94

File tree

1 file changed

+130
-0
lines changed

1 file changed

+130
-0
lines changed
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
Set up project and cache directory
2+
3+
$ echo "(lang dune 3.20)" > dune-project
4+
5+
$ cat > config <<EOF
6+
> (lang dune 3.20)
7+
> (cache enabled)
8+
> EOF
9+
10+
$ cat > dune << EOF
11+
> (library
12+
> (name foo))
13+
> EOF
14+
15+
$ cat > foo.ml << EOF
16+
> let f x y = x + y
17+
> EOF
18+
19+
$ export DUNE_CACHE_ROOT=$(pwd)/dune_test_cache
20+
$ mkdir $DUNE_CACHE_ROOT
21+
22+
Initial build, populating cache
23+
24+
$ dune build --config-file config
25+
$ wc -l _build/log
26+
31 _build/log
27+
$ ls $DUNE_CACHE_ROOT
28+
files
29+
meta
30+
temp
31+
values
32+
33+
Second build, no-op as cache is warm
34+
35+
$ dune clean --config-file config
36+
$ dune build --config-file config
37+
$ wc -l _build/log
38+
17 _build/log
39+
40+
Build with --cache=disabled, which should be a no-op as _build is already populated
41+
42+
$ dune build --cache=disabled --config-file config
43+
$ wc -l _build/log
44+
22 _build/log
45+
46+
Second build with --cache=disabled, should be the same
47+
48+
$ dune build --cache=disabled --config-file config
49+
$ wc -l _build/log
50+
17 _build/log
51+
52+
Run the tests with cache except user rules
53+
54+
$ rm config
55+
$ rm -rf $DUNE_CACHE_ROOT
56+
$ mkdir $DUNE_CACHE_ROOT
57+
$ cat > config <<EOF
58+
> (lang dune 3.20)
59+
> (cache enabled-except-user-rules)
60+
> EOF
61+
62+
Initial build, populating shared cache
63+
64+
$ dune build --config-file config
65+
$ wc -l _build/log
66+
17 _build/log
67+
$ ls $DUNE_CACHE_ROOT
68+
files
69+
meta
70+
temp
71+
values
72+
73+
Second build, no-op as cache is warm
74+
75+
$ dune clean --config-file config
76+
$ dune build --config-file config
77+
$ wc -l _build/log
78+
22 _build/log
79+
80+
Build with --cache=disabled, which should be a no-op as _build is already populated
81+
82+
$ dune build --cache=disabled --config-file config
83+
$ wc -l _build/log
84+
17 _build/log
85+
86+
Second build with --cache=disabled, should be the same
87+
88+
$ dune build --cache=disabled --config-file config
89+
$ wc -l _build/log
90+
17 _build/log
91+
92+
Run the tests without cache
93+
94+
$ rm config
95+
$ rm -rf $DUNE_CACHE_ROOT
96+
$ mkdir $DUNE_CACHE_ROOT
97+
$ cat > config <<EOF
98+
> (lang dune 3.20)
99+
> (cache enabled-except-user-rules)
100+
> EOF
101+
102+
Initial build, populating local cache
103+
104+
$ dune build --config-file config
105+
$ wc -l _build/log
106+
17 _build/log
107+
$ ls $DUNE_CACHE_ROOT
108+
files
109+
meta
110+
temp
111+
values
112+
113+
Second build, no-op as cache is warm
114+
115+
$ dune clean --config-file config
116+
$ dune build --config-file config
117+
$ wc -l _build/log
118+
22 _build/log
119+
120+
Build with --cache=disabled, which should be a no-op as _build is already populated
121+
122+
$ dune build --cache=disabled --config-file config
123+
$ wc -l _build/log
124+
17 _build/log
125+
126+
Second build with --cache=disabled, should be the same
127+
128+
$ dune build --cache=disabled --config-file config
129+
$ wc -l _build/log
130+
17 _build/log

0 commit comments

Comments
 (0)