[Erp5-report] r9648 - /erp5/trunk/utils/erp5mechanize/smartRun.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Sep 4 17:16:59 CEST 2006


Author: vincent
Date: Mon Sep  4 17:16:57 2006
New Revision: 9648

URL: http://svn.erp5.org?rev=9648&view=rev
Log:
Get result file name from test suite file.
Remove use of unlink, tempfile not needed anymore.
Fix bug preventing from runing on more than one zope count in one run.

Modified:
    erp5/trunk/utils/erp5mechanize/smartRun.py

Modified: erp5/trunk/utils/erp5mechanize/smartRun.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5mechanize/smartRun.py?rev=9648&r1=9647&r2=9648&view=diff
==============================================================================
--- erp5/trunk/utils/erp5mechanize/smartRun.py (original)
+++ erp5/trunk/utils/erp5mechanize/smartRun.py Mon Sep  4 17:16:57 2006
@@ -27,9 +27,9 @@
 #
 ##############################################################################
 import os
+import imp
 import sys
 import getopt
-import tempfile
 
 def execute(command):
   print command
@@ -39,6 +39,7 @@
   return result
 
 min_zope = 1
+max_zope = None
 runBenchmarks = './runBenchmarks.py'
 userperzope = './userperzope.py'
 min_user = None
@@ -98,7 +99,8 @@
   elif o == '--usercoef':
     usercoef = int(a)
 
-max_zope = min_zope
+if max_zope is None:
+  max_zope = min_zope
 if min_user is None:
   min_user = min_zope
 userperzope_args = ' '.join(arg_list)
@@ -107,15 +109,17 @@
   print 'Mandatory testsuite agument not given.'
   sys.exit(2)
 
+sys.path.insert(0, os.environ['PWD'])
+file, path, description = imp.find_module(testsuite, sys.path)
+module = imp.load_module(testsuite, file, path, description)
+file.close()
+resultpath = runBenchmarks_parameter_list['results']
+
 if usercoef is None:
   print 'Mandatory usercoef agument not given.'
   sys.exit(2)
 
 userperzope_arguments = ' '.join(arg_list)
-fd, resultpath = tempfile.mkstemp()
-os.close(fd)
-fd, dresultpath = tempfile.mkstemp()
-os.close(fd)
 
 current_usercount = min_user
 for current_zopecount in xrange(min_zope, max_zope + 1):
@@ -127,11 +131,8 @@
   if max_user is not None:
     max_usercount = min(max_user, max_usercount)
   for current_usercount in xrange(min_usercount, max_usercount + 1):
-    execute('%s --config %s --results %s --dresults %s --usercount %s --zopecount %s' % (runBenchmarks, testsuite, resultpath, dresultpath, current_usercount, current_zopecount))
-    if execute('%s %s %s' % (userperzope, userperzope_args, resultpath)) != 0:
+    execute('%s --config %s --usercount %s --zopecount %s' % (runBenchmarks, testsuite, current_usercount, current_zopecount))
+    if execute('%s %s %s' % (userperzope, userperzope_args, resultpath(kw={'usercount': current_usercount, 'zopecount': current_zopecount}))) != 0:
       print 'Test with %s users and %s zopes is out of limits.' % (current_usercount, current_zopecount)
       break
 
-os.unlink(resultpath)
-os.unlink(dresultpath)
-




More information about the Erp5-report mailing list