Megatest

Check-in [e619f01971]
Login
Overview
Comment:Added initial file for nng testing
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.6584-nanomsg
Files: files | file ages | folders
SHA1: e619f0197179759eadb706f50a4ae057ee50690b
User & Date: matt on 2021-10-17 18:55:26
Other Links: branch diff | manifest | tags
Context
2021-10-21
15:08
yada check-in: 3b6efca64a user: matt tags: v1.6584-nanomsg
2021-10-17
18:55
Added initial file for nng testing check-in: e619f01971 user: matt tags: v1.6584-nanomsg
2021-10-13
11:23
Few build tweaks check-in: 013dc03cfd user: matt tags: v1.6584-nanomsg
Changes

Added nng-trial/nng-test.scm version [d3eb85a993].















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
(import (chicken io)
        (chicken string)
        miscmacros
        nng
        srfi-18
        test)


(define address-tcp-1 "tcp://localhost:5555")
(define address-tcp-2 "tcp://localhost:6666")

(define address-tls+tcp-1 "tls+tcp://localhost:5555")

(define address-inproc-1 "inproc://local1")
(define address-inproc-2 "inproc://local2")

(tls-register!)

(define cert
  (if (tls-enabled?)
      (with-input-from-file "cert.pem"
        (lambda ()
          (read-string)))
      #f))

(define key
  (if (tls-enabled?)
      (with-input-from-file "key.pem"
        (lambda ()
          (read-string)))
      #f))

;;;
;;; Req-Rep
;;;
(define (make-listening-reply-socket address)
  (let ((socket (make-rep-socket)))
    (socket-set! socket 'nng/recvtimeo 2000)
    (nng-listen socket address)
    socket))

(define (make-dialed-request-socket address)
  (let ((socket (make-req-socket)))
    (socket-set! socket 'nng/recvtimeo 2000)
    (nng-dial socket address)
    socket))

(define (req-rep-test address)
  (let ((rep (make-listening-reply-socket address))
        (req (make-dialed-request-socket address)))
    (nng-send req "message")
    (nng-recv rep)
    (nng-send rep "message")
    (begin0
     (nng-recv req)
     (nng-close! rep))))


(test-group "nng"

            (test "tcp req-rep"
                  "message"
                  (req-rep-test address-tcp-1))

            (test "inproc req-rep"
                  "message"
                  (req-rep-test address-inproc-1))

	    )

(test-exit)