Fix `validate-target' in (system base target).
* module/system/base/target.scm (validate-target): Accept any tuple with
at least 3 parts.
* test-suite/tests/asm-to-bytecode.test (test-triplet): New procedure.
("cross-compilation"): New test prefix.
This commit is contained in:
parent
f0d1bacd78
commit
e0a9f02224
2 changed files with 26 additions and 3 deletions
|
|
@ -42,7 +42,7 @@
|
|||
(define (validate-target target)
|
||||
(if (or (not (string? target))
|
||||
(let ((parts (string-split target #\-)))
|
||||
(or (< 3 (length parts))
|
||||
(or (< (length parts) 3)
|
||||
(or-map string-null? parts))))
|
||||
(error "invalid target" target)))
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,17 @@
|
|||
;;;; Assembly to bytecode compilation -*- mode: scheme; coding: utf-8; -*-
|
||||
;;;;
|
||||
;;;; Copyright (C) 2010, 2011 Free Software Foundation, Inc.
|
||||
;;;;
|
||||
;;;; This library is free software; you can redistribute it and/or
|
||||
;;;; modify it under the terms of the GNU Lesser General Public
|
||||
;;;; License as published by the Free Software Foundation; either
|
||||
;;;; version 3 of the License, or (at your option) any later version.
|
||||
;;;;
|
||||
;;;;
|
||||
;;;; This library is distributed in the hope that it will be useful,
|
||||
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
;;;; Lesser General Public License for more details.
|
||||
;;;;
|
||||
;;;;
|
||||
;;;; You should have received a copy of the GNU Lesser General Public
|
||||
;;;; License along with this library; if not, write to the Free Software
|
||||
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
|
@ -19,6 +21,7 @@
|
|||
#:use-module ((rnrs io ports) #:select (open-bytevector-output-port))
|
||||
#:use-module (test-suite lib)
|
||||
#:use-module (system vm instruction)
|
||||
#:use-module (system base target)
|
||||
#:use-module (language assembly)
|
||||
#:use-module (language assembly compile-bytecode))
|
||||
|
||||
|
|
@ -114,3 +117,23 @@
|
|||
(uint32 0) ;; metalen
|
||||
make-int8 3
|
||||
return))))
|
||||
|
||||
|
||||
(define (test-triplet cpu vendor os)
|
||||
(let ((triplet (string-append cpu "-" vendor "-" os)))
|
||||
(pass-if (format #f "triplet ~a" triplet)
|
||||
(with-target triplet
|
||||
(lambda ()
|
||||
(and (string=? (target-cpu) cpu)
|
||||
(string=? (target-vendor) vendor)
|
||||
(string=? (target-os) os)))))))
|
||||
|
||||
(with-test-prefix "cross-compilation"
|
||||
|
||||
(test-triplet "i586" "pc" "gnu0.3")
|
||||
(test-triplet "x86_64" "unknown" "linux-gnu")
|
||||
(test-triplet "x86_64" "unknown" "kfreebsd-gnu"))
|
||||
|
||||
;; Local Variables:
|
||||
;; eval: (put 'with-target 'scheme-indent-function 1)
|
||||
;; End:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue