[Erp5-report] r8857 - /erp5/trunk/utils/erp5mechanize/userperzope.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jul 28 15:07:02 CEST 2006


Author: vincent
Date: Fri Jul 28 15:07:01 2006
New Revision: 8857

URL: http://svn.erp5.org?rev=8857&view=rev
Log:
Add a way to ignore the first run for a all users, to diminish the impact of cache filling which happens when tests are run individually.

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

Modified: erp5/trunk/utils/erp5mechanize/userperzope.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5mechanize/userperzope.py?rev=8857&r1=8856&r2=8857&view=diff
==============================================================================
--- erp5/trunk/utils/erp5mechanize/userperzope.py (original)
+++ erp5/trunk/utils/erp5mechanize/userperzope.py Fri Jul 28 15:07:01 2006
@@ -46,7 +46,7 @@
   sys.stdout.write('\n')
 
 try:
-  opt_list, arg_list = getopt.getopt(sys.argv[1:], '', ['maximum_duration=', 'csv_separator=', 'default_step_number='])
+  opt_list, arg_list = getopt.getopt(sys.argv[1:], '', ['maximum_duration=', 'csv_separator=', 'default_step_number=', 'ignore_first_run'])
 except getopt.error, msg:
   print 'Error: %s' % (msg, )
   print \
@@ -75,6 +75,8 @@
 
 csv_separator = ','
 maximum_duration = None
+ignore_first_run = False
+default_step_number = None
 for o, a in opt_list:
   if o == '--maximum_duration':
     maximum_duration = float(a)
@@ -82,6 +84,8 @@
     csv_separator = a
   elif o == '--default_step_number':
     default_step_number = int(a)
+  elif o == '--ignore_first_run':
+    ignore_first_run = True
 
 result_list = {}
 for filename in arg_list:
@@ -96,6 +100,8 @@
     user = field_list[0]
     if user not in known_user_list:
       known_user_list.append(user)
+      if ignore_first_run: # This allows to avoid the impact of the first run for a given user (cache filling, ...)
+        continue
     zope = field_list[0].split('@', 1)[1]
     if zope not in known_zope_list:
       known_zope_list.append(zope)
@@ -103,7 +109,11 @@
       failed = True
       break
     if len(field_list) < 4:
-      duration_list.append(float(field_list[2])/default_step_number)
+      if default_step_number is not None:
+        duration_list.append(float(field_list[2])/default_step_number)
+      else:
+        sys.stderr.write('Error in file %s : at least one line has less than 4 fields and --default_step_number has not been given.')
+        raise KeyError
     else:
       duration_list.append(float(field_list[2])/int(field_list[3]))
   if len(line_list):




More information about the Erp5-report mailing list