File: __driver__.lua

package info (click to toggle)
monotone 1.0-6
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 20,708 kB
  • sloc: cpp: 84,765; sh: 6,787; perl: 837; makefile: 833; python: 517; lisp: 379; sql: 118; exp: 88; ansic: 52
file content (27 lines) | stat: -rw-r--r-- 726 bytes parent folder | download
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
skip_if(not existsonpath("netstat"))

includecommon("netsync.lua")
mtn_setup()
netsync.setup()

math.randomseed(get_pid())
local port = math.random(1024, 65535)

-- test with host:port
srv = netsync.start({"--bind", "localhost:" .. port})
check({"netstat", "-a", "-n"}, 0, true, false)
check(qgrep("127[.]0[.]0[.]1[.:]" .. port, "stdout"))
srv:stop()

-- test with ip:port
srv = netsync.start({"--bind", "127.0.0.1:" .. port})
check({"netstat", "-a", "-n"}, 0, true, false)
check(qgrep("127[.]0[.]0[.]1[.:]" .. port, "stdout"))
srv:stop()

-- test only with :port
srv = netsync.start({"--bind", ":" .. port})
check({"netstat", "-a", "-n"}, 0, true, false)
check(qgrep("([*]|0[.]0[.]0[.]0)[.:]" .. port, "stdout"))
srv:stop()