~ruther/guix-local

ef42ecb8cb6c1868e57505a9593f0c0590980de1 — Brennan Vincent 7 months ago 3414e3d
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>
1 files changed, 13 insertions(+), 1 deletions(-)

M tests/store-deduplication.scm
M tests/store-deduplication.scm => tests/store-deduplication.scm +13 -1
@@ 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)