tests: ssh: Make sure we can run executables from PATH.

* gnu/tests/ssh.scm (run-ssh-test): Add tests for running commands in system
and user profile.
This commit is contained in:
Marius Bakke 2017-10-29 15:59:54 +01:00
parent 2c16be569c
commit 5d7141cd28
No known key found for this signature in database
GPG Key ID: A2A06DF2A33A54FA
1 changed files with 28 additions and 0 deletions

View File

@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org> ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -169,6 +170,33 @@ root with an empty password."
(call-with-remote-input-file sftp-session witness (call-with-remote-input-file sftp-session witness
read))))) read)))))
;; Connect to the guest over SSH. Make sure we can run commands
;; from the system profile.
(test-equal "run executables from system profile"
#t
(call-with-connected-session/auth
(lambda (session)
(let ((channel (make-channel session)))
(channel-open-session channel)
(channel-request-exec
channel
(string-append
"mkdir -p /root/.guix-profile/bin && "
"touch /root/.guix-profile/bin/path-witness && "
"chmod 755 /root/.guix-profile/bin/path-witness"))
(zero? (channel-get-exit-status channel))))))
;; Connect to the guest over SSH. Make sure we can run commands
;; from the user profile.
(test-equal "run executable from user profile"
#t
(call-with-connected-session/auth
(lambda (session)
(let ((channel (make-channel session)))
(channel-open-session channel)
(channel-request-exec channel "path-witness")
(zero? (channel-get-exit-status channel))))))
(test-end) (test-end)
(exit (= (test-runner-fail-count (test-runner-current)) 0))))) (exit (= (test-runner-fail-count (test-runner-current)) 0)))))