diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2020-11-20 11:35:23 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2020-11-21 12:39:14 +0100 |
| commit | ac435c14a627f620bf6719efbdd214a12b33716e (patch) | |
| tree | 39086e15adb216a26088249a51e109aaa1cd5ac4 /tests/store-database.scm | |
| parent | 2200bb214690ebc78b9fa42887ac9dfb8035bd4f (diff) | |
store-database: Add test checking the directory mtime after 'register-path'.
* tests/store-database.scm ("register-path, directory"): New test.
Diffstat (limited to 'tests/store-database.scm')
| -rw-r--r-- | tests/store-database.scm | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/store-database.scm b/tests/store-database.scm index 4d918842505..3b4ef43f6de 100644 --- a/tests/store-database.scm +++ b/tests/store-database.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2017, 2018, 2020 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; | 3 | ;;; |
| 4 | ;;; This file is part of GNU Guix. | 4 | ;;; This file is part of GNU Guix. |
| 5 | ;;; | 5 | ;;; |
| @@ -21,6 +21,8 @@ | |||
| 21 | #:use-module (guix store) | 21 | #:use-module (guix store) |
| 22 | #:use-module (guix store database) | 22 | #:use-module (guix store database) |
| 23 | #:use-module ((guix utils) #:select (call-with-temporary-output-file)) | 23 | #:use-module ((guix utils) #:select (call-with-temporary-output-file)) |
| 24 | #:use-module ((guix build utils) | ||
| 25 | #:select (mkdir-p delete-file-recursively)) | ||
| 24 | #:use-module (srfi srfi-26) | 26 | #:use-module (srfi srfi-26) |
| 25 | #:use-module (srfi srfi-64)) | 27 | #:use-module (srfi srfi-64)) |
| 26 | 28 | ||
| @@ -55,6 +57,28 @@ | |||
| 55 | (list (stat:mtime (lstat file)) | 57 | (list (stat:mtime (lstat file)) |
| 56 | (stat:mtime (lstat ref))))))) | 58 | (stat:mtime (lstat ref))))))) |
| 57 | 59 | ||
| 60 | (test-equal "register-path, directory" | ||
| 61 | '(1 1 1) | ||
| 62 | (let ((file (string-append (%store-prefix) "/" (make-string 32 #\f) | ||
| 63 | "-fake-directory"))) | ||
| 64 | (when (valid-path? %store file) | ||
| 65 | (delete-paths %store (list file))) | ||
| 66 | (false-if-exception (delete-file-recursively file)) | ||
| 67 | |||
| 68 | (let ((drv (string-append file ".drv"))) | ||
| 69 | (mkdir-p (string-append file "/a")) | ||
| 70 | (call-with-output-file (string-append file "/a/b") | ||
| 71 | (const #t)) | ||
| 72 | (register-path file #:deriver drv) | ||
| 73 | |||
| 74 | (and (valid-path? %store file) | ||
| 75 | (null? (references %store file)) | ||
| 76 | (null? (valid-derivers %store file)) | ||
| 77 | (null? (referrers %store file)) | ||
| 78 | (list (stat:mtime (lstat file)) | ||
| 79 | (stat:mtime (lstat (string-append file "/a"))) | ||
| 80 | (stat:mtime (lstat (string-append file "/a/b")))))))) | ||
| 81 | |||
| 58 | (test-equal "new database" | 82 | (test-equal "new database" |
| 59 | (list 1 2) | 83 | (list 1 2) |
| 60 | (call-with-temporary-output-file | 84 | (call-with-temporary-output-file |
