Reimport
This commit is contained in:
45
tools/adb/systrace/catapult/devil/bin/generate_md_docs
Normal file
45
tools/adb/systrace/catapult/devil/bin/generate_md_docs
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2017 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 os
|
||||
import sys
|
||||
|
||||
_DEVIL_PATH = os.path.abspath(os.path.join(
|
||||
os.path.dirname(__file__), '..'))
|
||||
_DEVIL_URL = (
|
||||
'https://github.com/catapult-project/catapult/blob/master/devil/')
|
||||
|
||||
sys.path.append(_DEVIL_PATH)
|
||||
from devil.utils import cmd_helper
|
||||
|
||||
_FILES_TO_DOC = {
|
||||
'devil/android/sdk/adb_wrapper.py': 'docs/adb_wrapper.md',
|
||||
'devil/android/device_utils.py': 'docs/device_utils.md',
|
||||
'devil/utils/markdown.py': 'docs/markdown.md',
|
||||
}
|
||||
|
||||
_MARKDOWN_SCRIPT = os.path.join(_DEVIL_PATH, 'devil', 'utils', 'markdown.py')
|
||||
|
||||
def main():
|
||||
failed = False
|
||||
for k, v in _FILES_TO_DOC.iteritems():
|
||||
module_path = os.path.join(_DEVIL_PATH, k)
|
||||
module_link = _DEVIL_URL + k
|
||||
doc_path = os.path.join(_DEVIL_PATH, v)
|
||||
|
||||
status, stdout = cmd_helper.GetCmdStatusAndOutput(
|
||||
[sys.executable, _MARKDOWN_SCRIPT, module_path,
|
||||
'--module-link', module_link])
|
||||
if status:
|
||||
logging.error('Failed to update doc for %s' % module_path)
|
||||
failed = True
|
||||
else:
|
||||
with open(doc_path, 'w') as doc_file:
|
||||
doc_file.write(stdout)
|
||||
|
||||
return 1 if failed else 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
32
tools/adb/systrace/catapult/devil/bin/run_py_devicetests
Normal file
32
tools/adb/systrace/catapult/devil/bin/run_py_devicetests
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2016 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 os
|
||||
import sys
|
||||
|
||||
_CATAPULT_PATH = os.path.abspath(os.path.join(
|
||||
os.path.dirname(__file__), '..', '..'))
|
||||
_DEVIL_PATH = os.path.abspath(os.path.join(
|
||||
os.path.dirname(__file__), '..'))
|
||||
_TYP_PATH = os.path.abspath(os.path.join(_CATAPULT_PATH, 'third_party', 'typ'))
|
||||
|
||||
sys.path.append(_TYP_PATH)
|
||||
import typ
|
||||
|
||||
sys.path.append(_DEVIL_PATH)
|
||||
from devil.android import device_test_case
|
||||
|
||||
|
||||
def main():
|
||||
runner = typ.Runner()
|
||||
runner.setup_fn = device_test_case.PrepareDevices
|
||||
return runner.main(
|
||||
coverage_source=[_DEVIL_PATH],
|
||||
jobs=1,
|
||||
suffixes=['*_devicetest.py'],
|
||||
top_level_dir=_DEVIL_PATH)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
28
tools/adb/systrace/catapult/devil/bin/run_py_tests
Normal file
28
tools/adb/systrace/catapult/devil/bin/run_py_tests
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2016 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 os
|
||||
import sys
|
||||
|
||||
_CATAPULT_PATH = os.path.abspath(os.path.join(
|
||||
os.path.dirname(__file__), '..', '..'))
|
||||
_DEVIL_PATH = os.path.abspath(os.path.join(
|
||||
os.path.dirname(__file__), '..'))
|
||||
|
||||
sys.path.append(_CATAPULT_PATH)
|
||||
from catapult_build import run_with_typ
|
||||
|
||||
|
||||
def main():
|
||||
# Tests mock out internal details of methods, and the ANDROID_SERIAL can
|
||||
# change which internal methods are called. Since tests don't actually use
|
||||
# devices, it should be fine to delete the variable.
|
||||
if 'ANDROID_SERIAL' in os.environ:
|
||||
del os.environ['ANDROID_SERIAL']
|
||||
|
||||
return run_with_typ.Run(top_level_dir=_DEVIL_PATH)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user