summaryrefslogtreecommitdiff
path: root/build/scripts/slave/recipes/catapult.py
blob: 35f289961561dce346281d4c2365fae921a6da47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

DEPS = [
  'bot_update',
  'gclient',
  'gitiles',
  'path',
  'platform',
  'properties',
  'python',
]



def _CheckoutSteps(api, buildername):
  """Checks out the catapult repo (and any dependencies) using gclient."""
  api.gclient.set_config('catapult')
  api.bot_update.ensure_checkout(force=True)
  api.gclient.runhooks()


def _FetchAppEngineSDKSteps(api):
  """Fetches the App Engine SDK and returns its path.

  This uses a downloader script in the infra repo to download a script
  which is then used to download and unpack the SDK itself.
  """
  script_content = api.gitiles.download_file(
      'https://chromium.googlesource.com/infra/infra',
      'bootstrap/get_appengine.py',
      step_name='Fetch SDK downloader',
      # This is a commit after the latest fix to the script.
      branch='f849aad85ac3589c931197bff861faf0e2ef0ece')
  api.python.inline('Run SDK downloader', script_content, args=['--dest=.'])
  return api.path['slave_build'].join('google_appengine')


def RunSteps(api):
  buildername = api.properties.get('buildername')
  _CheckoutSteps(api, buildername)

  # The dashboard unit tests depend on Python modules in the App Engine SDK,
  # and the unit test runner script assumes that the SDK is in PYTHONPATH.
  sdk_path = _FetchAppEngineSDKSteps(api)
  modified_env = {
    'PYTHONPATH': api.path.pathsep.join(['%(PYTHONPATH)s', str(sdk_path)])
  }

  api.python('Build Python Tests',
             api.path['checkout'].join('catapult_build', 'bin', 'run_py_tests'))
  api.python('Util Tests',
             api.path['checkout'].join('base', 'util', 'run_tests.py'))
  api.python('Dashboard Tests',
             api.path['checkout'].join('dashboard', 'bin', 'run_py_tests'),
             env=modified_env)
  api.python('Tracing Python Tests',
             api.path['checkout'].join('tracing', 'bin', 'run_py_tests'),
             ['--no-install-hooks'])
  api.python('Tracing Dev Server Tests',
             api.path['checkout'].join(
                 'tracing', 'bin', 'run_dev_server_tests'),
             ['--no-install-hooks', '--no-use-local-chrome'])
  api.python('Perf Insights Dev Server Tests',
             api.path['checkout'].join(
                 'perf_insights', 'bin', 'run_dev_server_tests'),
             ['--no-install-hooks', '--no-use-local-chrome'])
  api.python('Systrace Tests',
             api.path['checkout'].join('systrace', 'bin', 'run_tests'))
  if not api.platform.is_win:
    # D8/vinn currently unavailable on Windows.
    # TODO(sullivan): Add these tests on Windows when available.
    api.python('Vinn Tests',
               api.path['checkout'].join('third_party', 'vinn', 'run_test'))
    api.python('Tracing D8 Tests',
               api.path['checkout'].join('tracing', 'bin', 'run_vinn_tests'))
    api.python('Perf Vinn Insights Tests',
               api.path['checkout'].join(
                   'perf_insights', 'bin', 'run_vinn_tests'))
    # TODO(nduca): re-enable these if they should be working on Windows.
    api.python('Perf Insights Python Tests',
               api.path['checkout'].join(
                   'perf_insights', 'bin', 'run_py_tests'),
               ['--no-install-hooks'])


def GenTests(api):
  yield (
    api.test('basic') +
    api.properties(mastername='master.client.catapult',
                   buildername='windows',
                   slavename='windows_slave') +
    api.step_data('Fetch SDK downloader',
                  api.gitiles.make_encoded_file(
                      '"<simulated contents of get_appengine.py>"'))
  )