tests: Fix ‘store-deduplication.scm’ on systems with large blocks.

Fixes <https://issues.guix.gnu.org/74862>.

In particular, this makes it possible to build guix on Asahi, whose tmpfs has
16KiB blocks by default.

* tests/store-deduplication.scm
("copy-file/deduplicate, sparse files (holes: ~a/~a/~a)"): Scale hole sizes so
the test works with blocks bigger than 4KiB.

Change-Id: I92fee04f6f69d4e5bfea7443991303ad68da7b2c
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Brennan Vincent 2025-10-01 13:39:13 -07:00 committed by Ludovic Courtès
parent 3414e3d994
commit ef42ecb8cb
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -190,7 +190,19 @@
initial-gap middle-gap final-gap)
(call-with-temporary-directory
(lambda (store)
(let ((source (string-append store "/source")))
(let* ((source (string-append store "/source"))
(store-st (stat store))
(store-bksz (stat:blksize store-st))
;; the test checks that space is actually saved
;; by the holes, but this isn't the case if
;; the size of each allocated block is large enough to swamp the savings.
;;
;; So, on large-block systems (e.g. Asahi tmpfs) we need
;; to scale the gaps so this is true again.
(scale (max 1 (/ store-bksz 4096)))
(initial-gap (* initial-gap scale))
(middle-gap (* middle-gap scale))
(final-gap (* final-gap scale)))
(call-with-output-file source
(lambda (port)
(seek port initial-gap SEEK_CUR)