X-Git-Url: http://git.hcoop.net/jackhill/guix/guix.git/blobdiff_plain/bdb8267680f14ee5d3df9d029f23279c1457c211..97cb43e732a38758c95b7caf3963507188d011cf:/tests/cache.scm diff --git a/tests/cache.scm b/tests/cache.scm index e46cdd816d..d495ace2bd 100644 --- a/tests/cache.scm +++ b/tests/cache.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2017 Ludovic Courtès +;;; Copyright © 2017, 2020 Ludovic Courtès +;;; Copyright © 2022 Simon Tournier ;;; ;;; This file is part of GNU Guix. ;;; @@ -24,13 +25,6 @@ #:use-module ((guix utils) #:select (call-with-temporary-directory)) #:use-module (ice-9 match)) -(cond-expand - (guile-2.2 - ;; Guile 2.2.2 has a bug whereby 'time-monotonic' objects have seconds and - ;; nanoseconds swapped (fixed in Guile commit 886ac3e). Work around it. - (define time-monotonic time-tai)) - (else #t)) - (test-begin "cache") (test-equal "remove-expired-cache-entries" @@ -81,6 +75,20 @@ (lambda (port) (display 0 port))))) +(test-equal "maybe-remove-expired-cache-entries, empty cache" + '("a" "b" "c") + (test-cache-cleanup cache + (call-with-output-file (string-append cache "/last-expiry-cleanup") + (lambda (port) + (display "" port))))) + +(test-equal "maybe-remove-expired-cache-entries, corrupted cache" + '("a" "b" "c") + (test-cache-cleanup cache + (call-with-output-file (string-append cache "/last-expiry-cleanup") + (lambda (port) + (display "1\"34657890" port))))) + (test-end "cache") ;;; Local Variables: