Boost logo

Boost Testing :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2006-02-27 09:39:22


Aleksey Gurtovoy wrote:
>
> Now, if you could express the above in Python, we'd happily integrate
> it in "regression.py"!
>

OK. Here it is.

Regards,

Tobias


# (C) Copyright 2006 T.Schwinger ( http://www.boost.org/LICENSE_1_0.txt )

import os
import glob

boost_root = 'c:\Boost'

bin_dir = os.path.join( boost_root, 'bin', 'boost' )
jamfiles_glob = os.path.join( boost_root, 'libs', '*', 'test', 'Jamfile' )
timestamp_suffix = '_timestamp'

print '- removing outdated tests:'
jamfiles = glob.glob( jamfiles_glob )
for jamfile in jamfiles:

  lib = os.path.basename( os.path.dirname( os.path.dirname( jamfile ) ) )
  print '- checking library ' + lib

  jamfile_mtime = os.stat( jamfile ).st_mtime
  jamfile_mfile = jamfile + timestamp_suffix

  if os.path.isfile( jamfile_mfile ):

    if os.stat( jamfile_mfile ).st_mtime < jamfile_mtime:

      print '- Jamfile has changed, removing test target files'

      test_trg_dir = os.path.join( bin_dir, 'libs', lib, 'test' )

      for root, dirs, files in os.walk( test_trg_dir, topdown = False ):
        for name in files:
          os.remove( os.path.join( root, name ) )
        for name in dirs:
          os.rmdir( os.path.join( root, name ) )

      os.utime( jamfile_mfile, (jamfile_mtime,jamfile_mtime) )
  else:
    open( jamfile_mfile ).close()
    os.utime( jamfile_mfile, (jamfile_mtime,jamfile_mtime) )


Boost-testing list run by mbergal at meta-comm.com