[Erp5-report] r11547 - /erp5/trunk/utils/erp5mechanize/multiSmartRun.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Nov 30 16:09:01 CET 2006


Author: vincent
Date: Thu Nov 30 16:09:00 2006
New Revision: 11547

URL: http://svn.erp5.org?rev=11547&view=rev
Log:
Save the generated files at the end of each session in a tarball in current directory, for future reference.
This is done because from the point of view of runBenchmark, a (zope count, user count) pair is not enough to identify a result among all results generated during multiSmartRun execution, and this was true in smartRun.

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

Modified: erp5/trunk/utils/erp5mechanize/multiSmartRun.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5mechanize/multiSmartRun.py?rev=11547&r1=11546&r2=11547&view=diff
==============================================================================
--- erp5/trunk/utils/erp5mechanize/multiSmartRun.py (original)
+++ erp5/trunk/utils/erp5mechanize/multiSmartRun.py Thu Nov 30 16:09:00 2006
@@ -31,6 +31,8 @@
 import sys
 import getopt
 import signal
+import tarfile
+from time import time
 
 def log(level, message):
   if verbose > level:
@@ -176,6 +178,7 @@
   sys.exit(2)
 
 testsuite_resultpath_list = []
+testsuite_dresultpath_list = []
 
 sys.path.insert(0, os.environ['PWD'])
 for testsuite in testsuite_list:
@@ -185,6 +188,11 @@
   if 'runBenchmarks_parameter_list' not in dir(module) or not module.runBenchmarks_parameter_list.has_key('results'):
     raise KeyError, 'Test suite must contain its parameter set (runBenchmarks_parameter_list) to be automated and must define the value for key "results".'
   testsuite_resultpath_list.append(module.runBenchmarks_parameter_list['results'])
+  testsuite_dresultpath_list.append(module.runBenchmarks_parameter_list['dresults'])
+
+# Just an identifier to know which result files belong to a given test
+# session.
+test_session_id = int(time())
 
 testsuite_count = len(testsuite_list)
 userperzope_arguments = ' '.join(arg_list)
@@ -229,6 +237,26 @@
     if execute('%s %s %s' % (userperzope, userperzope_args, ' '.join(resultpath_list))) != 0:
       print 'LIMIT REACHED: Test with %s users and %s zopes is out of limits.' % (current_usercount, current_zopecount)
       break
+    # Save the resulting files because this testing system does not guarantee
+    # that (usercount, zopecount) - from runBenchmark point of view - is
+    # unique to a result.
+    # We also want to backup "dresult" files.
+    for process_number in xrange(process_count):
+      dresultpath = testsuite_dresultpath_list[process_number]
+      if callable(dresultpath):
+        dresultpath = dresultpath(kw={'usercount': process_usercount_list[process_number],
+                                      'zopecount': process_zopecount_list[process_number]})
+      resultpath_list.append(dresultpath)
+    # Create a tarball with the total number of zope and users (from
+    # multiSmartRun point of view) and a session identifier (to avoid
+    # overwriting previous sessions' results).
+    result_tarball = tarfile.open('%s-%sz-%su.tgz' % (test_session_id,
+                                                      current_zopecount,
+                                                      current_usercount),
+                                  'w:gz')
+    for resultpath in resultpath_list:
+      result_tarball.add(resultpath)
+    result_tarball.close()
   else:
     current_usercount += 1
 




More information about the Erp5-report mailing list