This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,7 @@
This directory has various tests for the digest cache of Dune.
In most of the tests, we use --wait-for-filesystem-clock to make the
tests more reproducible. Without it, Dune might drop some entries or
not depending on whether the time lap between targets being produced
and dune saving the digest cache is smaller than the file system
granularity.

View file

@ -0,0 +1,13 @@
Test the --debug-digests command line option
$ echo '(lang dune 3.0)' > dune-project
$ touch x
$ dune build x --wait-for-filesystem-clock
$ echo 1 > x
$ dune build x --wait-for-filesystem-clock --debug-digests 2>&1 | sed 's/stats =.*/stats = XXX/'
Re-digested file x because its stats changed:
{ old_digest = digest "662cf3f7d59f76428301690d4ead67ae"
; new_digest = digest "f31e1f1c33564e07cd02ad2c52f4df85"
; old_stats = XXX
; new_stats = XXX
}

View file

@ -0,0 +1,16 @@
Reproduction case for a bug we discovered in the past; Dune was
storing the wrong stats for generated files in the digest cache and as
a result was always re-hashing all files in the build directory on the
second run.
More precisely, we were using the stats of the file before making it
read-only.
$ echo '(lang dune 3.0)' > dune-project
$ touch x y z
$ dune build x y z --wait-for-filesystem-clock
Check that the next build rehashes nothing:
$ dune build x y z --wait-for-filesystem-clock --debug-digests 2>&1 | sed 's/stats = { .*\( perm = [0-9]*\).*}/stats = {\1; ... }/'