scripts.scm 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2015, 2019 Ludovic Courtès <ludo@gnu.org>
  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 (test-scripts)
  19. #:use-module (guix scripts)
  20. #:use-module (guix tests)
  21. #:use-module ((guix scripts build)
  22. #:select (%standard-build-options))
  23. #:use-module (srfi srfi-64))
  24. ;; Test the (guix scripts) module.
  25. (test-begin "scripts")
  26. (test-equal "parse-command-line"
  27. '((argument . "bar") (argument . "foo")
  28. (cores . 10) ;takes precedence
  29. (substitutes? . #f) (keep-failed? . #t)
  30. (max-jobs . 77) (cores . 42))
  31. (with-environment-variable "GUIX_BUILD_OPTIONS" "-c 42 -M 77"
  32. (parse-command-line '("--keep-failed" "--no-substitutes"
  33. "--cores=10" "foo" "bar")
  34. %standard-build-options
  35. (list '()))))
  36. (test-equal "parse-command-line and --no options"
  37. '((argument . "foo")
  38. (substitutes? . #f)) ;takes precedence
  39. (with-environment-variable "GUIX_BUILD_OPTIONS" "--no-substitutes"
  40. (parse-command-line '("foo")
  41. %standard-build-options
  42. (list '((substitutes? . #t))))))
  43. (test-end "scripts")
  44. ;;; Local Variables:
  45. ;;; eval: (put 'with-environment-variable 'scheme-indent-function 2)
  46. ;;; End: