summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMaxime Devos <maximedevos@telenet.be>2021-07-14 13:12:49 +0200
committerMark H Weaver <mhw@netris.org>2021-11-07 01:38:23 -0400
commitb0519cc4b04d29ea9327a117eb6c8c21547e6159 (patch)
tree51ae9e3d2f76f1d32ffb368af869f252f7a77da9 /tests
parentb96ae47bb08f315be8c22f0ee4248dc36c0d6d29 (diff)
downloadguix-patches-b0519cc4b04d29ea9327a117eb6c8c21547e6159.tar
guix-patches-b0519cc4b04d29ea9327a117eb6c8c21547e6159.tar.gz
utils: Define a target-x86-32? and target-x86-64? predicate.
* guix/utils.scm (target-x86-32?, target-x86-64?): New predicates. * tests/utils.scm ("target-x86-32?", "target-x86-64?"): New tests. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/utils.scm23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/utils.scm b/tests/utils.scm
index 7fcbb25552..2b7db73905 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -289,6 +289,29 @@ skip these tests."
(string-closest "hello" '("kikoo" "helo" "hihihi" "halo"))
(string-closest "hello" '("aaaaa" "12345" "hellohello" "h"))))
+(test-equal "target-x86-32?"
+ '(#f #f #f #t #t #t #t #f)
+ ;; These are (according to Wikipedia) two RISC architectures
+ ;; by Intel and presumably not compatible with the x86-32 series.
+ (map target-x86-32?
+ '("i860-gnu" "i960-gnu"
+ ;; This is a 16-bit architecture
+ "i286-gnu"
+ ;; These are part of the x86-32 series.
+ "i386-gnu" "i486-gnu" "i586-gnu" "i686-gnu"
+ ;; Maybe this one will exist some day, but not yet.
+ "i786-gnu")))
+
+(test-equal "target-x86-64?"
+ '(#t #f #f #f)
+ (map target-x86-64?
+ `("x86_64-linux-gnu" "i386-linux-gnu"
+ ;; Just because it includes "64" doesn't make it 64-bit.
+ "aarch64-linux-gnu"
+ ;; Note that (expt 2 109) in decimal notation starts with 64.
+ ;; However, it isn't 32-bit.
+ ,(format #f "x86_~a-linux-gnu" (expt 2 109)))))
+
(test-end)
(false-if-exception (delete-file temp-file))