aboutsummaryrefslogtreecommitdiff
path: root/dejagnu
diff options
context:
space:
mode:
authorLuis Lozano <llozano@chromium.org>2015-12-15 13:49:30 -0800
committerLuis Lozano <llozano@chromium.org>2015-12-16 17:36:06 +0000
commitf2a3ef46f75d2196a93d3ed27f4d1fcf22b54fbe (patch)
tree185d243c7eed7c7a0db6f0e640746cadc1479ea9 /dejagnu
parent2a66f70fef907c1cb15229cb58e5129cb620ac98 (diff)
downloadtoolchain-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 'dejagnu')
-rw-r--r--dejagnu/__init__.py1
-rwxr-xr-xdejagnu/gdb_dejagnu.py127
-rwxr-xr-xdejagnu/run_dejagnu.py141
3 files changed, 143 insertions, 126 deletions
diff --git a/dejagnu/__init__.py b/dejagnu/__init__.py
index e69de29b..8b137891 100644
--- a/dejagnu/__init__.py
+++ b/dejagnu/__init__.py
@@ -0,0 +1 @@
+
diff --git a/dejagnu/gdb_dejagnu.py b/dejagnu/gdb_dejagnu.py
index 1b8340b8..1192fc0b 100755
--- a/dejagnu/gdb_dejagnu.py
+++ b/dejagnu/gdb_dejagnu.py
@@ -3,7 +3,6 @@
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-
"""The gdb dejagnu test wrapper."""
import optparse
import os
@@ -21,8 +20,8 @@ from utils import misc
from run_dejagnu import TryAcquireMachine
-_VALID_TEST_RESULTS = ['FAIL', 'UNRESOLVED', 'XPASS',
- 'ERROR', 'UNSUPPORTED', 'PASS']
+_VALID_TEST_RESULTS = ['FAIL', 'UNRESOLVED', 'XPASS', 'ERROR', 'UNSUPPORTED',
+ 'PASS']
def ProcessArguments(argv):
@@ -31,9 +30,13 @@ def ProcessArguments(argv):
'Launches gdb dejagnu test in chroot for chromeos toolchain, compares '
'the test result with a repository baseline and prints out the result.'),
usage='run_dejagnu options')
- parser.add_option('-c', '--chromeos_root', dest='chromeos_root',
+ parser.add_option('-c',
+ '--chromeos_root',
+ dest='chromeos_root',
help='Required. Specify chromeos root')
- parser.add_option('-m', '--mount', dest='mount',
+ parser.add_option('-m',
+ '--mount',
+ dest='mount',
help=('Specify gdb source to mount instead of "auto". '
'Under "auto" mode, which is the default - gdb is '
'checked out and built automatically at default '
@@ -41,12 +44,18 @@ def ProcessArguments(argv):
'- the gdb_source is set to "$chromeos_'
'root/chroot/usr/local/toolchain_root/gdb", which is '
'the mount point for this option value.'))
- parser.add_option('-b', '--board', dest='board',
+ parser.add_option('-b',
+ '--board',
+ dest='board',
help=('Required. Specify board.'))
- parser.add_option('-r', '--remote', dest='remote',
+ parser.add_option('-r',
+ '--remote',
+ dest='remote',
help=('Required. Specify addresses/names of the board, '
'seperate each address/name using comma(\',\').'))
- parser.add_option('--cleanup', dest='cleanup', default=None,
+ parser.add_option('--cleanup',
+ dest='cleanup',
+ default=None,
help=('Optional. Values to this option could be '
'\'chroot\' (delete chroot) and '
'\'chromeos\' (delete the whole chromeos tree).'))
@@ -61,9 +70,9 @@ def ProcessArguments(argv):
raise Exception('Missing argument for --board.')
if options.cleanup == 'mount' and not options.mount:
raise Exception('--cleanup=\'mount\' not valid unless --mount is given.')
- if options.cleanup and not (
- options.cleanup == 'mount' or
- options.cleanup == 'chroot' or options.cleanup == 'chromeos'):
+ if options.cleanup and not (options.cleanup == 'mount' or
+ options.cleanup == 'chroot' or
+ options.cleanup == 'chromeos'):
raise Exception('Invalid option value for --cleanup')
return options
@@ -88,8 +97,7 @@ class DejagnuExecuter(object):
self._base_dir = base_dir
self._tmp_abs = None
self._cleanup = cleanup
- self._sshflag = ('-o StrictHostKeyChecking=no ' +
- '-o CheckHostIP=no ' +
+ self._sshflag = ('-o StrictHostKeyChecking=no ' + '-o CheckHostIP=no ' +
'-o UserKnownHostsFile=$(mktemp) ')
if source_dir:
@@ -101,18 +109,19 @@ class DejagnuExecuter(object):
self._mount_flag = ''
def SetupTestingDir(self):
- self._tmp_abs = tempfile.mkdtemp(prefix='dejagnu_', dir=path.join(
- self._chromeos_chroot, 'tmp'))
+ self._tmp_abs = tempfile.mkdtemp(
+ prefix='dejagnu_',
+ dir=path.join(self._chromeos_chroot, 'tmp'))
self._tmp = self._tmp_abs[len(self._chromeos_chroot):]
self._tmp_testing_rsa = path.join(self._tmp, 'testing_rsa')
self._tmp_testing_rsa_abs = path.join(self._tmp_abs, 'testing_rsa')
def PrepareTestingRsaKeys(self):
if not path.isfile(self._tmp_testing_rsa_abs):
- shutil.copy(path.join(
- self._chromeos_root,
- 'src/scripts/mod_for_test_scripts/ssh_keys/testing_rsa'),
- self._tmp_testing_rsa_abs)
+ shutil.copy(
+ path.join(self._chromeos_root,
+ 'src/scripts/mod_for_test_scripts/ssh_keys/testing_rsa'),
+ self._tmp_testing_rsa_abs)
os.chmod(self._tmp_testing_rsa_abs, stat.S_IRUSR)
def PrepareTestFiles(self):
@@ -128,7 +137,8 @@ class DejagnuExecuter(object):
'__boardname__': self._board,
'__board_hostname__': self._remote,
'__tmp_testing_rsa__': self._tmp_testing_rsa,
- '__tmp_dir__': self._tmp})
+ '__tmp_dir__': self._tmp
+ })
for pat, sub in substitutions.items():
content = content.replace(pat, sub)
@@ -146,7 +156,8 @@ class DejagnuExecuter(object):
substitutions = dict({
'__board_hostname__': self._remote,
'__tmp_testing_rsa__': self._tmp_testing_rsa,
- '__tmp_dir__': self._tmp})
+ '__tmp_dir__': self._tmp
+ })
for pat, sub in substitutions.items():
content = content.replace(pat, sub)
@@ -162,8 +173,7 @@ class DejagnuExecuter(object):
def PrepareGdbDefault(self):
ret = self._executer.ChrootRunCommandWOutput(
- self._chromeos_root,
- 'equery w cross-%s/gdb' % self._target)[1]
+ self._chromeos_root, 'equery w cross-%s/gdb' % self._target)[1]
ret = path.basename(ret.strip())
matcher = re.match(r'(.*).ebuild', ret)
@@ -172,13 +182,12 @@ class DejagnuExecuter(object):
else:
raise Exception('Failed to get gdb reversion.')
gdb_version = gdb_reversion.split('-r')[0]
- gdb_portage_dir = '/var/tmp/portage/cross-%s/%s/work' % (
- self._target, gdb_reversion)
+ gdb_portage_dir = '/var/tmp/portage/cross-%s/%s/work' % (self._target,
+ gdb_reversion)
self._gdb_source_dir = path.join(gdb_portage_dir, gdb_version)
- ret = self._executer.ChrootRunCommand(
- self._chromeos_root,
- ('sudo %s ebuild $(equery w cross-%s/gdb) clean compile' % (
+ ret = self._executer.ChrootRunCommand(self._chromeos_root, (
+ 'sudo %s ebuild $(equery w cross-%s/gdb) clean compile' % (
self._mount_flag, self._target)))
if ret:
raise Exception('ebuild gdb failed.')
@@ -189,19 +198,18 @@ class DejagnuExecuter(object):
def PrepareGdbserverDefault(self):
cmd = ('./setup_board --board {0}; '
'{1} emerge-{0} gdb'.format(self._board, self._mount_flag))
- ret = self._executer.ChrootRunCommand(
- self._chromeos_root,
- cmd, print_to_console=True)
+ ret = self._executer.ChrootRunCommand(self._chromeos_root,
+ cmd,
+ print_to_console=True)
if ret:
raise Exception('ebuild gdbserver failed.')
cmd = ('scp -i {0} {1} '
- '/build/{2}/usr/bin/gdbserver root@{3}:/usr/local/bin/'
- .format(self._tmp_testing_rsa, self._sshflag,
- self._board, self._remote))
- ret = self._executer.ChrootRunCommand(
- self._chromeos_root,
- cmd, print_to_console=True)
+ '/build/{2}/usr/bin/gdbserver root@{3}:/usr/local/bin/'.format(
+ self._tmp_testing_rsa, self._sshflag, self._board, self._remote))
+ ret = self._executer.ChrootRunCommand(self._chromeos_root,
+ cmd,
+ print_to_console=True)
if ret:
raise Exception('copy gdbserver failed.')
@@ -235,25 +243,19 @@ class DejagnuExecuter(object):
def MakeCheck(self):
cmd = ('ssh -i {0} {1} root@{2} "reboot && exit"'
- .format(self._tmp_testing_rsa, self._sshflag,
- self._remote))
- self._executer.ChrootRunCommand(
- self._chromeos_root, cmd)
+ .format(self._tmp_testing_rsa, self._sshflag, self._remote))
+ self._executer.ChrootRunCommand(self._chromeos_root, cmd)
time.sleep(40)
cmd = ('ssh -i {0} {1} root@{2} '
- '"iptables -A INPUT -p tcp --dport 1234 -j ACCEPT"'
- .format(self._tmp_testing_rsa, self._sshflag,
- self._remote))
- self._executer.ChrootRunCommand(
- self._chromeos_root, cmd)
+ '"iptables -A INPUT -p tcp --dport 1234 -j ACCEPT"'.format(
+ self._tmp_testing_rsa, self._sshflag, self._remote))
+ self._executer.ChrootRunCommand(self._chromeos_root, cmd)
cmd = ('cd %s ; '
- 'DEJAGNU=%s make check' %
- (path.join(self._gdb_source_dir, 'gdb'),
- path.join(self._tmp, 'site.exp')))
- ret = self._executer.ChrootRunCommand(
- self._chromeos_root, cmd)
+ 'DEJAGNU=%s make check' % (path.join(self._gdb_source_dir, 'gdb'),
+ path.join(self._tmp, 'site.exp')))
+ ret = self._executer.ChrootRunCommand(self._chromeos_root, cmd)
if ret:
raise Exception('Make check failed.')
@@ -265,10 +267,9 @@ class DejagnuExecuter(object):
else:
mount = '-m'
cmd = ('python {0} --chromeos_root={1} '
- '--gdb_dir={2} --board={3} {4}'
- .format(script, self._chromeos_root,
- self._source_dir, self._board,
- mount))
+ '--gdb_dir={2} --board={3} {4}'.format(script, self._chromeos_root,
+ self._source_dir, self._board,
+ mount))
rv = self._executer.RunCommand(cmd)
if rv:
raise Exception('Mount source failed.')
@@ -287,10 +288,9 @@ class DejagnuExecuter(object):
return result
def PrepareResult(self):
- test_output = os.path.join(self._gdb_source_dir, 'gdb',
- 'testsuite', 'gdb.sum')
- test_output = misc.GetOutsideChrootPath(self._chromeos_root,
- test_output)
+ test_output = os.path.join(self._gdb_source_dir, 'gdb', 'testsuite',
+ 'gdb.sum')
+ test_output = misc.GetOutsideChrootPath(self._chromeos_root, test_output)
base_output = os.path.join(self._base_dir, 'gdb_baseline', self._target)
self.test_result = self.ParseResult(test_output)
@@ -318,11 +318,9 @@ class DejagnuExecuter(object):
def Main(argv):
opts = ProcessArguments(argv)
available_machine = TryAcquireMachine(opts.remote)
- executer = DejagnuExecuter(misc.GetRoot(argv[0])[0],
- opts.mount, opts.chromeos_root,
- available_machine._name,
- opts.board,
- opts.cleanup)
+ executer = DejagnuExecuter(
+ misc.GetRoot(argv[0])[0], opts.mount, opts.chromeos_root,
+ available_machine._name, opts.board, opts.cleanup)
# Return value is a 3- or 4-element tuple
# element#1 - exit code
# element#2 - stdout
@@ -353,6 +351,7 @@ def Main(argv):
executer.Cleanup()
return ret
+
if __name__ == '__main__':
retval = Main(sys.argv)[0]
sys.exit(retval)
diff --git a/dejagnu/run_dejagnu.py b/dejagnu/run_dejagnu.py
index 5506d0c0..1aea31a7 100755
--- a/dejagnu/run_dejagnu.py
+++ b/dejagnu/run_dejagnu.py
@@ -1,7 +1,6 @@
#!/usr/bin/python
#
# Copyright 2010 Google Inc. All Rights Reserved.
-
"""Tool script for auto dejagnu."""
__author__ = 'shenhan@google.com (Han Shen)'
@@ -31,9 +30,13 @@ def ProcessArguments(argv):
'Launches gcc dejagnu test in chroot for chromeos toolchain, compares '
'the test result with a repository baseline and prints out the result.'),
usage='run_dejagnu options')
- parser.add_option('-c', '--chromeos_root', dest='chromeos_root',
+ parser.add_option('-c',
+ '--chromeos_root',
+ dest='chromeos_root',
help='Required. Specify chromeos root')
- parser.add_option('-m', '--mount', dest='mount',
+ parser.add_option('-m',
+ '--mount',
+ dest='mount',
help=('Specify gcc source to mount instead of "auto". '
'Under "auto" mode, which is the default - gcc is '
'checked out and built automatically at default '
@@ -45,25 +48,39 @@ def ProcessArguments(argv):
'"${gcc_source_dir}-build-${ctarget}". In this mode, '
'a complete gcc build must be performed in the '
'computed gcc-build-dir beforehand.'))
- parser.add_option('-b', '--board', dest='board',
+ parser.add_option('-b',
+ '--board',
+ dest='board',
help=('Required. Specify board.'))
- parser.add_option('-r', '--remote', dest='remote',
+ parser.add_option('-r',
+ '--remote',
+ dest='remote',
help=('Required. Specify addresses/names of the board, '
'seperate each address/name using comma(\',\').'))
- parser.add_option('-f', '--flags', dest='flags',
+ parser.add_option('-f',
+ '--flags',
+ dest='flags',
help='Optional. Extra run test flags to pass to dejagnu.')
- parser.add_option('-k', '--keep', dest='keep_intermediate_files',
- action='store_true', default=False,
+ parser.add_option('-k',
+ '--keep',
+ dest='keep_intermediate_files',
+ action='store_true',
+ default=False,
help=('Optional. Default to false. Do not remove dejagnu '
'intermediate files after test run.'))
- parser.add_option('--cleanup', dest='cleanup', default=None,
+ parser.add_option('--cleanup',
+ dest='cleanup',
+ default=None,
help=('Optional. Values to this option could be '
'\'mount\' (unmount gcc source and '
'directory directory, '
'only valid when --mount is given), '
'\'chroot\' (delete chroot) and '
'\'chromeos\' (delete the whole chromeos tree).'))
- parser.add_option('-t', '--tools', dest='tools', default='gcc,g++',
+ parser.add_option('-t',
+ '--tools',
+ dest='tools',
+ default='gcc,g++',
help=('Optional. Specify which tools to check, using '
'","(comma) as separator. A typical value would be '
'"g++" so that only g++ tests are performed. '
@@ -92,8 +109,8 @@ def ProcessArguments(argv):
class DejagnuExecuter(object):
"""The class wrapper for dejagnu test executer."""
- def __init__(self, base_dir, mount, chromeos_root, remote, board,
- flags, keep_intermediate_files, tools, cleanup):
+ def __init__(self, base_dir, mount, chromeos_root, remote, board, flags,
+ keep_intermediate_files, tools, cleanup):
self._l = logger.GetLogger()
self._chromeos_root = chromeos_root
self._chromeos_chroot = path.join(chromeos_root, 'chroot')
@@ -118,8 +135,9 @@ class DejagnuExecuter(object):
self._cleanup = cleanup
def SetupTestingDir(self):
- self._tmp_abs = tempfile.mkdtemp(prefix='dejagnu_', dir=path.join(
- self._chromeos_chroot, 'tmp'))
+ self._tmp_abs = tempfile.mkdtemp(
+ prefix='dejagnu_',
+ dir=path.join(self._chromeos_chroot, 'tmp'))
self._tmp = self._tmp_abs[len(self._chromeos_chroot):]
self._tmp_testing_rsa = path.join(self._tmp, 'testing_rsa')
self._tmp_testing_rsa_abs = path.join(self._tmp_abs, 'testing_rsa')
@@ -131,15 +149,15 @@ class DejagnuExecuter(object):
if self._tmp_abs and path.isdir(self._tmp_abs):
if self._keep_intermediate_files:
self._l.LogOutput(
- 'Your intermediate dejagnu files are kept, you can re-run '
- 'inside chroot the command:')
+ 'Your intermediate dejagnu files are kept, you can re-run '
+ 'inside chroot the command:')
self._l.LogOutput(
' DEJAGNU={0} make -C {1} {2} RUNTESTFLAGS="--target_board={3} {4}"' \
.format(path.join(self._tmp, 'site.exp'), self._gcc_build_dir,
self.MakeCheckString(), self._board, self._flags))
else:
- self._l.LogOutput(
- '[Cleanup] - Removing temp dir - {0}'.format(self._tmp_abs))
+ self._l.LogOutput('[Cleanup] - Removing temp dir - {0}'.format(
+ self._tmp_abs))
shutil.rmtree(self._tmp_abs)
def Cleanup(self):
@@ -158,20 +176,20 @@ class DejagnuExecuter(object):
if self._cleanup == 'chroot' or self._cleanup == 'chromeos':
self._l.LogOutput('[Cleanup]: Deleting chroot inside \'{0}\''.format(
- self._chromeos_root))
- command = "cd %s; cros_sdk --delete" % self._chromeos_root
+ self._chromeos_root))
+ command = 'cd %s; cros_sdk --delete' % self._chromeos_root
rv = self._executer.RunCommand(command)
if rv:
self._l.LogWarning('Warning - failed to delete chroot.')
# Delete .cache - crosbug.com/34956
- command = "sudo rm -fr %s" % os.path.join(self._chromeos_root, ".cache")
+ command = 'sudo rm -fr %s' % os.path.join(self._chromeos_root, '.cache')
rv = self._executer.RunCommand(command)
if rv:
self._l.LogWarning('Warning - failed to delete \'.cache\'.')
if self._cleanup == 'chromeos':
self._l.LogOutput('[Cleanup]: Deleting chromeos tree \'{0}\' ...'.format(
- self._chromeos_root))
+ self._chromeos_root))
command = 'rm -fr {0}'.format(self._chromeos_root)
rv = self._executer.RunCommand(command)
if rv:
@@ -179,10 +197,10 @@ class DejagnuExecuter(object):
def PrepareTestingRsaKeys(self):
if not path.isfile(self._tmp_testing_rsa_abs):
- shutil.copy(path.join(
- self._chromeos_root,
- 'src/scripts/mod_for_test_scripts/ssh_keys/testing_rsa'),
- self._tmp_testing_rsa_abs)
+ shutil.copy(
+ path.join(self._chromeos_root,
+ 'src/scripts/mod_for_test_scripts/ssh_keys/testing_rsa'),
+ self._tmp_testing_rsa_abs)
os.chmod(self._tmp_testing_rsa_abs, stat.S_IRUSR)
def PrepareTestFiles(self):
@@ -197,7 +215,8 @@ class DejagnuExecuter(object):
'__boardname__': self._board,
'__board_hostname__': self._remote,
'__tmp_testing_rsa__': self._tmp_testing_rsa,
- '__tmp_dir__': self._tmp})
+ '__tmp_dir__': self._tmp
+ })
for pat, sub in substitutions.items():
content = content.replace(pat, sub)
@@ -233,9 +252,9 @@ class DejagnuExecuter(object):
'sudo mkdir -p {0}'.format(self._gcc_source_dir_abs)):
raise Exception("Failed to create \'{0}\' inside chroot.".format(
self._gcc_source_dir))
- if not (path.isdir(self._gcc_source_dir_to_mount) and path.isdir(
- path.join(self._gcc_source_dir_to_mount, 'gcc'))):
- raise Exception("{0} is not a valid gcc source tree.".format(
+ if not (path.isdir(self._gcc_source_dir_to_mount) and
+ path.isdir(path.join(self._gcc_source_dir_to_mount, 'gcc'))):
+ raise Exception('{0} is not a valid gcc source tree.'.format(
self._gcc_source_dir_to_mount))
# We have these build directories -
@@ -254,7 +273,7 @@ class DejagnuExecuter(object):
self._gcc_build_dir_to_mount = '{0}-build-{1}'.format(
self._gcc_source_dir_to_mount, self._target)
self._gcc_top_build_dir_abs = path.join(self._chromeos_chroot,
- self._gcc_top_build_dir.lstrip('/'))
+ self._gcc_top_build_dir.lstrip('/'))
if not path.isdir(self._gcc_top_build_dir_abs) and \
self._executer.RunCommand(
'sudo mkdir -p {0}'.format(self._gcc_top_build_dir_abs)):
@@ -271,8 +290,7 @@ class DejagnuExecuter(object):
def PrepareGccDefault(self):
"""Auto emerging gcc for building purpose only."""
ret = self._executer.ChrootRunCommandWOutput(
- self._chromeos_root,
- 'equery w cross-%s/gcc' % self._target)[1]
+ self._chromeos_root, 'equery w cross-%s/gcc' % self._target)[1]
ret = path.basename(ret.strip())
# ret is expected to be something like 'gcc-4.6.2-r11.ebuild' or
# 'gcc-9999.ebuild' parse it.
@@ -285,19 +303,18 @@ class DejagnuExecuter(object):
else:
raise Exception('Failed to get gcc version.')
- gcc_portage_dir = '/var/tmp/portage/cross-%s/%s/work' % (
- self._target, gccrevision)
+ gcc_portage_dir = '/var/tmp/portage/cross-%s/%s/work' % (self._target,
+ gccrevision)
self._gcc_source_dir = path.join(gcc_portage_dir, gccversion)
self._gcc_top_build_dir = (gcc_portage_dir + '/%s-build-%s') % (
gccversion, self._target)
self._gcc_build_dir = path.join(self._gcc_top_build_dir, 'gcc')
- gcc_build_dir_abs = path.join(
- self._chromeos_root, 'chroot', self._gcc_build_dir.lstrip('/'))
+ gcc_build_dir_abs = path.join(self._chromeos_root, 'chroot',
+ self._gcc_build_dir.lstrip('/'))
if not path.isdir(gcc_build_dir_abs):
- ret = self._executer.ChrootRunCommand(
- self._chromeos_root,
- ('ebuild $(equery w cross-%s/gcc) clean prepare compile' % (
- self._target)))
+ ret = self._executer.ChrootRunCommand(self._chromeos_root, (
+ 'ebuild $(equery w cross-%s/gcc) clean prepare compile' % (
+ self._target)))
if ret:
raise Exception('ebuild gcc failed.')
@@ -313,11 +330,10 @@ class DejagnuExecuter(object):
validate_failures_py = path.join(
self._gcc_source_dir,
'contrib/testsuite-management/validate_failures.py')
- cmd = 'cd {0} ; {1} --build_dir={0}'.format(
- self._gcc_top_build_dir, validate_failures_py)
+ cmd = 'cd {0} ; {1} --build_dir={0}'.format(self._gcc_top_build_dir,
+ validate_failures_py)
self.MountGccSourceAndBuildDir()
- ret = self._executer.ChrootRunCommandWOutput(
- self._chromeos_root, cmd)
+ ret = self._executer.ChrootRunCommandWOutput(self._chromeos_root, cmd)
if ret[0] != 0:
self._l.LogWarning('*** validate_failures.py exited with non-zero code,'
'please run it manually inside chroot - \n'
@@ -326,12 +342,12 @@ class DejagnuExecuter(object):
# This method ensures necessary mount points before executing chroot comamnd.
def MountGccSourceAndBuildDir(self, unmount=False):
- mount_points = [tc_enter_chroot.MountPoint(
- self._gcc_source_dir_to_mount, self._gcc_source_dir_abs,
- getpass.getuser(), "ro"),
- tc_enter_chroot.MountPoint(
- self._gcc_build_dir_to_mount, self._gcc_top_build_dir_abs,
- getpass.getuser(), "rw"),]
+ mount_points = [tc_enter_chroot.MountPoint(self._gcc_source_dir_to_mount,
+ self._gcc_source_dir_abs,
+ getpass.getuser(), 'ro'),
+ tc_enter_chroot.MountPoint(self._gcc_build_dir_to_mount,
+ self._gcc_top_build_dir_abs,
+ getpass.getuser(), 'rw')]
for mp in mount_points:
if unmount:
if mp.UnMount():
@@ -339,13 +355,14 @@ class DejagnuExecuter(object):
else:
self._l.LogOutput('{0} unmounted successfully.'.format(mp.mount_dir))
elif mp.DoMount():
- raise Exception('Failed to mount {0} onto {1}'.format(
- mp.external_dir, mp.mount_dir))
+ raise Exception('Failed to mount {0} onto {1}'.format(mp.external_dir,
+ mp.mount_dir))
else:
self._l.LogOutput('{0} mounted successfully.'.format(mp.mount_dir))
# The end of class DejagnuExecuter
+
def TryAcquireMachine(remotes):
available_machine = None
for r in remotes.split(','):
@@ -355,21 +372,20 @@ def TryAcquireMachine(remotes):
break
else:
logger.GetLogger().LogWarning(
- '*** Failed to lock machine \'{0}\'.'.format(r))
+ '*** Failed to lock machine \'{0}\'.'.format(r))
if not available_machine:
- raise Exception(
- "Failed to acquire one machine from \'{0}\'.".format(remotes))
+ raise Exception("Failed to acquire one machine from \'{0}\'.".format(
+ remotes))
return available_machine
+
def Main(argv):
opts = ProcessArguments(argv)
available_machine = TryAcquireMachine(opts.remote)
- executer = DejagnuExecuter(misc.GetRoot(argv[0])[0],
- opts.mount, opts.chromeos_root,
- available_machine._name,
- opts.board, opts.flags,
- opts.keep_intermediate_files, opts.tools,
- opts.cleanup)
+ executer = DejagnuExecuter(
+ misc.GetRoot(argv[0])[0], opts.mount, opts.chromeos_root,
+ available_machine._name, opts.board, opts.flags,
+ opts.keep_intermediate_files, opts.tools, opts.cleanup)
# Return value is a 3- or 4-element tuple
# element#1 - exit code
# element#2 - stdout
@@ -395,6 +411,7 @@ def Main(argv):
executer.Cleanup()
return ret
+
if __name__ == '__main__':
retval = Main(sys.argv)[0]
sys.exit(retval)