summaryrefslogtreecommitdiffhomepage
path: root/digital/avr/modules/host/test/test_mex.py
blob: fcf658ae3fd01fb2ada16006ac7594fea2dc85a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os, signal

from mex.hub import Hub
from mex.msg import Msg

def log (x):
    print x

h = Hub (min_clients = 2, log = log)

pid1 = os.spawnl (os.P_NOWAIT, './test_mex.host', './test_mex.host', '1')
pid2 = os.spawnl (os.P_NOWAIT, './test_mex.host', './test_mex.host', '2')

try:
    h.wait ()
finally:
    os.kill (pid1, signal.SIGTERM)
    os.waitpid (pid1, 0)
    os.kill (pid2, signal.SIGTERM)
    os.waitpid (pid2, 0)
    import time
    time.sleep (1)