Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """ | 5 """ |
| 6 TestGyp.py: a testing framework for GYP integration tests. | 6 TestGyp.py: a testing framework for GYP integration tests. |
| 7 """ | 7 """ |
| 8 | 8 |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 412 | 412 |
| 413 class TestGypNinja(TestGypBase): | 413 class TestGypNinja(TestGypBase): |
| 414 """ | 414 """ |
| 415 Subclass for testing the GYP Ninja generator. | 415 Subclass for testing the GYP Ninja generator. |
| 416 """ | 416 """ |
| 417 format = 'ninja' | 417 format = 'ninja' |
| 418 build_tool_list = ['ninja'] | 418 build_tool_list = ['ninja'] |
| 419 ALL = 'all' | 419 ALL = 'all' |
| 420 DEFAULT = 'all' | 420 DEFAULT = 'all' |
| 421 | 421 |
| 422 def initialize_build_tool(self): | |
| 423 super(TestGypNinja, self).initialize_build_tool() | |
| 424 if sys.platform == 'win32': | |
| 425 # Compiler and linker aren't in the path by default on Windows, so we | |
| 426 # make our "build tool" be set up + run ninja. | |
|
Nico
2012/02/22 05:17:58
Could you share code with TestGypMSVS.initialize_b
scottmg
2012/02/22 05:59:09
Yeah... That code seems kinda busted but I was too
| |
| 427 vspath = 'Microsoft Visual Studio 9.0\\Common7\\Tools\\vsvars32.bat' | |
| 428 msvs_version = os.environ.get('GYP_MSVS_VERSION') | |
| 429 if msvs_version == '2010': | |
| 430 vspath = 'Microsoft Visual Studio 10.0\\Common7\\Tools\\vsvars32.bat' | |
| 431 path_root = os.environ.get('PROGRAMFILES') | |
| 432 full_path = os.path.join(path_root, vspath) | |
| 433 if os.path.exists(full_path): | |
| 434 self.build_tool = os.environ.get('COMSPEC', 'cmd.exe') | |
| 435 self.helper_args = ['/c', full_path, '&&', 'ninja'] | |
| 436 else: | |
| 437 # Couldn't find setup, try just running default build_tool anyway. | |
| 438 self.helper_args = [] | |
| 439 | |
| 422 def run_gyp(self, gyp_file, *args, **kw): | 440 def run_gyp(self, gyp_file, *args, **kw): |
| 423 TestGypBase.run_gyp(self, gyp_file, *args, **kw) | 441 TestGypBase.run_gyp(self, gyp_file, *args, **kw) |
| 424 | 442 |
| 425 def build(self, gyp_file, target=None, **kw): | 443 def build(self, gyp_file, target=None, **kw): |
| 426 arguments = kw.get('arguments', [])[:] | 444 arguments = kw.get('arguments', [])[:] |
| 427 | 445 |
| 428 # Add a -C output/path to the command line. | 446 # Add a -C output/path to the command line. |
| 429 arguments.append('-C') | 447 arguments.append('-C') |
| 430 arguments.append(os.path.join('out', self.configuration_dirname())) | 448 arguments.append(os.path.join('out', self.configuration_dirname())) |
| 431 | 449 |
| 432 if target is None: | 450 if target is None: |
| 433 target = 'all' | 451 target = 'all' |
| 434 arguments.append(target) | 452 arguments.append(target) |
| 435 | 453 |
| 454 if sys.platform == 'win32': | |
| 455 arguments = self.helper_args + arguments | |
| 456 | |
| 436 kw['arguments'] = arguments | 457 kw['arguments'] = arguments |
| 437 return self.run(program=self.build_tool, **kw) | 458 return self.run(program=self.build_tool, **kw) |
| 438 | 459 |
| 439 def run_built_executable(self, name, *args, **kw): | 460 def run_built_executable(self, name, *args, **kw): |
| 440 # Enclosing the name in a list avoids prepending the original dir. | 461 # Enclosing the name in a list avoids prepending the original dir. |
| 441 program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)] | 462 program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)] |
| 442 if sys.platform == 'darwin': | 463 if sys.platform == 'darwin': |
| 443 libdir = os.path.join('out', 'Default') | 464 libdir = os.path.join('out', 'Default') |
| 444 if self.configuration: | 465 if self.configuration: |
| 445 libdir = os.path.join('out', self.configuration) | 466 libdir = os.path.join('out', self.configuration) |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 799 """ | 820 """ |
| 800 format = kw.get('format') | 821 format = kw.get('format') |
| 801 if format: | 822 if format: |
| 802 del kw['format'] | 823 del kw['format'] |
| 803 else: | 824 else: |
| 804 format = os.environ.get('TESTGYP_FORMAT') | 825 format = os.environ.get('TESTGYP_FORMAT') |
| 805 for format_class in format_class_list: | 826 for format_class in format_class_list: |
| 806 if format == format_class.format: | 827 if format == format_class.format: |
| 807 return format_class(*args, **kw) | 828 return format_class(*args, **kw) |
| 808 raise Exception, "unknown format %r" % format | 829 raise Exception, "unknown format %r" % format |
| OLD | NEW |