[CalendarServer-changes] [6412] CalDAVTester/trunk/src/manager.py
source_changes at macosforge.org
source_changes at macosforge.org
Mon Oct 11 10:34:54 PDT 2010
Revision: 6412
http://trac.macosforge.org/projects/calendarserver/changeset/6412
Author: cdaboo at apple.com
Date: 2010-10-11 10:34:52 -0700 (Mon, 11 Oct 2010)
Log Message:
-----------
Support a deterministic random seed option.
Modified Paths:
--------------
CalDAVTester/trunk/src/manager.py
Modified: CalDAVTester/trunk/src/manager.py
===================================================================
--- CalDAVTester/trunk/src/manager.py 2010-10-08 23:06:57 UTC (rev 6411)
+++ CalDAVTester/trunk/src/manager.py 2010-10-11 17:34:52 UTC (rev 6412)
@@ -147,7 +147,8 @@
subdir = None
pidfile = "../CalendarServer/logs/caldavd.pid"
random_order = False
- options, args = getopt.getopt(sys.argv[1:], "s:p:dmx:", ["all", "subdir=", "exclude=", "pid=", "random"])
+ random_seed = str(random.randint(0, 1000000))
+ options, args = getopt.getopt(sys.argv[1:], "s:p:dmx:", ["all", "subdir=", "exclude=", "pid=", "random", "random-seed="])
# Process single options
for option, value in options:
@@ -171,6 +172,8 @@
pidfile = value
elif option == "--random":
random_order = True
+ elif option == "--random-seed":
+ random_seed = value
if all:
files = []
@@ -191,12 +194,9 @@
# Randomize file list
if random_order:
- new_fnames = []
- while fnames:
- element = random.choice(fnames)
- new_fnames.append(element)
- fnames.remove(element)
- fnames = new_fnames
+ print "Randomizing order using seed '%s'" % (random_seed,)
+ random.seed(random_seed)
+ random.shuffle(fnames)
self.readXML(sname, pname, fnames, all)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20101011/cddb29f1/attachment.html>
More information about the calendarserver-changes
mailing list