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 'path', | 6 'path', |
7 'properties', | 7 'properties', |
8 'python', | 8 'python', |
9 'raw_io', | 9 'raw_io', |
10 'step', | 10 'step', |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 api.raw_io.test_api.stream_output('blah\n') + | 42 api.raw_io.test_api.stream_output('blah\n') + |
43 api.raw_io.test_api.stream_output('fail\n', 'stderr') | 43 api.raw_io.test_api.stream_output('fail\n', 'stderr') |
44 )) | 44 )) |
45 ) | 45 ) |
46 assert step_result.stdout == 'blah\n' | 46 assert step_result.stdout == 'blah\n' |
47 assert step_result.stderr == 'fail\n' | 47 assert step_result.stderr == 'fail\n' |
48 | 48 |
49 # leak_to coverage. | 49 # leak_to coverage. |
50 step_result = api.step( | 50 step_result = api.step( |
51 'leak stdout', ['echo', 'leaking'], | 51 'leak stdout', ['echo', 'leaking'], |
52 stdout=api.raw_io.output(leak_to=api.path['slave_build'].join('out.txt')), | 52 stdout=api.raw_io.output(leak_to=api.path['tmp'].join('out.txt')), |
53 step_test_data=( | 53 step_test_data=( |
54 lambda: api.raw_io.test_api.stream_output('leaking\n'))) | 54 lambda: api.raw_io.test_api.stream_output('leaking\n'))) |
55 assert step_result.stdout == 'leaking\n' | 55 assert step_result.stdout == 'leaking\n' |
56 | 56 |
57 api.step('list temp dir', ['ls', api.raw_io.output_dir()]) | 57 api.step('list temp dir', ['ls', api.raw_io.output_dir()]) |
58 api.step('leak dir', ['ls', api.raw_io.output_dir( | 58 api.step('leak dir', ['ls', api.raw_io.output_dir( |
59 leak_to=api.path['slave_build'].join('out'))]) | 59 leak_to=api.path['tmp'].join('out'))]) |
60 | 60 |
61 # Example of overriding default mocked output for a single named output. | 61 # Example of overriding default mocked output for a single named output. |
62 step_result = api.python.inline( | 62 step_result = api.python.inline( |
63 'override_default_mock', | 63 'override_default_mock', |
64 """ | 64 """ |
65 import sys | 65 import sys |
66 with open(sys.argv[1], 'w') as f: | 66 with open(sys.argv[1], 'w') as f: |
67 f.write(%r) | 67 f.write(%r) |
68 """ % api.properties.get('some_prop', 'good_value'), | 68 """ % api.properties.get('some_prop', 'good_value'), |
69 args=[api.raw_io.output(name='test')], | 69 args=[api.raw_io.output(name='test')], |
(...skipping 15 matching lines...) Expand all Loading... |
85 yield (api.test('basic') + | 85 yield (api.test('basic') + |
86 api.properties(some_prop='bad_value') + | 86 api.properties(some_prop='bad_value') + |
87 api.step_data('echo', | 87 api.step_data('echo', |
88 stdout=api.raw_io.output('Hello World\n'), | 88 stdout=api.raw_io.output('Hello World\n'), |
89 stderr=api.raw_io.output('')) + | 89 stderr=api.raw_io.output('')) + |
90 api.step_data('cat', | 90 api.step_data('cat', |
91 stdout=api.raw_io.output('hello')) + | 91 stdout=api.raw_io.output('hello')) + |
92 api.step_data('override_default_mock', | 92 api.step_data('override_default_mock', |
93 api.raw_io.output('good_value', name='test')) | 93 api.raw_io.output('good_value', name='test')) |
94 ) | 94 ) |
OLD | NEW |