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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 else: | 364 else: |
365 message_target = target | 365 message_target = target |
366 kw['stdout'] = "make: Nothing to be done for `%s'.\n" % message_target | 366 kw['stdout'] = "make: Nothing to be done for `%s'.\n" % message_target |
367 return self.build(gyp_file, target, **kw) | 367 return self.build(gyp_file, target, **kw) |
368 def run_built_executable(self, name, *args, **kw): | 368 def run_built_executable(self, name, *args, **kw): |
369 """ | 369 """ |
370 Runs an executable built by Make. | 370 Runs an executable built by Make. |
371 """ | 371 """ |
372 configuration = self.configuration_dirname() | 372 configuration = self.configuration_dirname() |
373 libdir = os.path.join('out', configuration, 'lib') | 373 libdir = os.path.join('out', configuration, 'lib') |
374 # TODO(piman): when everything is cross-compile safe, remove lib.target | 374 # TODO(piman): when everything is cross-compile safe, remove |
375 os.environ['LD_LIBRARY_PATH'] = libdir + '.host:' + libdir + '.target' | 375 # the trailing 'libdir' that pulls in target-compiled libs as well. |
| 376 os.environ['LD_LIBRARY_PATH'] = libdir + '.host:' + libdir |
376 # Enclosing the name in a list avoids prepending the original dir. | 377 # Enclosing the name in a list avoids prepending the original dir. |
377 program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)] | 378 program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)] |
378 return self.run(program=program, *args, **kw) | 379 return self.run(program=program, *args, **kw) |
379 def built_file_path(self, name, type=None, **kw): | 380 def built_file_path(self, name, type=None, **kw): |
380 """ | 381 """ |
381 Returns a path to the specified file name, of the specified type, | 382 Returns a path to the specified file name, of the specified type, |
382 as built by Make. | 383 as built by Make. |
383 | 384 |
384 Built files are in the subdirectory 'out/{configuration}'. | 385 Built files are in the subdirectory 'out/{configuration}'. |
385 The default is 'out/Default'. | 386 The default is 'out/Default'. |
386 | 387 |
387 A chdir= keyword argument specifies the source directory | 388 A chdir= keyword argument specifies the source directory |
388 relative to which the output subdirectory can be found. | 389 relative to which the output subdirectory can be found. |
389 | 390 |
390 "type" values of STATIC_LIB or SHARED_LIB append the necessary | 391 "type" values of STATIC_LIB or SHARED_LIB append the necessary |
391 prefixes and suffixes to a platform-independent library base name. | 392 prefixes and suffixes to a platform-independent library base name. |
392 | 393 |
393 A subdir= keyword argument specifies a library subdirectory within | 394 A subdir= keyword argument specifies a library subdirectory within |
394 the default 'obj.target'. | 395 the default 'obj'. |
395 """ | 396 """ |
396 result = [] | 397 result = [] |
397 chdir = kw.get('chdir') | 398 chdir = kw.get('chdir') |
398 if chdir: | 399 if chdir: |
399 result.append(chdir) | 400 result.append(chdir) |
400 configuration = self.configuration_dirname() | 401 configuration = self.configuration_dirname() |
401 result.extend(['out', configuration]) | 402 result.extend(['out', configuration]) |
402 if type == self.STATIC_LIB and sys.platform != 'darwin': | 403 if type == self.STATIC_LIB and sys.platform != 'darwin': |
403 result.append('obj.target') | 404 result.append('obj') |
404 elif type == self.SHARED_LIB and sys.platform != 'darwin': | 405 elif type == self.SHARED_LIB and sys.platform != 'darwin': |
405 result.append('lib.target') | 406 result.append('lib') |
406 subdir = kw.get('subdir') | 407 subdir = kw.get('subdir') |
407 if subdir: | 408 if subdir: |
408 result.append(subdir) | 409 result.append(subdir) |
409 result.append(self.built_file_basename(name, type, **kw)) | 410 result.append(self.built_file_basename(name, type, **kw)) |
410 return self.workpath(*result) | 411 return self.workpath(*result) |
411 | 412 |
412 | 413 |
413 class TestGypNinja(TestGypBase): | 414 class TestGypNinja(TestGypBase): |
414 """ | 415 """ |
415 Subclass for testing the GYP Ninja generator. | 416 Subclass for testing the GYP Ninja generator. |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 """ | 800 """ |
800 format = kw.get('format') | 801 format = kw.get('format') |
801 if format: | 802 if format: |
802 del kw['format'] | 803 del kw['format'] |
803 else: | 804 else: |
804 format = os.environ.get('TESTGYP_FORMAT') | 805 format = os.environ.get('TESTGYP_FORMAT') |
805 for format_class in format_class_list: | 806 for format_class in format_class_list: |
806 if format == format_class.format: | 807 if format == format_class.format: |
807 return format_class(*args, **kw) | 808 return format_class(*args, **kw) |
808 raise Exception, "unknown format %r" % format | 809 raise Exception, "unknown format %r" % format |
OLD | NEW |