summary refs log tree commit diff
path: root/tests/utils.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-06-11 21:50:17 +0200
committerLudovic Courtès <ludo@gnu.org>2012-06-11 21:50:17 +0200
commit9809055707de8c518e928e09ea76dd10fbc19a6a (patch)
treee8a1f8d619ee8bae7074f9f0561e39929ca4ca90 /tests/utils.scm
parentb37eb5ede67f8f26dcbbb0d9c60050db10b63d00 (diff)
downloadguix-9809055707de8c518e928e09ea76dd10fbc19a6a.tar.gz
Add a `%current-system' fluid.
* guix/utils.scm (gnu-triplet->nix-system): New procedure.
  (%current-system): New variable.

* tests/utils.scm ("gnu-triplet->nix-system"): New test.

* tests/derivations.scm (%current-system): Remove.  Update users to
  use (%current-system) instead.
Diffstat (limited to 'tests/utils.scm')
-rw-r--r--tests/utils.scm13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/utils.scm b/tests/utils.scm
index db4eb5a340..b3c7fefa39 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -20,6 +20,7 @@
 (define-module (test-utils)
   #:use-module (guix utils)
   #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-11)
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-64)
   #:use-module (rnrs bytevectors)
@@ -85,6 +86,18 @@
               (close-pipe p)
               l))))
 
+(test-assert "gnu-triplet->nix-system"
+  (let ((samples '(("i586-gnu0.3" "i686-gnu")
+                   ("x86_64-unknown-linux-gnu" "x86_64-linux")
+                   ("i386-pc-linux-gnu" "i686-linux")
+                   ("x86_64-unknown-freebsd8.2" "x86_64-freebsd")
+                   ("x86_64-apple-darwin10.8.0" "x86_64-darwin")
+                   ("i686-pc-cygwin" "i686-cygwin"))))
+    (let-values (((gnu nix) (unzip2 samples)))
+      (every (lambda (gnu nix)
+               (equal? nix (gnu-triplet->nix-system gnu)))
+             gnu nix))))
+
 (test-end)