Get rid of mkstr, it causes troubles with namespaces in with-remote (via
[cl-cluster.git] / tests.lisp
blob2f9a779bce44e43eb37dee55a2329c61ebb48427
1 (require :cl-cluster)
3 (in-package :cl-cluster)
5 ;;; tests
6 (let ((node1 (make-instance 'node :host "rhel4" :connect t))
7 (node2 (make-instance 'node :host "rhel5" :connect t))
8 (node3 (make-instance 'node :host "rhel5" :lisp "/usr/bin/clisp -q" :connect t)))
9 (declare (special node1 node2 node3))
11 (dolist (node (list node1 node2 node3))
12 (when (node-alive-p node)
13 (handler-case
14 (progn
15 (format t "Remote \"~A\" runs ~A ~A~%"
16 (node-host node)
17 (node-exec node "(lisp-implementation-type)")
18 (node-exec node "(lisp-implementation-version)"))
19 (node-exec node "(killallhumans)"))
20 (error (condition)
21 (format t "got error: ~A~%" condition)))))
23 (print (rlet node3
24 ((a (with-remote node1
25 (+ 1 2)))
26 (b (with-remote node2
27 (sqrt 7d0))))
28 (* a b))))
30 (setq n1 (make-instance 'node :host "rhel4" :connect t))
31 (setq n2 (make-instance 'node :host "rhel5" :connect t))
32 ;; connect to host's different lisp
33 (setq n3 (make-instance 'node :host "rhel5" :lisp "/usr/bin/clisp -q" :connect t))
35 (setq n4 (make-instance 'node :host "rhel4" :lisp "/usr/bin/clisp -q" :connect t))
37 ;; node-exec expets only strings
38 (node-exec n1 1)
40 ;; catch remote exception locally
41 (node-exec n1 "(lisp-implementation-type1)")
43 (with-remote n1
44 (lisp-implementation-type)
45 (lisp-implementation-version))
47 ;; calculate some stuff on remote lisps and aggregate answers on another remote
48 (rplet n3
49 ((a (with-remote n1
50 (+ 1 2)))
51 (b (with-remote n2
52 (sqrt 7d0))))
54 (* a b))
56 ;; catch exception
57 (with-remote n1
58 nil
59 (dotimes (i 10)
60 (+ i j)))
62 ;; eval body in progn
63 (rplet n1 ()
64 (lisp-implementation-type)
65 (lisp-implementation-version))
67 ;; avoid reader error
68 (with-remote n1
69 (asdf:oos 'asdf:load-op :asdf))