| OLD | NEW | 
| (Empty) |  | 
 |   1 #!/usr/bin/python | 
 |   2  | 
 |   3 # Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file | 
 |   4 # for details. All rights reserved. Use of this source code is governed by a | 
 |   5 # BSD-style license that can be found in the LICENSE file. | 
 |   6  | 
 |   7 """ | 
 |   8 Buildbot steps for testing dart2js with --dump-info turned on | 
 |   9 """ | 
 |  10 import os | 
 |  11 import shutil | 
 |  12 import sys | 
 |  13 import bot | 
 |  14 import bot_utils | 
 |  15  | 
 |  16 utils = bot_utils.GetUtils() | 
 |  17 HOST_OS = utils.GuessOS() | 
 |  18  | 
 |  19 def DumpConfig(name, is_buildbot): | 
 |  20   """Returns info for the current buildbot. | 
 |  21   We only run this bot on linux, so all of this is just hard coded. | 
 |  22   """ | 
 |  23   return bot.BuildInfo('none', 'none', 'release', 'linux') | 
 |  24  | 
 |  25 def Run(args): | 
 |  26   print "Running: %s" % ' '.join(args) | 
 |  27   sys.stdout.flush() | 
 |  28   bot.RunProcess(args) | 
 |  29  | 
 |  30 def DumpSteps(build_info): | 
 |  31   build_root = utils.GetBuildRoot(HOST_OS, mode='release', arch='ia32') | 
 |  32   compilations_dir = os.path.join(bot_utils.DART_DIR, | 
 |  33                                   build_root, | 
 |  34                                   'generated_compilations') | 
 |  35   tests = ['html', 'samples'] | 
 |  36  | 
 |  37   with bot.BuildStep('Cleaning out old compilations'): | 
 |  38     print "Cleaning out %s" % compilations_dir | 
 |  39     shutil.rmtree(compilations_dir, ignore_errors=True) | 
 |  40  | 
 |  41   with utils.TempDir() as temp_dir: | 
 |  42     normal_compilations = os.path.join(temp_dir, 'normal') | 
 |  43     dump_compilations = os.path.join(temp_dir, 'dump') | 
 |  44     normal_compilation_command = [sys.executable, './tools/test.py', | 
 |  45                                   '--mode=' + build_info.mode, | 
 |  46                                   '-cdart2js', '-rnone'] + tests | 
 |  47     with bot.BuildStep('Compiling without dump info'): | 
 |  48       Run(normal_compilation_command) | 
 |  49       pass | 
 |  50  | 
 |  51     with bot.BuildStep('Store normal compilation artifacts'): | 
 |  52       args = ['mv', compilations_dir, normal_compilations] | 
 |  53       Run(args) | 
 |  54  | 
 |  55     with bot.BuildStep('Compiling with dump info'): | 
 |  56       args = normal_compilation_command + ['--dart2js-options=--dump-info'] | 
 |  57       Run(args) | 
 |  58  | 
 |  59     with bot.BuildStep('Store normal compilation artifacts'): | 
 |  60       args = ['mv', compilations_dir, dump_compilations] | 
 |  61       Run(args) | 
 |  62  | 
 |  63     with bot.BuildStep('Compare outputs'): | 
 |  64       args = ['diff', '-rq', '-x', '*\.json', | 
 |  65               normal_compilations, dump_compilations] | 
 |  66       # Diff will return non zero and we will throw if there are any differences | 
 |  67       Run(args) | 
 |  68  | 
 |  69     with bot.BuildStep('Validate dump files'): | 
 |  70       # Do whatever you like :-), files are in dump_compilations | 
 |  71       pass | 
 |  72  | 
 |  73 if __name__ == '__main__': | 
 |  74   bot.RunBot(DumpConfig, DumpSteps) | 
 |  75  | 
| OLD | NEW |