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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 # We need to remove all gyp outputs from out/. Ths is because some tests | 393 # We need to remove all gyp outputs from out/. Ths is because some tests |
394 # don't have rules to regenerate output, so they will simply re-use stale | 394 # don't have rules to regenerate output, so they will simply re-use stale |
395 # output if present. Since the test working directory gets regenerated for | 395 # output if present. Since the test working directory gets regenerated for |
396 # each test run, this can confuse things. | 396 # each test run, this can confuse things. |
397 # We don't have a list of build outputs because we don't know which | 397 # We don't have a list of build outputs because we don't know which |
398 # dependent targets were built. Instead we delete all gyp-generated output. | 398 # dependent targets were built. Instead we delete all gyp-generated output. |
399 # This may be excessive, but should be safe. | 399 # This may be excessive, but should be safe. |
400 out_dir = os.environ['ANDROID_PRODUCT_OUT'] | 400 out_dir = os.environ['ANDROID_PRODUCT_OUT'] |
401 obj_dir = os.path.join(out_dir, 'obj') | 401 obj_dir = os.path.join(out_dir, 'obj') |
402 shutil.rmtree(os.path.join(obj_dir, 'GYP'), ignore_errors = True) | 402 shutil.rmtree(os.path.join(obj_dir, 'GYP'), ignore_errors = True) |
403 shutil.rmtree(os.path.join(obj_dir, 'NONE'), ignore_errors = True) | |
404 for x in ['EXECUTABLES', 'STATIC_LIBRARIES', 'SHARED_LIBRARIES']: | 403 for x in ['EXECUTABLES', 'STATIC_LIBRARIES', 'SHARED_LIBRARIES']: |
405 for d in os.listdir(os.path.join(obj_dir, x)): | 404 for d in os.listdir(os.path.join(obj_dir, x)): |
406 if d.endswith('_gyp_intermediates'): | 405 if d.endswith('_gyp_intermediates'): |
407 shutil.rmtree(os.path.join(obj_dir, x, d), ignore_errors = True) | 406 shutil.rmtree(os.path.join(obj_dir, x, d), ignore_errors = True) |
408 for x in [os.path.join('obj', 'lib'), os.path.join('system', 'lib')]: | 407 for x in [os.path.join('obj', 'lib'), os.path.join('system', 'lib')]: |
409 for d in os.listdir(os.path.join(out_dir, x)): | 408 for d in os.listdir(os.path.join(out_dir, x)): |
410 if d.endswith('_gyp.so'): | 409 if d.endswith('_gyp.so'): |
411 os.remove(os.path.join(out_dir, x, d)) | 410 os.remove(os.path.join(out_dir, x, d)) |
412 | 411 |
413 super(TestGypAndroid, self).__init__(*args, **kw) | 412 super(TestGypAndroid, self).__init__(*args, **kw) |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 | 1039 |
1041 def TestGyp(*args, **kw): | 1040 def TestGyp(*args, **kw): |
1042 """ | 1041 """ |
1043 Returns an appropriate TestGyp* instance for a specified GYP format. | 1042 Returns an appropriate TestGyp* instance for a specified GYP format. |
1044 """ | 1043 """ |
1045 format = kw.pop('format', os.environ.get('TESTGYP_FORMAT')) | 1044 format = kw.pop('format', os.environ.get('TESTGYP_FORMAT')) |
1046 for format_class in format_class_list: | 1045 for format_class in format_class_list: |
1047 if format == format_class.format: | 1046 if format == format_class.format: |
1048 return format_class(*args, **kw) | 1047 return format_class(*args, **kw) |
1049 raise Exception, "unknown format %r" % format | 1048 raise Exception, "unknown format %r" % format |
OLD | NEW |