Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2011 Google Inc. All Rights Reserved. | 1 # Copyright 2011 Google Inc. All Rights Reserved. |
| 2 | 2 |
| 3 import os | 3 import os |
| 4 import platform | 4 import platform |
| 5 import shutil | 5 import shutil |
| 6 import stat | 6 import stat |
| 7 import sys | 7 import sys |
| 8 | 8 |
| 9 HOME = os.path.dirname(os.path.realpath(__file__)) | 9 HOME = os.path.dirname(os.path.realpath(__file__)) |
| 10 HOME = os.path.join(HOME, os.pardir, os.pardir) | 10 HOME = os.path.join(HOME, os.pardir, os.pardir) |
| 11 | 11 |
| 12 END_SCRIPT = ''' | 12 END_SCRIPT = ''' |
| 13 VM = '%s' | 13 VM = '%s' |
| 14 VM_FLAGS = '%s' | |
| 14 if __name__ == '__main__': | 15 if __name__ == '__main__': |
| 15 sys.exit(main(sys.argv)) | 16 sys.exit(main(sys.argv)) |
| 16 ''' | 17 ''' |
| 17 | 18 |
| 18 def main(args): | 19 def main(args): |
| 19 product_dir = args[1] | 20 product_dir = args[1] |
| 20 vm = os.path.join(product_dir, 'dart') | 21 vm = os.path.join(product_dir, 'dart') |
| 21 id = platform.system() | 22 id = platform.system() |
| 22 if id == 'Windows' or id == 'Microsoft': | 23 if id == 'Windows' or id == 'Microsoft': |
| 23 vm = vm + '.exe' | 24 vm = vm + '.exe' |
| 24 frog = os.path.join(product_dir, 'frog', 'bin', 'frog') | 25 frog = os.path.join(product_dir, 'frog', 'bin', 'frog') |
| 25 | 26 |
| 26 # TODO(ngeoffray): Create a script that will run the VM in production mode. | |
| 27 # if js_out.find('Release') != -1: | |
| 28 shutil.copy(os.path.join(HOME, 'scripts', 'bootstrap', 'frog_wrapper.py'), | 27 shutil.copy(os.path.join(HOME, 'scripts', 'bootstrap', 'frog_wrapper.py'), |
| 29 frog) | 28 frog) |
| 30 | 29 |
| 30 if 'Release' in product_dir: | |
| 31 # We want to run our tests on the VM in production mode and in | |
| 32 # developer mode. It turns out that developer mode is really slow | |
| 33 # on the debug VM, so it makes sense to make the pairings: | |
| 34 # (release VM, developer mode) and (debug VM, production mode). | |
| 35 vm_flags = '--vm_flags=--enable_asserts --enable_type_checks' | |
|
srdjan
2012/02/07 16:31:00
Per specification, enabling type checks enables as
| |
| 36 else: | |
| 37 vm_flags = '' | |
| 38 | |
| 31 with open(frog, 'a+') as f: | 39 with open(frog, 'a+') as f: |
| 32 f.write(END_SCRIPT % vm) | 40 f.write(END_SCRIPT % (vm, vm_flags)) |
| 33 | 41 |
| 34 os.chmod(frog, stat.S_IXUSR | stat.S_IXGRP | stat.S_IRUSR | | 42 os.chmod(frog, stat.S_IXUSR | stat.S_IXGRP | stat.S_IRUSR | |
| 35 stat.S_IRGRP | stat.S_IWUSR) | 43 stat.S_IRGRP | stat.S_IWUSR) |
| 36 return 0 | 44 return 0 |
| 37 | 45 |
| 38 | 46 |
| 39 if __name__ == '__main__': | 47 if __name__ == '__main__': |
| 40 sys.exit(main(sys.argv)) | 48 sys.exit(main(sys.argv)) |
| OLD | NEW |