aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-03-28 21:26:33 +0100
committerLudovic Courtès <ludo@gnu.org>2015-03-29 22:23:33 +0200
commitd9ae938f2c950f3bf1896fb07189c3e28b4d8029 (patch)
treed9e533d40ad7d7e7cc02f5329e6502d0ab5b9013 /tests
parentb39fc6f7bcbe2c87247be48393a5a4105e08cc6d (diff)
downloadpatches-d9ae938f2c950f3bf1896fb07189c3e28b4d8029.tar
patches-d9ae938f2c950f3bf1896fb07189c3e28b4d8029.tar.gz
gexp: Add 'local-file'.
* guix/gexp.scm (<local-file>): New record type. (local-file): New procedure. (local-file-compiler): New compiler. (gexp->sexp) <struct? thing>: Handle the case where 'lower' returns a file name. (text-file*): Update docstring.local-file doc * tests/gexp.scm ("one local file", "gexp->derivation, local-file"): New tests. * doc/guix.texi (G-Expressions): Mention local files early. Document 'local-file'. Update 'text-file*' documentation.
Diffstat (limited to 'tests')
-rw-r--r--tests/gexp.scm26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index 0540969503..f81ef39860 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -97,6 +97,18 @@
%store (package-source coreutils))))
(gexp->sexp* exp)))))
+(test-assert "one local file"
+ (let* ((file (search-path %load-path "guix.scm"))
+ (local (local-file file))
+ (exp (gexp (display (ungexp local))))
+ (intd (add-to-store %store (basename file) #t
+ "sha256" file)))
+ (and (gexp? exp)
+ (match (gexp-inputs exp)
+ (((x "out"))
+ (eq? x local)))
+ (equal? `(display ,intd) (gexp->sexp* exp)))))
+
(test-assert "same input twice"
(let ((exp (gexp (begin
(display (ungexp coreutils))
@@ -336,6 +348,20 @@
(mlet %store-monad ((drv mdrv))
(return (string=? system (derivation-system drv))))))
+(test-assertm "gexp->derivation, local-file"
+ (mlet* %store-monad ((file -> (search-path %load-path "guix.scm"))
+ (intd (interned-file file))
+ (local -> (local-file file))
+ (exp -> (gexp (begin
+ (stat (ungexp local))
+ (symlink (ungexp local)
+ (ungexp output)))))
+ (drv (gexp->derivation "local-file" exp)))
+ (mbegin %store-monad
+ (built-derivations (list drv))
+ (return (string=? (readlink (derivation->output-path drv))
+ intd)))))
+
(test-assertm "gexp->derivation, cross-compilation"
(mlet* %store-monad ((target -> "mips64el-linux")
(exp -> (gexp (list (ungexp coreutils)