diff options
| author | Artyom V. Poptsov <poptsov.artyom@gmail.com> | 2017-04-23 07:19:35 +0300 |
|---|---|---|
| committer | Artyom V. Poptsov <poptsov.artyom@gmail.com> | 2017-04-23 07:19:35 +0300 |
| commit | c217d63e3dae2f03e90944d72eae92cb4d089134 (patch) | |
| tree | f30fb3fe8fccf81d2e657ffa4d81ab1aeb75f490 /tests | |
| parent | doc/guile-ssh.texi: Fix a grammar error (diff) | |
| download | guile-ssh-c217d63e3dae2f03e90944d72eae92cb4d089134.tar.gz | |
node.scm (rrepl-get-result): Bugfix: Handle compilation errors
Guile-SSH would always fail to read compilation errors properly because it
considered the message as "undefined" result. Now this bug should be fixed.
An example of an error that now should be handled is "no code for module" due
to using a non-existing module in 'with-ssh' expression.
Reported by Mathieu, in
<https://github.com/artyom-poptsov/guile-ssh/issues/3>
* modules/ssh/dist/node.scm (rrepl-get-result): Bugfix: Do not consider
compilation errors as undefined results.
(rrepl-eval): Call 'exit' on the remote side to ensure that the remote side
closed a channel.
* tests/dist.scm: Improve logging.
("rrepl-get-result, compilation error"): New TC.
* doc/guile-ssh.texi (Acknowledgments): Update.
* AUTHORS, NEWS, THANKS: Update.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/dist.scm | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/tests/dist.scm b/tests/dist.scm index 88df35c..307a7bb 100644 --- a/tests/dist.scm +++ b/tests/dist.scm @@ -104,6 +104,8 @@ (receive (result eval-num module-name lang) (call-with-input-string "scheme@(guile-user)> $0 = test" rrepl-get-result) + ;; (format (current-error-port) + ;; "\tresult: ~a\neval-num: ~a" (and (eq? result 'test) (= eval-num 0) (string=? module-name "(guile-user)") @@ -123,6 +125,14 @@ (call-with-input-string "scheme@(guile-user)> ERROR: error." rrepl-get-result)) +;; See <https://github.com/artyom-poptsov/guile-ssh/issues/3>. +(test-error-with-log/= "rrepl-get-result, compilation error" + 'node-repl-error "scheme@(guile-user)> While compiling expression:\nERROR: no code for module (module-that-doesnt-exist)" + (call-with-input-string + (string-append "scheme@(guile-user)> While compiling expression:\n" + "ERROR: no code for module (module-that-doesnt-exist)") + rrepl-get-result)) + (test-assert "rrepl-get-result, elisp" (receive (result eval-num module-name lang) (call-with-input-string "elisp@(guile-user)> $0 = #nil" @@ -175,28 +185,31 @@ (start-session-loop session (lambda (msg type) + (format-log/scm 'nolog + "server" + "msg: ~a; type: ~a" msg type) (case (car type) ((request-channel-open) (let ((c (message-channel-request-open-reply-accept msg))) - + (format-log/scm 'nolog "server" "channel 0: ~a" c) ;; Write the last line of Guile REPL greeting message to ;; pretend that we're a REPL server. (write-line "Enter `,help' for help." c) - + (format-log/scm 'nolog "server" "channel 1: ~a" c) (usleep 100) (poll c (lambda args ;; Read expression (let ((result (read-line c))) - (format-log 'nolog "server" - "[SCM] sexp: ~a" result) + (format-log/scm 'nolog "server" + "sexp: ~a" result) (or (string=? result "(begin (+ 21 21))") (error "Wrong result 1" result))) ;; Read newline (let ((result (read-line c))) - (format-log 'nolog "server" - "[SCM] sexp: ~a" result) + (format-log/scm 'nolog "server" + "sexp: ~a" result) (or (string=? result "(newline)") (error "Wrong result 2" result))) @@ -210,7 +223,7 @@ (call-with-connected-session (lambda (session) (authenticate-server session) - + (format-log/scm 'nolog "client" "session: ~a" session) (unless (equal? (userauth-none! session) 'success) (error "Could not authenticate with a server" session)) |
