From f54852be22c29a0d5b174d15ef6189c57cab2017 Mon Sep 17 00:00:00 2001 From: Maxime Devos Date: Wed, 14 Jul 2021 13:12:49 +0200 Subject: 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 --- tests/utils.scm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests') diff --git a/tests/utils.scm b/tests/utils.scm index e170070907..648e91f242 100644 --- a/tests/utils.scm +++ b/tests/utils.scm @@ -306,6 +306,29 @@ (define (test-compression/decompression method run?) '("i686-linux-gnu" "i686-pc-gnu" "i686-w64-mingw32"))) +(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)) -- cgit v1.2.3