[CalendarServer-changes] [770] CalDAVTester/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Dec 8 12:43:37 PST 2006


Revision: 770
          http://trac.macosforge.org/projects/calendarserver/changeset/770
Author:   cdaboo at apple.com
Date:     2006-12-08 12:43:37 -0800 (Fri, 08 Dec 2006)

Log Message:
-----------
Add start/end script runs to performer so that calendar data can be pre-populated for the tests and then cleaned up.

Modified Paths:
--------------
    CalDAVTester/trunk/performer.py
    CalDAVTester/trunk/scripts/performance/perfinfo.dtd
    CalDAVTester/trunk/scripts/performance/perfinfo.xml
    CalDAVTester/trunk/src/perfinfo.py

Modified: CalDAVTester/trunk/performer.py
===================================================================
--- CalDAVTester/trunk/performer.py	2006-12-08 20:06:38 UTC (rev 769)
+++ CalDAVTester/trunk/performer.py	2006-12-08 20:43:37 UTC (rev 770)
@@ -65,6 +65,46 @@
 
     pinfo = readXML()
 
+    def doScript(script):
+        # Create argument list that varies for each threaded client. Basically use a separate
+        # server account for each client.
+        def runner(*args):
+            """
+            Test runner method. 
+            @param *args:
+            """
+            
+            if pinfo.logging:
+                print "Start: %s" % (args[0]["moresubs"]["$userid1:"],)
+            try:
+                mgr = manager(level=manager.LOG_NONE)
+                result, timing = mgr.runWithOptions(*args[1:], **args[0])
+                if pinfo.logging:
+                    print "Done: %s" % (args[0]["moresubs"]["$userid1:"],)
+            except Exception, e:
+                print "Thread run exception: %s" % (str(e),)
+    
+        args = []
+        for i in range(1, pinfo.clients + 1):
+            moresubs = {}
+            for key, value in pinfo.subsdict.iteritems():
+                moresubs[key] = subs(value, i)
+            args.append(({"moresubs": moresubs}, subs(pinfo.serverinfo, i), "", [subs(script, i)]))
+        for arg in args:
+            runner(*arg)
+
+    def doStart():
+        if pinfo.startscript:
+            print "Runnning start script %s" % (pinfo.startscript,)
+            doScript(pinfo.startscript)
+
+    def doEnd():
+        if pinfo.endscript:
+            print "Runnning end script %s" % (pinfo.endscript,)
+            doScript(pinfo.endscript)
+
+    doStart()
+
     # Cummulative results
     allresults = []
     
@@ -149,6 +189,8 @@
         
         allresults.append(result)
     
+    doEnd()
+
     # Print out averaged results.
     print "\n\nSpread\tReqs/sec\tAverage\t\tStd. Dev.\tTotal"
     print "==============================================================="

Modified: CalDAVTester/trunk/scripts/performance/perfinfo.dtd
===================================================================
--- CalDAVTester/trunk/scripts/performance/perfinfo.dtd	2006-12-08 20:06:38 UTC (rev 769)
+++ CalDAVTester/trunk/scripts/performance/perfinfo.dtd	2006-12-08 20:43:37 UTC (rev 770)
@@ -16,7 +16,7 @@
  DRI: Cyrus Daboo, cdaboo at apple.com
  -->
 
-<!ELEMENT perfinfo (clients, threads, logging, tests, serverinfo, testinfo, substitutions)? >
+<!ELEMENT perfinfo (clients, threads, logging, tests, serverinfo, start, testinfo, end, substitutions)? >
 
 	<!ELEMENT clients		(#PCDATA)>
 
@@ -33,8 +33,12 @@
 
 	<!ELEMENT serverinfo	(#PCDATA)>
 
-	<!ELEMENT testinfo	(#PCDATA)>
+	<!ELEMENT start	        (#PCDATA)>
 
+	<!ELEMENT testinfo	    (#PCDATA)>
+
+	<!ELEMENT end    	    (#PCDATA)>
+
 	<!ELEMENT substitutions	(substitution*)>
 		<!ELEMENT substitution	(key, value)>
 			<!ELEMENT key			(#PCDATA)>

Modified: CalDAVTester/trunk/scripts/performance/perfinfo.xml
===================================================================
--- CalDAVTester/trunk/scripts/performance/perfinfo.xml	2006-12-08 20:06:38 UTC (rev 769)
+++ CalDAVTester/trunk/scripts/performance/perfinfo.xml	2006-12-08 20:43:37 UTC (rev 770)
@@ -58,18 +58,18 @@
 			<runs>2</runs>
 		</test>
 	</tests>
-	<serverinfo>scripts/server/serverinfo.xml</serverinfo>
+	<serverinfo>scripts/server/apacheserverinfo.xml</serverinfo>
 	<testinfo>performance/put-small.xml</testinfo>
 	<substitutions>
 		<!-- first user id -->
 		<substitution>
 			<key>$userid1:</key>
-			<value>user%02d</value>
+			<value>admin</value>
 		</substitution>
 		<!-- password for first user -->
 		<substitution>
 			<key>$pswd1:</key>
-			<value>user%02d</value>
+			<value>admin</value>
 		</substitution>
 		<!-- relative path to first user principal resource-->
 		<substitution>
@@ -79,12 +79,12 @@
 		<!-- relative path to first user calendar home-->
 		<substitution>
 			<key>$pathprefix:</key>
-			<value>/calendars/users/user%02d</value>
+			<value>/~cyrusdaboo/uploads/users/user%02d</value>
 		</substitution>
 		<!-- relative path to first user calendar home-->
 		<substitution>
 			<key>$calendarpath1:</key>
-			<value>/calendars/users/user%02d/calendar</value>
+			<value>/~cyrusdaboo/uploads/users/user%02d</value>
 		</substitution>
 	</substitutions>
 </perfinfo>

Modified: CalDAVTester/trunk/src/perfinfo.py
===================================================================
--- CalDAVTester/trunk/src/perfinfo.py	2006-12-08 20:06:38 UTC (rev 769)
+++ CalDAVTester/trunk/src/perfinfo.py	2006-12-08 20:43:37 UTC (rev 770)
@@ -26,7 +26,7 @@
     """
     Maintains information about the performance test scenario.
     """
-    __slots__  = ['clients', 'threads', 'logging', 'tests', 'serverinfo', 'testinfo', 'subsdict']
+    __slots__  = ['clients', 'threads', 'logging', 'tests', 'serverinfo', 'startscript', 'testinfo', 'endscript', 'subsdict']
 
     def __init__( self ):
         self.clients = 20
@@ -34,7 +34,9 @@
         self.logging = False
         self.tests = []
         self.serverinfo = ""
+        self.startscript = ""
         self.testinfo = ""
+        self.endscript = ""
         self.subsdict = {}
 
     def parseXML( self, node ):
@@ -49,8 +51,12 @@
                 self.parseTestsXML(child)
             elif child._get_localName() == src.xmlDefs.ELEMENT_SERVERINFO:
                 self.serverinfo = child.firstChild.data
+            elif child._get_localName() == src.xmlDefs.ELEMENT_START:
+                self.startscript = child.firstChild.data
             elif child._get_localName() == src.xmlDefs.ELEMENT_TESTINFO:
                 self.testinfo = child.firstChild.data
+            elif child._get_localName() == src.xmlDefs.ELEMENT_END:
+                self.endscript = child.firstChild.data
             elif child._get_localName() == src.xmlDefs.ELEMENT_SUBSTITUTIONS:
                 self.parseSubstitutionsXML(child)
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061208/83ce1f4b/attachment.html


More information about the calendarserver-changes mailing list