summaryrefslogtreecommitdiffstats
path: root/content/test/gpu/run_gpu_tests
blob: 2ebb6ff8544b4f366fed5806cab9035e5f0a9462 (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
#!/usr/bin/env python
# Copyright (c) 2012 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.
import imp
import os
import sys
import urllib

# Directory path in which to save bootstrap files.
BOOTSTRAPPED_FILES_DIR = 'support/bootstrap_files'


def bootstrapIfNeeded(module_name, module_path, module_deps_url):
  """Ensures that the given module_name is available, grab from URL if not."""
  try:
    imp.find_module(module_name)
    return
  except ImportError:
    sys.path.append(os.path.join(os.path.dirname(__file__),
                                 BOOTSTRAPPED_FILES_DIR,
                                 module_path))
    try:
      imp.find_module(module_name)
      return
    except ImportError:
      bootstrap_txt = urllib.urlopen('http://src.chromium.org/viewvc/chrome/' +
                                     'trunk/src/tools/telemetry/tools/' +
                                     'telemetry_bootstrap.py').read()
      bootstrap = imp.new_module('bootstrap')
      exec bootstrap_txt in bootstrap.__dict__
      bootstrap.DownloadDepsURL(os.path.join(os.path.dirname(__file__),
                                             BOOTSTRAPPED_FILES_DIR),
                                module_deps_url)


if __name__ == '__main__':
  bootstrapIfNeeded('gpu_tests', 'src/content/test/gpu',
                    'http://src.chromium.org/viewvc/chrome/trunk/src/content/' +
                    'test/gpu/gpu_tests/bootstrap_deps')
  import gpu_tests
  from telemetry.page import page_test_runner
  test_dir = os.path.join(os.path.dirname(__file__), 'gpu_tests')

  import page_sets # pylint: disable=F0401
  page_set_filenames = page_sets.GetAllPageSetFilenames()

  sys.exit(page_test_runner.Main(test_dir, '', page_set_filenames))