[Zope-CVS] CVS: Packages/TestScripts - backgroundtester.py:1.3
Jens Vagelpohl
jens@zope.com
Fri, 25 Jan 2002 09:56:12 -0500
Update of /cvs-repository/Packages/TestScripts
In directory cvs.zope.org:/tmp/cvs-serv1226
Modified Files:
backgroundtester.py
Log Message:
i created a monster
=== Packages/TestScripts/backgroundtester.py 1.2 => 1.3 ===
RECIPIENTS = 'jens@zope.com'
SMTPHOST = 'smtp.zope.com'
-PYTHON = '/usr/local/bin/python2.1'
LOGFILENAME = 'testresults'
LOG_BUFFER = []
-ZOPES = { 'HEAD' : 'Trunk'
- , 'Zope-2_5-branch' : '2.5 Branch'
- }
-
-PACKAGES = { 'CMF' : ( 'CMF', 'CMF' )
- , 'ZEO' : ( 'ZEO', 'ZEO' )
+PYTHONS = { 'Python 2.1' : '/usr/local/bin/python2.1'
+ , 'Python 2.2' : '/usr/local/bin/python2.2'
+ }
+
+# All the stuff we want to get out of CVS and test against/with
+FROM_CVS = { 'Zope' : { 'label' : 'Zope'
+ , 'cvs_loc' : 'Zope'
+ , 'tags' : ( 'HEAD', 'Zope-2_5-branch', 'Zope-2_4-branch' )
+ , 'wiring_method' : ''
+ }
+ , 'CMF' : { 'label' : 'CMF'
+ , 'cvs_loc' : 'CMF'
+ , 'tags' : ( 'HEAD', 'CMF-1_2-branch' )
+ , 'wiring_method' : '_wire_cmf'
+ }
+ , 'ZEO' : { 'label' : 'ZEO'
+ , 'cvs_loc' : 'ZEO'
+ , 'tags' : ( 'HEAD', )
+ , 'wiring_method' : '_wire_zeo'
+ }
}
+TESTS = ( { 'zope' : 'HEAD'
+ , 'pythons' : ( 'Python 2.1', 'Python 2.2' )
+ , 'prods' : { 'CMF' : 'HEAD'
+ , 'ZEO' : 'HEAD'
+ }
+ }
+ , { 'zope' : 'Zope-2_5-branch'
+ , 'pythons' : ( 'Python 2.1', 'Python 2.2' )
+ , 'prods' : { 'CMF' : 'HEAD'
+ , 'ZEO' : 'HEAD'
+ }
+ }
+ , { 'zope' : 'Zope-2_4-branch'
+ , 'pythons' : ( 'Python 2.1', 'Python 2.2' )
+ , 'prods' : { 'CMF' : 'CMF-1_2-branch'
+ , 'ZEO' : 'HEAD'
+ }
+ }
+ )
+
+
TEST_DIVIDER = """\n\n***************************************************
-***************************************************
**
-** Testing Zope %s (%s)
+** Zope %s (%s)
+** ... on %s
+** ... with %s
**
-***************************************************
***************************************************\n
"""
@@ -46,23 +80,29 @@
if os.path.isfile( LOGFILENAME ):
os.remove( LOGFILENAME )
- for cvs_package, subdir in PACKAGES.values():
- subdir_path = os.path.join( home_dir, subdir )
+ # Delete the stuff gotten from CVS
+ for py_label in PYTHONS.keys():
+ py_dir = py_label.replace( ' ', '' )
+
+ if os.path.isdir( py_dir ):
+ os.system( 'rm -rf %s 2>&1' % py_dir )
- if os.path.isdir( subdir_path ):
- os.system( 'rm -rf %s 2>&1' % subdir_path )
+ if os.path.isfile( py_dir ):
+ os.remove( py_dir )
- if os.path.isfile( subdir_path ):
- os.remove( subdir_path )
+ # Delete the stuff gotten from CVS
+ for package_data in FROM_CVS.values():
+ label = package_data.get( 'label' )
+ tags = package_data.get( 'tags' )
- for zope_dir in ZOPES.keys():
- zopedir_path = os.path.join( home_dir, zope_dir )
+ for tag in tags:
+ subdir_path = '%s_%s' % ( label, tag )
- if os.path.isdir( zopedir_path ):
- os.system( 'rm -rf %s 2>&1' % zopedir_path )
+ if os.path.isdir( subdir_path ):
+ os.system( 'rm -rf %s 2>&1' % subdir_path )
- if os.path.isfile( zopedir_path ):
- os.remove( zopedir_path )
+ if os.path.isfile( subdir_path ):
+ os.remove( subdir_path )
def _checkout( home_dir ):
@@ -83,72 +123,124 @@
cvspass_file.write( cvspass_line + '\n' )
cvspass_file.close()
+ # Create subdirectories for every python version to test against
+ for p_label in PYTHONS.keys():
+ py_dir = p_label.replace( ' ', '' )
+ os.mkdir( os.path.join( home_dir, py_dir ) )
+
+
+ # Get everything from CVS
+ for package_data in FROM_CVS.values():
+ label = package_data.get( 'label' )
+ cvs_loc = package_data.get( 'cvs_loc' )
+ tags = package_data.get( 'tags' )
+
+ for tag in tags:
+ t_str = _get_time( format='time' )
+ LOG_BUFFER.append( ' - Checking out %s %s (%s)' % ( label
+ , tag
+ , t_str
+ ) )
+ subdir_name = '%s_%s' % ( label, tag )
+ subdir_path = os.path.join( home_dir, subdir_name )
+ cmd = 'cvs -Q co -d %s -r%s %s >/dev/null'
+ os.system( cmd % ( subdir_name, tag, cvs_loc ) )
+
+ # Copy stuff into subdirectories for every python version
+ for p_label in PYTHONS.keys():
+ py_dir = p_label.replace( ' ', '' )
+ cmd = 'cp -R %s %s'
+ os.system( cmd % ( subdir_name, py_dir ) )
- for tag, label in ZOPES.items():
- t_str = _get_time( format='time' )
- LOG_BUFFER.append( ' - Checking out Zope %s (%s)' % ( label, t_str ) )
- subdir_path = os.path.join( home_dir, tag )
-
- os.system( 'cvs -Q co -d %s -r%s Zope >/dev/null' % ( tag, tag ) )
-
- for cvs_package, subdir in PACKAGES.values():
- t_str = _get_time( format='time' )
- LOG_BUFFER.append( ' - Checking out %s (%s)' % ( cvs_package, t_str ) )
- subdir_path = os.path.join( home_dir, subdir )
-
- os.system( 'cvs -Q co -d %s %s >/dev/null' % ( subdir, cvs_package ) )
-
-def _wire( home_dir ):
- """ Wire things up correctly """
- zeo_loc = os.path.join( home_dir, PACKAGES.get( 'ZEO' )[1], 'ZEO' )
- cmf_loc = os.path.join( home_dir, PACKAGES.get( 'CMF' )[1] )
- cmf_packages = ( 'CMFCalendar', 'CMFCore', 'CMFCollector'
- , 'CMFDefault', 'CMFTopic', 'CMFTracker'
- , 'CMFWiki', 'DCWorkflow'
- )
-
- t_str = _get_time( format='time' )
- LOG_BUFFER.append( ' - Linking ZEO (%s)' % t_str )
- for subdir in ZOPES.keys():
- os.chdir( os.path.join( home_dir, subdir, 'lib', 'python' ) )
- os.system( 'ln -s %s 2>&1' % zeo_loc )
-
- t_str = _get_time( format='time' )
- LOG_BUFFER.append( ' - Linking CMF Packages (%s)' % t_str )
- for subdir in ZOPES.keys():
- p_path = os.path.join( home_dir, subdir, 'lib', 'python', 'Products' )
- os.chdir( p_path )
-
- for cmf_package in cmf_packages:
- os.system( 'ln -s %s 2>&1' % os.path.join( cmf_loc, cmf_package ) )
def _build( home_dir ):
""" Compile all those items that need compiling """
- for subdir, label in ZOPES.items():
- zope_loc = os.path.join( home_dir, subdir )
- t_str = _get_time( format='time' )
- LOG_BUFFER.append( ' - Building Zope %s (%s)' % ( label, t_str ) )
- os.chdir( zope_loc )
- os.system( '%s wo_pcgi.py >/dev/null' % PYTHON )
+ zope_info = FROM_CVS.get( 'Zope' )
+ zope_tags = zope_info.get( 'tags' )
+ for py_label, py_exe in PYTHONS.items():
+ py_dir = py_label.replace( ' ', '' )
+ py_path = os.path.join( home_dir, py_dir )
+ os.chdir( py_path )
+ zope_dirs = []
+
+ for tag in zope_tags:
+ zope_dir = 'Zope_%s' % tag
+ os.chdir( os.path.join( py_path, zope_dir ) )
+ t_str = _get_time( format='time' )
+ LOG_BUFFER.append( ' - Building Zope %s with %s (%s)' % (
+ tag, py_label, t_str ) )
+ os.system( '%s wo_pcgi.py >/dev/null' % py_exe )
+
def _test( home_dir ):
""" Run the actual tests """
log_file = open( os.path.join( home_dir, LOGFILENAME ), 'w' )
log_file.write( '\n'.join( LOG_BUFFER ) )
log_file.close()
- for subdir, label in ZOPES.items():
- zope_loc = os.path.join( home_dir, subdir )
+ for test in TESTS:
+ zope_tag = test.get( 'zope' )
+ zope_subdir = 'Zope_%s' % zope_tag
+ pythons = test.get( 'pythons' )
+ prods = test.get( 'prods' )
+
+ for py_label in pythons:
+ prods_data = []
+ py_exe = PYTHONS.get( py_label )
+ py_dir = os.path.join( home_dir, py_label.replace( ' ', '' ) )
+ zope_dir = os.path.join( py_dir, zope_subdir )
+
+ for prod_label, prod_tag in prods.items():
+ prods_data.append( '%s (%s)' % ( prod_label, prod_tag ) )
+ prod_info = FROM_CVS.get( prod_label )
+ wiring_method = globals().get( prod_info.get( 'wiring_method' ) )
+ apply( wiring_method, ( home_dir, py_dir, zope_dir, prod_label, prod_tag ) )
+
+ t_str = _get_time( format='time' )
+ prod_str = ', '.join( prods_data )
+ log_file = open( os.path.join( home_dir, LOGFILENAME ), 'a' )
+ log_file.write( TEST_DIVIDER % ( zope_tag, t_str, py_label, prod_str ) )
+ log_file.close()
+
+ os.chdir( zope_dir )
+ os.system( '%s utilities/testrunner.py -v0 -a >>%s/%s 2>&1' % (
+ py_exe, home_dir, LOGFILENAME ) )
+
+
+def _wire_zeo( home_dir, py_dir, zope_dir, prod_label, prod_tag ):
+ """ Wire up ZEO """
+ zeo_subdir = '%s_%s' % ( prod_label, prod_tag )
+ zeo_linkdir = os.path.join( py_dir, zeo_subdir, 'ZEO' )
+ os.chdir( os.path.join( zope_dir, 'lib', 'python' ) )
- log_file = open( os.path.join( home_dir, LOGFILENAME ), 'a' )
- t_str = _get_time( format='time' )
- log_file.write( TEST_DIVIDER % ( label, t_str ) )
- log_file.close()
+ t_str = _get_time( format='time' )
+ log_file = open( os.path.join( home_dir, LOGFILENAME ), 'a' )
+ log_file.write( '\n - Linking ZEO (%s)' % t_str )
+ log_file.close()
- os.chdir( zope_loc )
- os.system( '%s utilities/testrunner.py -v0 -a >>%s/%s 2>&1' % (
- PYTHON, home_dir, LOGFILENAME ) )
+ os.system( 'ln -s %s >/dev/null 2>&1' % zeo_linkdir )
+
+
+def _wire_cmf( home_dir, py_dir, zope_dir, prod_label, prod_tag ):
+ """ Wire up the CMF """
+ cmf_subdir = '%s_%s' % ( prod_label, prod_tag )
+ cmf_dir = os.path.join( py_dir, cmf_subdir )
+ cmf_packages = ( 'CMFCalendar', 'CMFCore', 'CMFCollector'
+ , 'CMFDefault', 'CMFTopic', 'CMFTracker'
+ , 'CMFWiki', 'DCWorkflow'
+ )
+ os.chdir( os.path.join( zope_dir, 'lib', 'python', 'Products' ) )
+
+ t_str = _get_time( format='time' )
+ log_file = open( os.path.join( home_dir, LOGFILENAME ), 'a' )
+ log_file.write( '\n - Linking CMF (%s)' % t_str )
+ log_file.close()
+
+ for cmf_package in cmf_packages:
+ cmf_package_path = os.path.join( cmf_dir, cmf_package )
+ if os.path.isdir( cmf_package_path ):
+ os.system( 'ln -s %s >/dev/null 2>&1' % cmf_package_path )
def _mail( home_dir ):
@@ -174,9 +266,8 @@
def main():
""" Run the script """
- pkgs = ', '.join( PACKAGES.keys() )
- msg = '*** Zope unit tests with packages %s (%s) ***\n\n'
- LOG_BUFFER.append( msg % ( pkgs, _get_time() ) )
+ msg = '*** Zope unit tests on Mac OS X (%s) ***\n\n'
+ LOG_BUFFER.append( msg % _get_time() )
module_path = sys.argv[0]
module_dir, module_filename = os.path.split( module_path )
os.chdir( module_dir )
@@ -185,7 +276,6 @@
_cleanup( HOME )
_checkout( HOME )
- _wire( HOME )
_build( HOME )
_test( HOME )
_mail( HOME )