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')) |
| 49 if api.platform.is_win: |
| 50 unittests_path += '.exe' |
| 51 api.step('unittests', [unittests_path], cwd=api.path['checkout']) |
37 | 52 |
38 embeddertests_path = str(api.path['checkout'].join('out', 'Debug', | 53 if drmemory: |
39 'pdfium_embeddertests')) | 54 api.python('embeddertests', pdfium_tests_py, |
40 if api.platform.is_win: | 55 args=['--test', 'pdfium_embeddertests'], |
41 embeddertests_path += '.exe' | 56 cwd=api.path['checkout']) |
42 api.step('embeddertests', [embeddertests_path], | 57 else: |
43 cwd=api.path['checkout']) | 58 embeddertests_path = str(api.path['checkout'].join('out', 'Debug', |
| 59 'pdfium_embeddertests')) |
| 60 if api.platform.is_win: |
| 61 embeddertests_path += '.exe' |
| 62 api.step('embeddertests', [embeddertests_path], |
| 63 cwd=api.path['checkout']) |
44 | 64 |
45 javascript_path = str(api.path['checkout'].join('testing', 'tools', | 65 if drmemory: |
46 'run_javascript_tests.py')) | 66 api.python('javascript tests', pdfium_tests_py, |
47 api.python('javascript tests', javascript_path, cwd=api.path['checkout']) | 67 args=['--test', 'pdfium_javascript'], |
| 68 cwd=api.path['checkout']) |
| 69 else: |
| 70 javascript_path = str(api.path['checkout'].join('testing', 'tools', |
| 71 'run_javascript_tests.py')) |
| 72 api.python('javascript tests', javascript_path, cwd=api.path['checkout']) |
48 | 73 |
49 pixel_tests_path = str(api.path['checkout'].join('testing', 'tools', | 74 if drmemory: |
50 'run_pixel_tests.py')) | 75 api.python('pixel tests', pdfium_tests_py, |
51 api.python('pixel tests', pixel_tests_path, cwd=api.path['checkout']) | 76 args=['--test', 'pdfium_pixel'], |
| 77 cwd=api.path['checkout']) |
| 78 else: |
| 79 pixel_tests_path = str(api.path['checkout'].join('testing', 'tools', |
| 80 'run_pixel_tests.py')) |
| 81 api.python('pixel tests', pixel_tests_path, cwd=api.path['checkout']) |
52 | 82 |
53 corpus_tests_path = str(api.path['checkout'].join('testing', 'tools', | 83 if drmemory: |
54 'run_corpus_tests.py')) | 84 api.python('corpus tests', pdfium_tests_py, |
55 api.python('corpus tests', corpus_tests_path, cwd=api.path['checkout']) | 85 args=['--test', 'pdfium_corpus'], |
| 86 cwd=api.path['checkout']) |
| 87 else: |
| 88 corpus_tests_path = str(api.path['checkout'].join('testing', 'tools', |
| 89 'run_corpus_tests.py')) |
| 90 api.python('corpus tests', corpus_tests_path, cwd=api.path['checkout']) |
56 | 91 |
57 | 92 |
58 def RunSteps(api): | 93 def RunSteps(api): |
59 _CheckoutSteps(api) | 94 _CheckoutSteps(api) |
60 _BuildSteps(api) | 95 _BuildSteps(api) |
61 with api.step.defer_results(): | 96 with api.step.defer_results(): |
62 _RunTests(api) | 97 _RunTests(api) |
63 | 98 |
64 | 99 |
65 def GenTests(api): | 100 def GenTests(api): |
66 yield api.test('win') + api.platform('win', 64) | 101 yield api.test('win') + api.platform('win', 64) |
67 yield api.test('linux') + api.platform('linux', 64) | 102 yield api.test('linux') + api.platform('linux', 64) |
68 yield api.test('mac') + api.platform('mac', 64) | 103 yield api.test('mac') + api.platform('mac', 64) |
69 | 104 |
70 yield (api.test('win_xfa') + api.platform('win', 64) + | 105 yield (api.test('win_xfa') + api.platform('win', 64) + |
71 api.properties(branch='xfa')) | 106 api.properties(branch='xfa')) |
72 yield (api.test('linux_xfa') + api.platform('linux', 64) + | 107 yield (api.test('linux_xfa') + api.platform('linux', 64) + |
73 api.properties(branch='xfa')) | 108 api.properties(branch='xfa')) |
74 yield (api.test('mac_xfa') + api.platform('mac', 64) + | 109 yield (api.test('mac_xfa') + api.platform('mac', 64) + |
75 api.properties(branch='xfa')) | 110 api.properties(branch='xfa')) |
| 111 yield (api.test('drm_win_xfa') + api.platform('win', 64) + |
| 112 api.properties(branch='xfa', drmemory=True)) |
OLD | NEW |