diff options
author | Luis Lozano <llozano@chromium.org> | 2015-12-15 13:49:30 -0800 |
---|---|---|
committer | Luis Lozano <llozano@chromium.org> | 2015-12-16 17:36:06 +0000 |
commit | f2a3ef46f75d2196a93d3ed27f4d1fcf22b54fbe (patch) | |
tree | 185d243c7eed7c7a0db6f0e640746cadc1479ea9 /test_gdb_dejagnu.py | |
parent | 2a66f70fef907c1cb15229cb58e5129cb620ac98 (diff) | |
download | toolchain-utils-f2a3ef46f75d2196a93d3ed27f4d1fcf22b54fbe.tar.gz |
Run pyformat on all the toolchain-utils files.
This gets rid of a lot of lint issues.
Ran by doing this:
for f in *.py; do echo -n "$f " ; if [ -x $f ]; then pyformat -i
--remove_trailing_comma --yapf --force_quote_type=double $f ; else
pyformat -i --remove_shebang --remove_trailing_comma --yapf
--force_quote_type=double $f ; fi ; done
BUG=chromium:567921
TEST=Ran simple crosperf run.
Change-Id: I59778835fdaa5f706d2e1765924389f9e97433d1
Reviewed-on: https://chrome-internal-review.googlesource.com/242031
Reviewed-by: Luis Lozano <llozano@chromium.org>
Commit-Queue: Luis Lozano <llozano@chromium.org>
Tested-by: Luis Lozano <llozano@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@google.com>
Diffstat (limited to 'test_gdb_dejagnu.py')
-rwxr-xr-x | test_gdb_dejagnu.py | 74 |
1 files changed, 41 insertions, 33 deletions
diff --git a/test_gdb_dejagnu.py b/test_gdb_dejagnu.py index d7a21abc..65f007ef 100755 --- a/test_gdb_dejagnu.py +++ b/test_gdb_dejagnu.py @@ -11,8 +11,7 @@ from utils import email_sender class DejagnuAdapter(object): - def __init__(self, board, remote, gdb_dir, - chromeos_root, cleanup): + def __init__(self, board, remote, gdb_dir, chromeos_root, cleanup): self._board = board self._remote = remote self._gdb_dir = gdb_dir @@ -21,8 +20,8 @@ class DejagnuAdapter(object): self._cmd_exec = command_executer.GetCommandExecuter() def SetupChromeOS(self): - cmd = [setup_chromeos.__file__, - '--dir=' + self._chromeos_root, '--minilayout', '--jobs=8'] + cmd = [setup_chromeos.__file__, '--dir=' + self._chromeos_root, + '--minilayout', '--jobs=8'] ret = setup_chromeos.Main(cmd) if ret: raise Exception('Failed to checkout chromeos') @@ -35,16 +34,15 @@ class DejagnuAdapter(object): def SetupBoard(self): cmd = './setup_board --board=' + self._board ret = self._cmd_exec.ChrootRunCommand(self._chromeos_root, - cmd, terminated_timeout=4000) + cmd, + terminated_timeout=4000) if ret: raise Exception('Failed to setup board.') def CheckGDB(self): - args = [gdb_dejagnu.__file__, - '--board=' + self._board, + args = [gdb_dejagnu.__file__, '--board=' + self._board, '--chromeos_root=' + self._chromeos_root, - '--mount=' + self._gdb_dir, - '--remote=' + self._remote] + '--mount=' + self._gdb_dir, '--remote=' + self._remote] if self._cleanup: args.append('--cleanup=' + self._cleanup) return gdb_dejagnu.Main(args) @@ -63,8 +61,8 @@ def EmailResult(result): email_to = ['yunlian@google.com'] if len(result) == 4: subject = 'Job failed: dejagnu test didn\'t finish' - email_text = ('Job failed prematurely, check exception below.\n' + - result[3]) + email_text = ( + 'Job failed prematurely, check exception below.\n' + result[3]) elif result[0]: subject = 'Job finished: dejagnu test failed' num_new_failures = GetNumNewFailures(result[1]) @@ -72,11 +70,10 @@ def EmailResult(result): summary = '{0} new fail(s), check log below.'.format(num_new_failures) else: summary = 'At least 1 new fail found, check log below.' - email_text = (summary + - ('\nStdout ====\n' - '{0}\n' - '\nStderr ===\n' - '{1}\n').format(result[1], result[2])) + email_text = (summary + ('\nStdout ====\n' + '{0}\n' + '\nStderr ===\n' + '{1}\n').format(result[1], result[2])) else: subject = 'Job finished: dejagnu test passed' email_text = ('Cool! No new fail found.\n' @@ -91,29 +88,40 @@ def EmailResult(result): except Exception as e: # Do not propagate this email sending exception, you want to email an # email exception? Just log it on console. - print ('Sending email failed - {0}' - 'Subject: {1}' - 'Text: {2}').format( - str(e), subject, email_text) + print('Sending email failed - {0}' + 'Subject: {1}' + 'Text: {2}').format( + str(e), subject, email_text) def ProcessArguments(argv): """Processing script arguments.""" - parser = optparse.OptionParser(description=( - 'This script is used by nightly client to test gdb. ' - 'DO NOT run it unless you know what you are doing.'), - usage='test_gdb_dejagnu.py options') - parser.add_option('-b', '--board', dest='board', + parser = optparse.OptionParser( + description=('This script is used by nightly client to test gdb. ' + 'DO NOT run it unless you know what you are doing.'), + usage='test_gdb_dejagnu.py options') + parser.add_option('-b', + '--board', + dest='board', help=('Required. Specify board type. For example ' '\'lumpy\' and \'daisy\'')) - parser.add_option('-r', '--remote', dest='remote', + parser.add_option('-r', + '--remote', + dest='remote', help=('Required. Specify remote board address')) - parser.add_option('-g', '--gdb_dir', dest='gdb_dir', default='', + parser.add_option('-g', + '--gdb_dir', + dest='gdb_dir', + default='', help=('Optional. Specify gdb checkout directory.')) - parser.add_option('-c', '--chromeos_root', dest='chromeos_root', + parser.add_option('-c', + '--chromeos_root', + dest='chromeos_root', default='chromeos.live', help=('Optional. Specify chromeos checkout directory.')) - parser.add_option('--cleanup', dest='cleanup', default=None, + parser.add_option('--cleanup', + dest='cleanup', + default=None, help=('Optional. Do cleanup after the test.')) options, _ = parser.parse_args(argv) @@ -127,9 +135,8 @@ def ProcessArguments(argv): def Main(argv): opt = ProcessArguments(argv) print opt - adapter = DejagnuAdapter( - opt.board, opt.remote, opt.gdb_dir, opt.chromeos_root, - opt.cleanup) + adapter = DejagnuAdapter(opt.board, opt.remote, opt.gdb_dir, + opt.chromeos_root, opt.cleanup) try: adapter.SetupChromeOS() adapter.SetupBoard() @@ -141,6 +148,7 @@ def Main(argv): EmailResult(ret) return ret -if __name__ == '__main__': + +if __name__ == '__main__': retval = Main(sys.argv) sys.exit(retval[0]) |