security-token.scm 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
  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 security-token)
  19. #:use-module (gnu tests)
  20. #:use-module (gnu system vm)
  21. #:use-module (gnu services)
  22. #:use-module (gnu services security-token)
  23. #:use-module (guix gexp)
  24. #:export (%test-pcscd))
  25. (define %pcscd-os
  26. (simple-operating-system
  27. (service pcscd-service-type)))
  28. (define* (run-pcscd-test)
  29. "Run tests of 'pcscd-service-type'."
  30. (define os
  31. (marionette-operating-system
  32. %pcscd-os
  33. #:imported-modules '((gnu services herd))
  34. #:requirements '(pcscd)))
  35. (define test
  36. (with-imported-modules '((gnu build marionette))
  37. #~(begin
  38. (use-modules (srfi srfi-64)
  39. (gnu build marionette))
  40. (define marionette
  41. (make-marionette (list #$(virtual-machine os))))
  42. (mkdir #$output)
  43. (chdir #$output)
  44. (test-begin "pcscd")
  45. (test-assert "pcscd is alive"
  46. (marionette-eval
  47. '(begin
  48. (use-modules (gnu services herd))
  49. (live-service-running
  50. (find (lambda (live)
  51. (memq 'pcscd (live-service-provision live)))
  52. (current-services))))
  53. marionette))
  54. (test-end)
  55. (exit (= (test-runner-fail-count (test-runner-current)) 0)))))
  56. (gexp->derivation "pcscd" test))
  57. (define %test-pcscd
  58. (system-test
  59. (name "pcscd")
  60. (description "Test a running pcscd daemon.")
  61. (value (run-pcscd-test))))