audio.scm 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2017 Peter Mikkelsen <petermikkelsen10@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 (gnu tests audio)
  19. #:use-module (gnu tests)
  20. #:use-module (gnu system)
  21. #:use-module (gnu system vm)
  22. #:use-module (gnu services)
  23. #:use-module (gnu services audio)
  24. #:use-module (gnu packages mpd)
  25. #:use-module (guix gexp)
  26. #:export (%test-mpd))
  27. (define %mpd-os
  28. (simple-operating-system
  29. (service mpd-service-type)))
  30. (define (run-mpd-test)
  31. "Run tests in %mpd-os, which has mpd running."
  32. (define os
  33. (marionette-operating-system
  34. %mpd-os
  35. #:imported-modules '((gnu services herd))))
  36. (define vm
  37. (virtual-machine os))
  38. (define test
  39. (with-imported-modules '((gnu build marionette))
  40. #~(begin
  41. (use-modules (srfi srfi-64)
  42. (gnu build marionette))
  43. (define marionette
  44. (make-marionette (list #$vm)))
  45. (mkdir #$output)
  46. (chdir #$output)
  47. (test-begin "mpd")
  48. (test-assert "service is running"
  49. (marionette-eval
  50. '(begin
  51. (use-modules (gnu services herd))
  52. (start-service 'mpd))
  53. marionette))
  54. (test-assert "mpd listening"
  55. ;; Wait until mpd is actually listening before spawning 'mpc'.
  56. (wait-for-tcp-port 6600 marionette))
  57. (test-equal "mpc connect"
  58. 0
  59. (marionette-eval
  60. '(system* #$(file-append mpd-mpc "/bin/mpc"))
  61. marionette))
  62. (test-end)
  63. (exit (= (test-runner-fail-count (test-runner-current)) 0)))))
  64. (gexp->derivation "mpd-test" test))
  65. (define %test-mpd
  66. (system-test
  67. (name "mpd")
  68. (description "Test that the mpd can run and be connected to.")
  69. (value (run-mpd-test))))