From c0e163d199f7bdc55b0286e3ed12e8137ae8cc7a Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Mon, 15 Apr 2013 23:44:07 +0200 Subject: host/mex: add quick hub test script --- host/mex/hub.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/host/mex/hub.py b/host/mex/hub.py index 274f5448..15fb084d 100644 --- a/host/mex/hub.py +++ b/host/mex/hub.py @@ -197,3 +197,20 @@ class Hub: """Return socket filedescriptor.""" return self.socket.fileno () +if __name__ == '__main__': + import optparse + p = optparse.OptionParser () + p.add_option ('-c', '--min-clients', type = 'int', metavar = "NB", + default = 1, help = "Minimal number of clients before start") + p.add_option ('-l', '--log', action = 'store_true', + help = "Log to standard output") + options, args = p.parse_args () + if args: + p.error ("too many arguments") + if options.log: + def log (x): + print x + else: + log = None + h = Hub (min_clients = options.min_clients, log = log) + h.wait () -- cgit v1.2.3