[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/04: store-database: Add test checking the directory mtime after 'regi
From: |
guix-commits |
Subject: |
02/04: store-database: Add test checking the directory mtime after 'register-path'. |
Date: |
Sat, 21 Nov 2020 06:41:08 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit ac435c14a627f620bf6719efbdd214a12b33716e
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Fri Nov 20 11:35:23 2020 +0100
store-database: Add test checking the directory mtime after 'register-path'.
* tests/store-database.scm ("register-path, directory"): New test.
---
tests/store-database.scm | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/tests/store-database.scm b/tests/store-database.scm
index 4d91884..3b4ef43 100644
--- a/tests/store-database.scm
+++ b/tests/store-database.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2017, 2018, 2020 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -21,6 +21,8 @@
#:use-module (guix store)
#:use-module (guix store database)
#:use-module ((guix utils) #:select (call-with-temporary-output-file))
+ #:use-module ((guix build utils)
+ #:select (mkdir-p delete-file-recursively))
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-64))
@@ -55,6 +57,28 @@
(list (stat:mtime (lstat file))
(stat:mtime (lstat ref)))))))
+(test-equal "register-path, directory"
+ '(1 1 1)
+ (let ((file (string-append (%store-prefix) "/" (make-string 32 #\f)
+ "-fake-directory")))
+ (when (valid-path? %store file)
+ (delete-paths %store (list file)))
+ (false-if-exception (delete-file-recursively file))
+
+ (let ((drv (string-append file ".drv")))
+ (mkdir-p (string-append file "/a"))
+ (call-with-output-file (string-append file "/a/b")
+ (const #t))
+ (register-path file #:deriver drv)
+
+ (and (valid-path? %store file)
+ (null? (references %store file))
+ (null? (valid-derivers %store file))
+ (null? (referrers %store file))
+ (list (stat:mtime (lstat file))
+ (stat:mtime (lstat (string-append file "/a")))
+ (stat:mtime (lstat (string-append file "/a/b"))))))))
+
(test-equal "new database"
(list 1 2)
(call-with-temporary-output-file