/usr/bin/flumotion-tester is in flumotion 0.10.0-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | #! /usr/bin/python
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or modified under the terms of
# the GNU Lesser General Public License version 2.1 as published by
# the Free Software Foundation.
# This file is distributed without any warranty; without even the implied
# warranty of merchantability or fitness for a particular purpose.
# See "LICENSE.LGPL" in the source distribution for more information.
#
# Headers in this file shall remain intact.
import os
import sys
import optparse
sys.path.insert(0, '@PYGTK_DIR@')
import pygtk
pygtk.require('2.0')
import gobject
if gobject.pygtk_version < (2,3,96):
print 'PyGTK 2.3.96 or higher is required'
raise SystemExit
gobject.threads_init()
# This can't be removed,
dir = os.path.dirname(os.path.abspath(__file__))
if os.path.exists(os.path.join(dir, '..', 'flumotion', '.svn')) or \
os.path.exists(os.path.join(dir, '..', '.git')):
root = os.path.split(dir)[0]
else:
root = os.path.join('/usr/lib', 'flumotion', 'python')
sys.path.insert(0, root)
from flumotion.common import log
from flumotion.tester import clientfactory
def main(args):
log.init()
loop = gobject.MainLoop()
parser = optparse.OptionParser()
parser.add_option('-c', '--clients', action="store",
type="int", dest="clients", help="Number of clients to start")
parser.add_option('-m', '--max-clients', action="store",
type="int", dest="maxclients", help="Maximum number of active clients")
parser.add_option('-s', '--readsize', action="store",
type="string", dest="readsize", help="Size of each read, or range")
parser.add_option('-r', '--readrate', action="store",
type="string", dest="readrate", help="Rate of reads in bytes/sec")
parser.add_option('-b', '--bytes', action="store",
type="string", dest="bytes", help="Number of bytes to read")
parser.add_option('-t', '--time', action="store",
type="string", dest="time", help="Time to live in seconds")
options, args = parser.parse_args(args)
try:
options.url = args[1]
except IndexError:
print "please give a URL to test"
sys.exit(1)
if not options.clients:
options.clients = 100
factory = clientfactory.ClientFactory(loop, options)
gobject.idle_add(factory.run)
log.log('info', "going into main loop")
loop.run()
# we're done, print some info
factory.stats()
if __name__ == '__main__':
sys.exit(main(sys.argv))
|