| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. 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 """Recipe to test v8/node.js integration.""" | 5 """Recipe to test v8/node.js integration.""" |
| 6 | 6 |
| 7 from recipe_engine.types import freeze | 7 from recipe_engine.types import freeze |
| 8 | 8 |
| 9 | 9 |
| 10 DEPS = [ | 10 DEPS = [ |
| 11 'chromium', | 11 'chromium', |
| 12 'depot_tools/gclient', | 12 'depot_tools/gclient', |
| 13 'depot_tools/infra_paths', | |
| 14 'file', | 13 'file', |
| 15 'recipe_engine/path', | 14 'recipe_engine/path', |
| 16 'recipe_engine/platform', | 15 'recipe_engine/platform', |
| 17 'recipe_engine/properties', | 16 'recipe_engine/properties', |
| 18 'recipe_engine/python', | 17 'recipe_engine/python', |
| 19 'recipe_engine/step', | 18 'recipe_engine/step', |
| 20 'v8', | 19 'v8', |
| 21 ] | 20 ] |
| 22 | 21 |
| 23 BUILDERS = freeze({ | 22 BUILDERS = freeze({ |
| 24 'client.v8.fyi': { | 23 'client.v8.fyi': { |
| 25 'builders': { | 24 'builders': { |
| 26 'V8 - node.js integration - lkgr': { | 25 'V8 - node.js integration - lkgr': { |
| 27 'testing': { | 26 'testing': { |
| 28 'platform': 'linux', | 27 'platform': 'linux', |
| 29 }, | 28 }, |
| 30 }, | 29 }, |
| 31 }, | 30 }, |
| 32 }, | 31 }, |
| 33 }) | 32 }) |
| 34 | 33 |
| 35 | 34 |
| 36 def _build_and_test(api, suffix=''): | 35 def _build_and_test(api, suffix=''): |
| 37 api.step( | 36 api.step( |
| 38 'configure node.js%s' % suffix, | 37 'configure node.js%s' % suffix, |
| 39 [api.infra_paths['slave_build'].join('node.js', 'configure')], | 38 [api.path['slave_build'].join('node.js', 'configure')], |
| 40 cwd=api.infra_paths['slave_build'].join('node.js'), | 39 cwd=api.path['slave_build'].join('node.js'), |
| 41 ) | 40 ) |
| 42 | 41 |
| 43 api.step( | 42 api.step( |
| 44 'build and test node.js%s' % suffix, | 43 'build and test node.js%s' % suffix, |
| 45 ['make', '-j8', 'test'], | 44 ['make', '-j8', 'test'], |
| 46 cwd=api.infra_paths['slave_build'].join('node.js'), | 45 cwd=api.path['slave_build'].join('node.js'), |
| 47 ) | 46 ) |
| 48 | 47 |
| 49 | 48 |
| 50 def RunSteps(api): | 49 def RunSteps(api): |
| 51 v8 = api.v8 | 50 v8 = api.v8 |
| 52 v8.apply_bot_config(BUILDERS) | 51 v8.apply_bot_config(BUILDERS) |
| 53 api.gclient.apply_config('node_js') | 52 api.gclient.apply_config('node_js') |
| 54 v8.checkout() | 53 v8.checkout() |
| 55 api.chromium.cleanup_temp() | 54 api.chromium.cleanup_temp() |
| 56 | 55 |
| 57 try: | 56 try: |
| 58 # Build and test the node.js branch as FYI. | 57 # Build and test the node.js branch as FYI. |
| 59 _build_and_test(api, ' - baseline') | 58 _build_and_test(api, ' - baseline') |
| 60 except api.step.StepFailure: # pragma: no cover | 59 except api.step.StepFailure: # pragma: no cover |
| 61 pass | 60 pass |
| 62 | 61 |
| 63 # Copy the checked-out v8. | 62 # Copy the checked-out v8. |
| 64 api.file.rmtree('v8', api.infra_paths['slave_build'].join('node.js', 'deps', '
v8')) | 63 api.file.rmtree('v8', api.path['slave_build'].join('node.js', 'deps', 'v8')) |
| 65 api.python( | 64 api.python( |
| 66 name='copy v8 tree', | 65 name='copy v8 tree', |
| 67 script=api.v8.resource('copy_v8.py'), | 66 script=api.v8.resource('copy_v8.py'), |
| 68 args=[ | 67 args=[ |
| 69 # Source. | 68 # Source. |
| 70 api.infra_paths['slave_build'].join('v8'), | 69 api.path['slave_build'].join('v8'), |
| 71 # Destination. | 70 # Destination. |
| 72 api.infra_paths['slave_build'].join('node.js', 'deps', 'v8'), | 71 api.path['slave_build'].join('node.js', 'deps', 'v8'), |
| 73 # Paths to ignore. | 72 # Paths to ignore. |
| 74 '.git', | 73 '.git', |
| 75 api.infra_paths['slave_build'].join('v8', 'buildtools'), | 74 api.path['slave_build'].join('v8', 'buildtools'), |
| 76 api.infra_paths['slave_build'].join('v8', 'out'), | 75 api.path['slave_build'].join('v8', 'out'), |
| 77 api.infra_paths['slave_build'].join('v8', 'third_party'), | 76 api.path['slave_build'].join('v8', 'third_party'), |
| 78 ], | 77 ], |
| 79 ) | 78 ) |
| 80 | 79 |
| 81 # Build and test node.js with the checked-out v8. | 80 # Build and test node.js with the checked-out v8. |
| 82 _build_and_test(api) | 81 _build_and_test(api) |
| 83 | 82 |
| 84 | 83 |
| 85 def _sanitize_nonalpha(text): | 84 def _sanitize_nonalpha(text): |
| 86 return ''.join(c if c.isalnum() else '_' for c in text) | 85 return ''.join(c if c.isalnum() else '_' for c in text) |
| 87 | 86 |
| 88 | 87 |
| 89 def GenTests(api): | 88 def GenTests(api): |
| 90 for mastername, masterconf in BUILDERS.iteritems(): | 89 for mastername, masterconf in BUILDERS.iteritems(): |
| 91 for buildername, _ in masterconf['builders'].iteritems(): | 90 for buildername, _ in masterconf['builders'].iteritems(): |
| 92 yield ( | 91 yield ( |
| 93 api.test('_'.join([ | 92 api.test('_'.join([ |
| 94 'full', | 93 'full', |
| 95 _sanitize_nonalpha(mastername), | 94 _sanitize_nonalpha(mastername), |
| 96 _sanitize_nonalpha(buildername), | 95 _sanitize_nonalpha(buildername), |
| 97 ])) + | 96 ])) + |
| 98 api.properties.generic( | 97 api.properties.generic( |
| 99 mastername=mastername, | 98 mastername=mastername, |
| 100 buildername=buildername, | 99 buildername=buildername, |
| 101 branch='refs/heads/lkgr', | 100 branch='refs/heads/lkgr', |
| 102 revision='deadbeef', | 101 revision='deadbeef', |
| 103 ) | 102 ) |
| 104 ) | 103 ) |
| OLD | NEW |