summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtyom V. Poptsov <poptsov.artyom@gmail.com>2016-12-31 03:00:41 +0300
committerArtyom V. Poptsov <poptsov.artyom@gmail.com>2016-12-31 03:00:41 +0300
commita7504d30fd4453308d9be07d78058b3aa84db94d (patch)
treeb129bb94f45e6d848f81119161448f245f7aa0ef
parenttests/common.scm: (start-server/exec): Send EOF after response (diff)
downloadguile-ssh-a7504d30fd4453308d9be07d78058b3aa84db94d.tar.gz
tests/shell.scm: Add to the repository
* tests/shell.scm: Add to the repository. * tests/Makefile.am (SCM_TESTS): Add 'shell.scm'.
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/shell.scm65
2 files changed, 66 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f791aa7..a9981f9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -25,6 +25,7 @@ SCM_TESTS = \
session.scm \
client-server.scm \
popen.scm \
+ shell.scm \
server-client.scm \
sssh-ssshd.scm \
key.scm \
diff --git a/tests/shell.scm b/tests/shell.scm
new file mode 100644
index 0000000..743fc39
--- /dev/null
+++ b/tests/shell.scm
@@ -0,0 +1,65 @@
+;;; shell.scm -- Remote shell tests.
+
+;; Copyright (C) 2016 Artyom V. Poptsov <poptsov.artyom@gmail.com>
+;;
+;; This file is a part of Guile-SSH.
+;;
+;; Guile-SSH is free software: you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation, either version 3 of the
+;; License, or (at your option) any later version.
+;;
+;; Guile-SSH is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Guile-SSH. If not, see <http://www.gnu.org/licenses/>.
+
+(add-to-load-path (getenv "abs_top_srcdir"))
+
+(use-modules (srfi srfi-64)
+ (ice-9 receive)
+ (srfi srfi-4)
+ (ssh session)
+ (ssh auth)
+ (ssh key)
+ (ssh log)
+ (ssh shell)
+ (ssh popen)
+ (tests common))
+
+(test-begin-with-log "shell")
+
+(define (call-with-connected-session/shell proc)
+ "Make a session for a shell test."
+ (call-with-connected-session
+ (lambda (session)
+ (format-log/scm 'nolog "call-with-connected-session/shell"
+ "session: ~a" session)
+ (authenticate-server session)
+ (userauth-none! session)
+ (proc session))))
+
+;;;
+
+;; Client executes "uname", server replies with success code 0.
+(test-assert-with-log "rexec"
+ (run-client-test
+ start-server/exec
+ (lambda ()
+ (call-with-connected-session/shell
+ (lambda (session)
+ (receive (result exit-code)
+ (rexec session "uname")
+ (list result exit-code)))))))
+
+
+;;;
+
+(test-end "shell")
+
+(exit (= (test-runner-fail-count (test-runner-current)) 0))
+
+;;; shell.scm ends here.