 Chromium Code Reviews
 Chromium Code Reviews Issue 1472163002:
  Update pdfium.py to support running pdfium tests with Dr. Memory  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
    
  
    Issue 1472163002:
  Update pdfium.py to support running pdfium tests with Dr. Memory  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master| OLD | NEW | 
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 DEPS = [ | 5 DEPS = [ | 
| 6 'gclient', | 6 'gclient', | 
| 7 'path', | 7 'path', | 
| 8 'platform', | 8 'platform', | 
| 9 'properties', | 9 'properties', | 
| 10 'python', | 10 'python', | 
| 11 'step', | 11 'step', | 
| 12 ] | 12 ] | 
| 13 | 13 | 
| 14 from recipe_engine.recipe_api import Property | |
| 15 | |
| 16 PROPERTIES = { | |
| 17 'drmemory': Property(default=True, kind=bool), | |
| 18 } | |
| 14 | 19 | 
| 15 def _CheckoutSteps(api): | 20 def _CheckoutSteps(api): | 
| 16 # Checkout pdfium and its dependencies (specified in DEPS) using gclient | 21 # Checkout pdfium and its dependencies (specified in DEPS) using gclient | 
| 17 api.gclient.set_config('pdfium') | 22 api.gclient.set_config('pdfium') | 
| 18 branch = api.properties.get('branch') | 23 branch = api.properties.get('branch') | 
| 19 if branch: | 24 if branch: | 
| 20 api.gclient.c.solutions[0].revision = 'origin/' + branch | 25 api.gclient.c.solutions[0].revision = 'origin/' + branch | 
| 21 api.gclient.checkout() | 26 api.gclient.checkout() | 
| 22 api.gclient.runhooks() | 27 api.gclient.runhooks() | 
| 23 | 28 | 
| 24 | 29 | 
| 25 def _BuildSteps(api): | 30 def _BuildSteps(api): | 
| 26 # Build sample file using Ninja | 31 # Build sample file using Ninja | 
| 27 debug_path = api.path['checkout'].join('out', 'Debug') | 32 debug_path = api.path['checkout'].join('out', 'Debug') | 
| 28 api.step('compile with ninja', ['ninja', '-C', debug_path]) | 33 api.step('compile with ninja', ['ninja', '-C', debug_path]) | 
| 29 | 34 | 
| 30 | 35 | 
| 31 def _RunTests(api): | 36 def _RunTests(api): | 
| 32 unittests_path = str(api.path['checkout'].join('out', 'Debug', | 37 drmemory = api.properties.get('drmemory') | 
| 33 'pdfium_unittests')) | 38 pdfium_tests_py = str(api.path['checkout'].join('tools', | 
| 34 if api.platform.is_win: | 39 'drmemory', | 
| 35 unittests_path += '.exe' | 40 'scripts', | 
| 36 api.step('unittests', [unittests_path], cwd=api.path['checkout']) | 41 'pdfium_tests.py')) | 
| 42 if drmemory: | |
| 43 api.python('unittests', pdfium_tests_py, | |
| 44 args=['--test', 'pdfium_unittests'], | |
| 45 cwd=api.path['checkout']) | |
| 46 else: | |
| 47 unittests_path = str(api.path['checkout'].join('out', 'Debug', | |
| 48 'pdfium_unittests')) | |
| 
Dirk Pranke
2015/11/25 03:58:05
did you lose the 'is_win' check here?
 | |
