diff options
| author | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2020-08-24 16:26:14 -0400 |
|---|---|---|
| committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2020-08-25 13:45:27 -0400 |
| commit | 4b5a6fbc9b754c0ca70d033dd99f17c4f028733a (patch) | |
| tree | 7e1267a5ab1edc10d1b4dd71e51a80f17c8fba36 /tests/offload.scm | |
| parent | a5ccf1b522b443fa2aab79a4833810bdede4a9ff (diff) | |
offload: Modify the build-machine record to accept multiple systems.
* guix/scripts/offload.scm (<build-machine>)[systems]: New field.
[system]: Accessor changed to %build-machine-system. Default to #f.
* guix/scripts/offload.scm (build-machine-system): Wrap %build-machine-system
with a deprecation warning.
(build-machine-systems): Access the new systems field or fallback to use
build-machine-system, for backward compatibility.
(machine-matches?): Adjust.
* tests/offload.scm: Add tests...
* Makefile.am (SCM_TESTS): ...and register them.
* doc/guix.texi (Daemon Offload Setup): Update doc.
Diffstat (limited to 'tests/offload.scm')
| -rw-r--r-- | tests/offload.scm | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/offload.scm b/tests/offload.scm new file mode 100644 index 00000000000..5a5de4e8b92 --- /dev/null +++ b/tests/offload.scm | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | ||
| 2 | ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com> | ||
| 3 | ;;; | ||
| 4 | ;;; This file is part of GNU Guix. | ||
| 5 | ;;; | ||
| 6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | ||
| 7 | ;;; under the terms of the GNU General Public License as published by | ||
| 8 | ;;; the Free Software Foundation; either version 3 of the License, or (at | ||
| 9 | ;;; your option) any later version. | ||
| 10 | ;;; | ||
| 11 | ;;; GNU Guix is distributed in the hope that it will be useful, but | ||
| 12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | ;;; GNU General Public License for more details. | ||
| 15 | ;;; | ||
| 16 | ;;; You should have received a copy of the GNU General Public License | ||
| 17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | ||
| 18 | |||
| 19 | (define-module (tests offload) | ||
| 20 | #:use-module (guix scripts offload) | ||
| 21 | #:use-module (srfi srfi-64)) | ||
| 22 | |||
| 23 | |||
| 24 | (test-begin "offload") | ||
| 25 | |||
| 26 | (define-syntax-rule (expose-internal-definitions s1 s2 ...) | ||
| 27 | (begin | ||
| 28 | (define s1 (@@ (guix scripts offload) s1)) | ||
| 29 | (define s2 (@@ (guix scripts offload) s2)) ...)) | ||
| 30 | |||
| 31 | (expose-internal-definitions machine-matches? | ||
| 32 | build-requirements-system | ||
| 33 | build-requirements-features | ||
| 34 | build-machine-system | ||
| 35 | build-machine-systems | ||
| 36 | %build-machine-system | ||
| 37 | %build-machine-systems | ||
| 38 | build-machine-features) | ||
| 39 | |||
| 40 | (define (deprecated-build-machine system) | ||
| 41 | (build-machine | ||
| 42 | (name "m1") | ||
| 43 | (user "dummy") | ||
| 44 | (host-key "some-key") | ||
| 45 | (system system))) | ||
| 46 | |||
| 47 | (define (new-build-machine systems) | ||
| 48 | (build-machine | ||
| 49 | (name "m1") | ||
| 50 | (user "dummy") | ||
| 51 | (host-key "some-key") | ||
| 52 | (systems systems))) | ||
| 53 | |||
| 54 | ;;; Test that deprecated build-machine definitions still work. | ||
| 55 | (test-assert (machine-matches? (deprecated-build-machine "i686-linux") | ||
| 56 | (build-requirements | ||
| 57 | (system "i686-linux")))) | ||
| 58 | |||
| 59 | |||
| 60 | (test-assert (machine-matches? (new-build-machine '("i686-linux")) | ||
| 61 | (build-requirements | ||
| 62 | (system "i686-linux")))) | ||
| 63 | |||
| 64 | ;;; A build machine can act as more than one system type, thanks to QEMU | ||
| 65 | ;;; emulation. | ||
| 66 | (test-assert (machine-matches? (new-build-machine '("armhf-linux" | ||
| 67 | "aarch64-linux" | ||
| 68 | "i686-linux" | ||
| 69 | "x86_64-linux")) | ||
| 70 | (build-requirements | ||
| 71 | (system "armhf-linux")))) | ||
