offload.scm 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. (define-module (tests offload)
  19. #:use-module (guix scripts offload)
  20. #:use-module (srfi srfi-64))
  21. (test-begin "offload")
  22. (define-syntax-rule (expose-internal-definitions s1 s2 ...)
  23. (begin
  24. (define s1 (@@ (guix scripts offload) s1))
  25. (define s2 (@@ (guix scripts offload) s2)) ...))
  26. (expose-internal-definitions machine-matches?
  27. build-requirements-system
  28. build-requirements-features
  29. build-machine-system
  30. build-machine-systems
  31. %build-machine-system
  32. %build-machine-systems
  33. build-machine-features)
  34. (define (deprecated-build-machine system)
  35. (build-machine
  36. (name "m1")
  37. (user "dummy")
  38. (host-key "some-key")
  39. (system system)))
  40. (define (new-build-machine systems)
  41. (build-machine
  42. (name "m1")
  43. (user "dummy")
  44. (host-key "some-key")
  45. (systems systems)))
  46. ;;; Test that deprecated build-machine definitions still work.
  47. (test-assert (machine-matches? (deprecated-build-machine "i686-linux")
  48. (build-requirements
  49. (system "i686-linux"))))
  50. (test-assert (machine-matches? (new-build-machine '("i686-linux"))
  51. (build-requirements
  52. (system "i686-linux"))))
  53. ;;; A build machine can act as more than one system type, thanks to QEMU
  54. ;;; emulation.
  55. (test-assert (machine-matches? (new-build-machine '("armhf-linux"
  56. "aarch64-linux"
  57. "i686-linux"
  58. "x86_64-linux"))
  59. (build-requirements
  60. (system "armhf-linux"))))