run.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/usr/bin/python
  2. # Copyright Redshift Software, Inc. 2007
  3. #
  4. # Distributed under the Boost Software License, Version 1.0.
  5. # (See accompanying file LICENSE_1_0.txt or copy at
  6. # http://www.boost.org/LICENSE_1_0.txt)
  7. import os
  8. import os.path
  9. import shutil
  10. import sys
  11. import urllib
  12. #~ Using --skip-script-download is useful to avoid repeated downloading of
  13. #~ the regression scripts when doing the regression commands individually.
  14. no_update_argument = "--skip-script-download"
  15. no_update = no_update_argument in sys.argv
  16. if no_update:
  17. del sys.argv[sys.argv.index(no_update_argument)]
  18. #~ The directory this file is in.
  19. root = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
  20. print '# Running regressions in %s...' % root
  21. script_sources = [ 'collect_and_upload_logs.py', 'process_jam_log.py', 'regression.py' ]
  22. script_local = os.path.join(root,'tools','regression','src')
  23. script_remote = 'http://svn.boost.org/svn/boost/trunk/tools/regression/src'
  24. script_dir = os.path.join(root,'tools_regression_src')
  25. if not no_update:
  26. #~ Bootstrap.
  27. #~ * Clear out any old versions of the scripts
  28. print '# Creating regression scripts at %s...' % script_dir
  29. if os.path.exists(script_dir):
  30. shutil.rmtree(script_dir)
  31. os.mkdir(script_dir)
  32. #~ * Get new scripts, either from local working copy, or from svn
  33. if os.path.exists(script_local):
  34. print '# Copying regression scripts from %s...' % script_local
  35. for src in script_sources:
  36. shutil.copyfile( os.path.join(script_local,src), os.path.join(script_dir,src) )
  37. else:
  38. print '# Dowloading regression scripts from %s...' % script_remote
  39. proxy = None
  40. for a in sys.argv[1:]:
  41. if a.startswith('--proxy='):
  42. proxy = {'http' : a.split('=')[1] }
  43. print '--- %s' %(proxy['http'])
  44. break
  45. for src in script_sources:
  46. urllib.FancyURLopener(proxy).retrieve(
  47. '%s/%s' % (script_remote,src), os.path.join(script_dir,src) )
  48. #~ * Make the scripts available to Python
  49. sys.path.insert(0,os.path.join(root,'tools_regression_src'))
  50. #~ Launch runner.
  51. from regression import runner
  52. runner(root)
粤ICP备19079148号