Add support for launching webcam software for use in recipes

* Copy ensure_webcam_is_running.py from recipes repo
* Turn it into a wrapper that can launch another script
  (fix_python_path is copied from test_env.py as _ForcePythonInterpreter)
* Support it in mb.py
* Add it to video_capture_unittests

No-Try: True
Bug: chromium:755660
Change-Id: I376724a77e443620724add7818592e9368d02079
Reviewed-on: https://webrtc-review.googlesource.com/77320
Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23275}
This commit is contained in:
Oleh Prypin
2018-05-17 12:15:25 +02:00
committed by Commit Bot
parent d5addcaf1e
commit cd469a4ce5
4 changed files with 183 additions and 6 deletions

View File

@ -711,6 +711,57 @@ class UnitTest(unittest.TestCase):
'--tsan=0',
])
def test_isolate_test_launcher_with_webcam(self):
test_files = {
'/tmp/swarming_targets': 'base_unittests\n',
'/fake_src/testing/buildbot/gn_isolate_map.pyl': (
"{'base_unittests': {"
" 'label': '//base:base_unittests',"
" 'type': 'console_test_launcher',"
" 'use_webcam': True,"
"}}\n"
),
'/fake_src/out/Default/base_unittests.runtime_deps': (
"base_unittests\n"
"some_resource_file\n"
),
}
mbw = self.check(['gen', '-c', 'debug_goma', '//out/Default',
'--swarming-targets-file', '/tmp/swarming_targets',
'--isolate-map-file',
'/fake_src/testing/buildbot/gn_isolate_map.pyl'],
files=test_files, ret=0)
isolate_file = mbw.files['/fake_src/out/Default/base_unittests.isolate']
isolate_file_contents = ast.literal_eval(isolate_file)
files = isolate_file_contents['variables']['files']
command = isolate_file_contents['variables']['command']
self.assertEqual(files, [
'../../testing/test_env.py',
'../../third_party/gtest-parallel/gtest-parallel',
'../../third_party/gtest-parallel/gtest_parallel.py',
'../../tools_webrtc/ensure_webcam_is_running.py',
'../../tools_webrtc/gtest-parallel-wrapper.py',
'base_unittests',
'some_resource_file',
])
self.assertEqual(command, [
'../../tools_webrtc/ensure_webcam_is_running.py',
'../../testing/test_env.py',
'../../tools_webrtc/gtest-parallel-wrapper.py',
'--output_dir=${ISOLATED_OUTDIR}/test_logs',
'--gtest_color=no',
'--timeout=900',
'--retry_failed=3',
'./base_unittests',
'--',
'--asan=0',
'--lsan=0',
'--msan=0',
'--tsan=0',
])
def test_isolate(self):
files = {
'/fake_src/out/Default/toolchain.ninja': "",