Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 155 additions & 0 deletions test/blackbox-tests/test-cases/dune-cache/cache-disabled.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
Set up project and cache directory

$ echo "(lang dune 3.20)" > dune-project

$ cat > config <<EOF
> (lang dune 3.20)
> (cache enabled)
> EOF

$ cat > dune << EOF
> (library
> (name foo))
> EOF

$ cat > foo.ml << EOF
> let f x y = x + y
> EOF

$ export DUNE_CACHE_ROOT=$(pwd)/dune_test_cache
$ mkdir $DUNE_CACHE_ROOT

Initial build, populating cache

$ dune build --config-file config
$ wc -l _build/log
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have preferred to cat _build/log but some lines are starting with $ and it confuses the cram tests on subsequent runs.

31 _build/log
$ ls $DUNE_CACHE_ROOT
files
meta
temp
values

Second build, no-op as cache is warm

$ dune clean --config-file config
$ dune build --config-file config
$ wc -l _build/log
17 _build/log

Build with --cache=disabled, which should be a no-op as _build is already populated. But unfortunately it is not.

$ dune build --cache=disabled --config-file config
$ wc -l _build/log
22 _build/log
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given that _build is still populated from the previous build, why do we have more stuff being built?


Second build with --cache=disabled, should be the same. Here we see it is really a no-op

$ dune build --cache=disabled --config-file config
$ wc -l _build/log
17 _build/log

$ dune clean
$ dune build --cache=disabled --config-file config
$ wc -l _build/log
22 _build/log
$ dune build --cache=disabled --config-file config
$ wc -l _build/log
17 _build/log
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is it the same as during the second build, as expected


Run the tests with cache except user rules

$ rm config
$ rm -rf $DUNE_CACHE_ROOT
$ mkdir $DUNE_CACHE_ROOT
$ cat > config <<EOF
> (lang dune 3.20)
> (cache enabled-except-user-rules)
> EOF

Initial build, populating shared cache

$ dune build --config-file config
$ wc -l _build/log
17 _build/log
$ ls $DUNE_CACHE_ROOT
files
meta
temp
values

Second build, no-op as cache is warm

$ dune clean --config-file config
$ dune build --config-file config
$ wc -l _build/log
22 _build/log
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shared cache is warm but more stuff is built?


Build with --cache=disabled, which should be a no-op as _build is already populated

$ dune build --cache=disabled --config-file config
$ wc -l _build/log
17 _build/log

Second build with --cache=disabled, should be the same

$ dune build --cache=disabled --config-file config
$ wc -l _build/log
17 _build/log

$ dune clean
$ dune build --cache=disabled --config-file config
$ wc -l _build/log
22 _build/log
$ dune build --cache=disabled --config-file config
$ wc -l _build/log
17 _build/log

Run the tests without cache

$ rm config
$ rm -rf $DUNE_CACHE_ROOT
$ mkdir $DUNE_CACHE_ROOT
$ cat > config <<EOF
> (lang dune 3.20)
> (cache enabled-except-user-rules)
> EOF

Initial build, populating local cache

$ dune build --config-file config
$ wc -l _build/log
17 _build/log
$ ls $DUNE_CACHE_ROOT
files
meta
temp
values

Second build, no-op as cache is warm

$ dune clean --config-file config
$ dune build --config-file config
$ wc -l _build/log
22 _build/log
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given that _build is still populated from the previous build, why do we have more stuff being built?


Build with --cache=disabled, which should be a no-op as _build is already populated

$ dune build --cache=disabled --config-file config
$ wc -l _build/log
17 _build/log

Second build with --cache=disabled, should be the same

$ dune build --cache=disabled --config-file config
$ wc -l _build/log
17 _build/log

$ dune clean
$ dune build --cache=disabled --config-file config
$ wc -l _build/log
22 _build/log
$ dune build --cache=disabled --config-file config
$ wc -l _build/log
17 _build/log

Loading