summaryrefslogtreecommitdiff
path: root/tests/packages.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-08-24 16:58:44 +0200
committerLudovic Courtès <ludo@gnu.org>2013-08-24 17:30:31 +0200
commit7357138bba23851584f522e6a986ca3fc80dbf43 (patch)
treee66c5334a78472b4f33ad12e1057aa78d996925b /tests/packages.scm
parentb095792f9b8676411f7b5eb6c768d28ae123449b (diff)
downloadpatches-7357138bba23851584f522e6a986ca3fc80dbf43.tar
patches-7357138bba23851584f522e6a986ca3fc80dbf43.tar.gz
packages: Allow file names as package sources.
* guix/packages.scm (package-source-derivation): Add cases for SOURCE as a store path or user file. * tests/packages.scm ("package-source-derivation, file", "package-source-derivation, store path"): New tests.
Diffstat (limited to 'tests/packages.scm')
-rw-r--r--tests/packages.scm22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/packages.scm b/tests/packages.scm
index 78770c7d94..8619011f59 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -99,7 +99,27 @@
("d" ,d) ("d/x" "something.drv"))
(pk 'x (package-transitive-inputs e))))))
-(test-skip (if (not %store) 6 0))
+(test-skip (if (not %store) 8 0))
+
+(test-assert "package-source-derivation, file"
+ (let* ((file (search-path %load-path "guix.scm"))
+ (package (package (inherit (dummy-package "p"))
+ (source file)))
+ (source (package-source-derivation %store
+ (package-source package))))
+ (and (store-path? source)
+ (valid-path? %store source)
+ (equal? (call-with-input-file source get-bytevector-all)
+ (call-with-input-file file get-bytevector-all)))))
+
+(test-assert "package-source-derivation, store path"
+ (let* ((file (add-to-store %store "guix.scm" #t "sha256"
+ (search-path %load-path "guix.scm")))
+ (package (package (inherit (dummy-package "p"))
+ (source file)))
+ (source (package-source-derivation %store
+ (package-source package))))
+ (string=? file source)))
(test-assert "return values"
(let-values (((drv-path drv)