| 49 api.step('unittests', [unittests_path], cwd=api.path['checkout']) | |
| 37 | 50 | 
| 38 embeddertests_path = str(api.path['checkout'].join('out', 'Debug', | 51 if drmemory: | 
| 39 'pdfium_embeddertests')) | 52 api.python('embeddertests', pdfium_tests_py, | 
| 40 if api.platform.is_win: | 53 args=['--test', 'pdfium_embeddertests'], | 
| 41 embeddertests_path += '.exe' | 54 cwd=api.path['checkout']) | 
| 42 api.step('embeddertests', [embeddertests_path], | 55 else: | 
| 43 cwd=api.path['checkout']) | 56 embeddertests_path = str(api.path['checkout'].join('out', 'Debug', | 
| 57 'pdfium_embeddertests')) | |
| 58 if api.platform.is_win: | |
| 59 embeddertests_path += '.exe' | |
| 60 api.step('embeddertests', [embeddertests_path], cwd=api.path['checkout']) | |
| 44 | 61 | 
| 45 javascript_path = str(api.path['checkout'].join('testing', 'tools', | 62 if drmemory: | 
| 46 'run_javascript_tests.py')) | 63 api.python('javascript tests', pdfium_tests_py, | 
| 47 api.python('javascript tests', javascript_path, cwd=api.path['checkout']) | 64 args=['--test', 'pdfium_javascript'], | 
| 65 cwd=api.path['checkout']) | |
| 66 else: | |
| 67 javascript_path = str(api.path['checkout'].join('testing', 'tools', | |
| 68 'run_javascript_tests.py')) | |
| 69 api.python('javascript tests', javascript_path, cwd=api.path['checkout']) | |
| 48 | 70 | 
| 49 pixel_tests_path = str(api.path['checkout'].join('testing', 'tools', | 71 if drmemory: | 
| 50 'run_pixel_tests.py')) | 72 api.python('pixel tests', pdfium_tests_py, | 
| 51 api.python('pixel tests', pixel_tests_path, cwd=api.path['checkout']) | 73 args=['--test', 'pdfium_pixel'], | 
| 74 cwd=api.path['checkout']) | |
| 75 else: | |
| 76 pixel_tests_path = str(api.path['checkout'].join('testing', 'tools', | |
| 77 'run_pixel_tests.py')) | |
| 78 api.python('pixel tests', pixel_tests_path, cwd=api.path['checkout']) | |
| 52 | 79 | 
| 53 corpus_tests_path = str(api.path['checkout'].join('testing', 'tools', | 80 if drmemory: | 
| 54 'run_corpus_tests.py')) | 81 api.python('corpus tests', pdfium_tests_py, | 
| 55 api.python('corpus tests', corpus_tests_path, cwd=api.path['checkout']) | 82 args=['--test', 'pdfium_corpus'], | 
| 83 cwd=api.path['checkout']) | |
| 84 else: | |
| 85 corpus_tests_path = str(api.path['checkout'].join('testing', 'tools', | |
| 86 'run_corpus_tests.py')) | |
| 87 api.python('corpus tests', corpus_tests_path, cwd=api.path['checkout']) | |
| 56 | 88 | 
| 57 | 89 | 
| 58 def RunSteps(api): | 90 def RunSteps(api): | 
| 59 _CheckoutSteps(api) | 91 _CheckoutSteps(api) | 
| 60 _BuildSteps(api) | 92 _BuildSteps(api) | 
| 61 with api.step.defer_results(): | 93 with api.step.defer_results(): | 
| 62 _RunTests(api) | 94 _RunTests(api) | 
| 63 | 95 | 
| 64 | 96 | 
| 65 def GenTests(api): | 97 def GenTests(api): | 
| 66 yield api.test('win') + api.platform('win', 64) | 98 yield api.test('win') + api.platform('win', 64) | 
| 67 yield api.test('linux') + api.platform('linux', 64) | 99 yield api.test('linux') + api.platform('linux', 64) | 
| 68 yield api.test('mac') + api.platform('mac', 64) | 100 yield api.test('mac') + api.platform('mac', 64) | 
| 69 | 101 | 
| 70 yield (api.test('win_xfa') + api.platform('win', 64) + | 102 yield (api.test('win_xfa') + api.platform('win', 64) + | 
| 71 api.properties(branch='xfa')) | 103 api.properties(branch='xfa')) | 
| 72 yield (api.test('linux_xfa') + api.platform('linux', 64) + | 104 yield (api.test('linux_xfa') + api.platform('linux', 64) + | 
| 73 api.properties(branch='xfa')) | 105 api.properties(branch='xfa')) | 
| 74 yield (api.test('mac_xfa') + api.platform('mac', 64) + | 106 yield (api.test('mac_xfa') + api.platform('mac', 64) + | 
| 75 api.properties(branch='xfa')) | 107 api.properties(branch='xfa')) | 
| 108 yield (api.test('drm_win_xfa') + api.platform('win', 64) + | |
| 109 api.properties(branch='xfa', drmemory=True)) | |
| OLD | NEW |