Megatest

Diff
Login

Differences From Artifact [f76ffe0828]:

To Artifact [a2b7f04cc7]:


26
27
28
29
30
31
32
33

34
35
36
37
38
39
40
41
42

43
44
45
46
47
48
49
26
27
28
29
30
31
32

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50







-
+









+








(define help "Usage: ulex-test COMMAND
  where COMMAND is one of:
    run host:port  : start test server - start several in same dir
")

(define (call uconn msg addr)
  (print "Sent: "msg", received: "
  (print "Sent: "msg" to " addr ", received: "
	 (send-receive uconn addr 'hello msg)))

;; start    => hello 0
;; hello 0  => hello 1
;; hello 1  => hello 2
;;  ...
;; hello 11 => 'done
;;
(define (process-message mesg)
  (print "In process-message")
  (let ((parts (string-split mesg)))
    (match
     parts
     ((msg c)
      (let ((count (string->number c)))
	(if (> count 10)
	    'done
81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
96
97
98
99
100
82
83
84
85
86
87
88

89
90
91
92
93
94
95
96
97
98
99
100
101







-
+












	      (delete-file* rfile)
	      (sleep 1)
	      (exit))
	    (if (null? entries)
		(loop (glob ".runners/*"))
		(let* ((entry (car entries))
		       (destaddr (with-input-from-file entry read-line)))
		  (call uconn (conc "hello-from-"myport"to-"destaddr) destaddr)
		  (call uconn (conc "hello-from-"myport"to-"destaddr) (conc "localhost:" destaddr))
		  ;; (thread-sleep! 0.025)
		  (loop (cdr entries))))))))
   ((cmd)(print "ERROR: command "cmd", not recognised.\n\n"help))
   (else
    (print help))))

) ;; end module

(import ulex-test)
(main)