summaryrefslogtreecommitdiff
path: root/demoscript/Ice/bidir.py
blob: 7a8ab56a1de2a49d4b198a725e6f7b7022205961 (plain)
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
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# **********************************************************************

import sys, signal
from demoscript import *

def run(clientStr, server):
    print "adding client 1... ",
    sys.stdout.flush()
    client1 = Util.spawn(clientStr)
    server.expect('adding client')
    client1.expect('received callback #1')
    print "ok"

    print "adding client 2... ",
    sys.stdout.flush()
    client2 = Util.spawn(clientStr)
    server.expect('adding client')
    client1.expect('received callback #')
    client2.expect('received callback #')
    print "ok"

    print "removing client 2...",
    sys.stdout.flush()
    client2.kill(signal.SIGINT)
    client2.waitTestSuccess(timeout=20)
    server.expect('removing client')
    client1.expect('received callback #')
    print "ok"

    print "removing client 1...",
    sys.stdout.flush()
    client1.kill(signal.SIGINT)
    client1.waitTestSuccess()
    server.expect('removing client')

    server.kill(signal.SIGINT)
    server.waitTestSuccess(timeout=30)

    print "ok"