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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 target = 'all' | 439 target = 'all' |
440 arguments.append(target) | 440 arguments.append(target) |
441 | 441 |
442 kw['arguments'] = arguments | 442 kw['arguments'] = arguments |
443 return self.run(program=self.build_tool, **kw) | 443 return self.run(program=self.build_tool, **kw) |
444 | 444 |
445 def run_built_executable(self, name, *args, **kw): | 445 def run_built_executable(self, name, *args, **kw): |
446 # Enclosing the name in a list avoids prepending the original dir. | 446 # Enclosing the name in a list avoids prepending the original dir. |
447 program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)] | 447 program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)] |
448 if sys.platform == 'darwin': | 448 if sys.platform == 'darwin': |
449 libdir = os.path.join('out', 'Default', 'lib') | 449 libdir = os.path.join('out', 'Default') |
450 if self.configuration: | 450 if self.configuration: |
451 libdir = os.path.join('out', self.configuration, 'lib') | 451 libdir = os.path.join('out', self.configuration) |
452 os.environ['DYLD_LIBRARY_PATH'] = libdir | 452 os.environ['DYLD_LIBRARY_PATH'] = libdir |
453 return self.run(program=program, *args, **kw) | 453 return self.run(program=program, *args, **kw) |
454 | 454 |
455 def built_file_path(self, name, type=None, **kw): | 455 def built_file_path(self, name, type=None, **kw): |
456 result = [] | 456 result = [] |
457 chdir = kw.get('chdir') | 457 chdir = kw.get('chdir') |
458 if chdir: | 458 if chdir: |
459 result.append(chdir) | 459 result.append(chdir) |
460 result.append('out') | 460 result.append('out') |
461 result.append(self.configuration_dirname()) | 461 result.append(self.configuration_dirname()) |
462 if type == self.STATIC_LIB: | 462 if type == self.STATIC_LIB: |
463 if sys.platform != 'darwin': | 463 if sys.platform != 'darwin': |
464 result.append('obj') | 464 result.append('obj') |
465 elif type == self.SHARED_LIB: | 465 elif type == self.SHARED_LIB: |
466 result.append('lib') | 466 if sys.platform != 'darwin': |
| 467 result.append('lib') |
467 subdir = kw.get('subdir') | 468 subdir = kw.get('subdir') |
468 if subdir: | 469 if subdir: |
469 result.append(subdir) | 470 result.append(subdir) |
470 result.append(self.built_file_basename(name, type, **kw)) | 471 result.append(self.built_file_basename(name, type, **kw)) |
471 return self.workpath(*result) | 472 return self.workpath(*result) |
472 | 473 |
473 def up_to_date(self, gyp_file, target=None, **kw): | 474 def up_to_date(self, gyp_file, target=None, **kw): |
474 result = self.build(gyp_file, target, **kw) | 475 result = self.build(gyp_file, target, **kw) |
475 if not result: | 476 if not result: |
476 stdout = self.stdout() | 477 stdout = self.stdout() |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 """ | 805 """ |
805 format = kw.get('format') | 806 format = kw.get('format') |
806 if format: | 807 if format: |
807 del kw['format'] | 808 del kw['format'] |
808 else: | 809 else: |
809 format = os.environ.get('TESTGYP_FORMAT') | 810 format = os.environ.get('TESTGYP_FORMAT') |
810 for format_class in format_class_list: | 811 for format_class in format_class_list: |
811 if format == format_class.format: | 812 if format == format_class.format: |
812 return format_class(*args, **kw) | 813 return format_class(*args, **kw) |
813 raise Exception, "unknown format %r" % format | 814 raise Exception, "unknown format %r" % format |
OLD | NEW |