aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbinary_search_tool/binary_search_state.py2
-rw-r--r--cros_utils/file_utils.py2
-rw-r--r--cros_utils/manifest_versions.py4
-rw-r--r--cros_utils/misc.py6
-rw-r--r--crosperf/benchmark.py2
-rw-r--r--crosperf/benchmark_run.py4
-rwxr-xr-xcrosperf/benchmark_run_unittest.py2
-rw-r--r--crosperf/experiment_file.py10
-rw-r--r--crosperf/field.py4
-rw-r--r--crosperf/image_checksummer.py10
-rw-r--r--crosperf/label.py14
-rw-r--r--crosperf/machine_manager.py2
-rwxr-xr-xcrosperf/machine_manager_unittest.py2
-rw-r--r--crosperf/results_cache.py19
-rw-r--r--crosperf/settings.py16
-rw-r--r--crosperf/settings_factory.py2
-rwxr-xr-xdejagnu/gdb_dejagnu.py24
-rwxr-xr-xdejagnu/run_dejagnu.py35
-rwxr-xr-xfdo_scripts/profile_cycler.py2
-rw-r--r--fdo_scripts/summarize_hot_blocks.py4
-rw-r--r--fdo_scripts/vanilla_vs_fdo.py14
-rwxr-xr-ximage_chromeos.py6
-rwxr-xr-xremote_gcc_build.py6
-rwxr-xr-xrepo_to_repo.py2
-rwxr-xr-xtest_gcc_dejagnu.py12
-rwxr-xr-xtest_gdb_dejagnu.py8
26 files changed, 108 insertions, 106 deletions
diff --git a/binary_search_tool/binary_search_state.py b/binary_search_tool/binary_search_state.py
index a797b492..db8b3d06 100755
--- a/binary_search_tool/binary_search_state.py
+++ b/binary_search_tool/binary_search_state.py
@@ -357,7 +357,7 @@ class BinarySearchState(object):
bss.resumed = True
binary_search_perforce.verbose = bss.verbose
return bss
- except Exception:
+ except StandardError:
return None
def RemoveState(self):
diff --git a/cros_utils/file_utils.py b/cros_utils/file_utils.py
index b7aad7b3..777e6251 100644
--- a/cros_utils/file_utils.py
+++ b/cros_utils/file_utils.py
@@ -32,7 +32,7 @@ class FileUtils(object):
ce = command_executer.GetCommandExecuter(log_level=log_level)
ret, out, _ = ce.RunCommandWOutput(command)
if ret:
- raise Exception('Could not run md5sum on: %s' % filename)
+ raise RuntimeError('Could not run md5sum on: %s' % filename)
return out.strip().split()[0]
diff --git a/cros_utils/manifest_versions.py b/cros_utils/manifest_versions.py
index f011282b..52fd700f 100644
--- a/cros_utils/manifest_versions.py
+++ b/cros_utils/manifest_versions.py
@@ -92,6 +92,6 @@ class ManifestVersions(object):
command = 'cp {0} {1}'.format(files[0], to_file)
ret = self.ce.RunCommand(command)
if ret:
- raise Exception('Cannot copy manifest to {0}'.format(to_file))
+ raise RuntimeError('Cannot copy manifest to {0}'.format(to_file))
else:
- raise Exception('Version {0} is not available.'.format(version))
+ raise RuntimeError('Version {0} is not available.'.format(version))
diff --git a/cros_utils/misc.py b/cros_utils/misc.py
index ae234fe3..79a56585 100644
--- a/cros_utils/misc.py
+++ b/cros_utils/misc.py
@@ -62,7 +62,7 @@ def UnitToNumber(unit_num, base=1000):
for k, v in unit_dict.items():
if k.startswith(unit):
return float(number) * v
- raise Exception('Unit: %s not found in byte: %s!' % (unit, unit_num))
+ raise RuntimeError('Unit: %s not found in byte: %s!' % (unit, unit_num))
def GetFilenameFromString(string):
@@ -86,8 +86,8 @@ def GetChrootPath(chromeos_root):
def GetInsideChrootPath(chromeos_root, file_path):
if not file_path.startswith(GetChrootPath(chromeos_root)):
- raise Exception("File: %s doesn't seem to be in the chroot: %s" %
- (file_path, chromeos_root))
+ raise RuntimeError("File: %s doesn't seem to be in the chroot: %s" %
+ (file_path, chromeos_root))
return file_path[len(GetChrootPath(chromeos_root)):]
diff --git a/crosperf/benchmark.py b/crosperf/benchmark.py
index 9557c675..a2a34bca 100644
--- a/crosperf/benchmark.py
+++ b/crosperf/benchmark.py
@@ -41,5 +41,5 @@ class Benchmark(object):
if self.suite == 'telemetry':
self.show_all_results = True
if run_local and self.suite != 'telemetry_Crosperf':
- raise Exception('run_local is only supported by telemetry_Crosperf.')
+ raise RuntimeError('run_local is only supported by telemetry_Crosperf.')
self.run_local = run_local
diff --git a/crosperf/benchmark_run.py b/crosperf/benchmark_run.py
index 5d161417..d2a6f7d9 100644
--- a/crosperf/benchmark_run.py
+++ b/crosperf/benchmark_run.py
@@ -163,7 +163,7 @@ class BenchmarkRun(threading.Thread):
while True:
machine = None
if self.terminated:
- raise Exception('Thread terminated while trying to acquire machine.')
+ raise RuntimeError('Thread terminated while trying to acquire machine.')
machine = self.machine_manager.AcquireMachine(self.label)
@@ -191,7 +191,7 @@ class BenchmarkRun(threading.Thread):
perf_args_list = [perf_args_list[0]] + ['-a'] + perf_args_list[1:]
perf_args = ' '.join(perf_args_list)
if not perf_args_list[0] in ['record', 'stat']:
- raise Exception('perf_args must start with either record or stat')
+ raise SyntaxError('perf_args must start with either record or stat')
extra_test_args = ['--profiler=custom_perf',
("--profiler_args='perf_options=\"%s\"'" % perf_args)]
return ' '.join(extra_test_args)
diff --git a/crosperf/benchmark_run_unittest.py b/crosperf/benchmark_run_unittest.py
index d3a3dbc9..90270ded 100755
--- a/crosperf/benchmark_run_unittest.py
+++ b/crosperf/benchmark_run_unittest.py
@@ -146,7 +146,7 @@ class BenchmarkRunTest(unittest.TestCase):
def FakeReadCacheException():
'Helper function for test_run.'
- raise Exception('This is an exception test; it is supposed to happen')
+ raise RuntimeError('This is an exception test; it is supposed to happen')
def FakeAcquireMachine():
'Helper function for test_run.'
diff --git a/crosperf/experiment_file.py b/crosperf/experiment_file.py
index 7967855b..21e2e547 100644
--- a/crosperf/experiment_file.py
+++ b/crosperf/experiment_file.py
@@ -99,7 +99,7 @@ class ExperimentFile(object):
elif ExperimentFile._CLOSE_SETTINGS_RE.match(line):
return settings
- raise Exception('Unexpected EOF while parsing settings block.')
+ raise EOFError('Unexpected EOF while parsing settings block.')
def _Parse(self, experiment_file):
"""Parse experiment file and create settings."""
@@ -114,7 +114,7 @@ class ExperimentFile(object):
elif ExperimentFile._OPEN_SETTINGS_RE.match(line):
new_settings = self._ParseSettings(reader)
if new_settings.name in settings_names:
- raise Exception("Duplicate settings name: '%s'." %
+ raise SyntaxError("Duplicate settings name: '%s'." %
new_settings.name)
settings_names[new_settings.name] = True
self.all_settings.append(new_settings)
@@ -122,10 +122,10 @@ class ExperimentFile(object):
field = self._ParseField(reader)
self.global_settings.SetField(field[0], field[1], field[2])
else:
- raise Exception('Unexpected line.')
+ raise IOError('Unexpected line.')
except Exception, err:
- raise Exception('Line %d: %s\n==> %s' % (reader.LineNo(), str(err),
- reader.CurrentLine(False)))
+ raise RuntimeError('Line %d: %s\n==> %s' % (reader.LineNo(), str(err),
+ reader.CurrentLine(False)))
def Canonicalize(self):
"""Convert parsed experiment file back into an experiment file."""
diff --git a/crosperf/field.py b/crosperf/field.py
index e25ffe30..bc92e2cc 100644
--- a/crosperf/field.py
+++ b/crosperf/field.py
@@ -68,7 +68,7 @@ class BooleanField(Field):
return True
elif value.lower() == 'false':
return False
- raise Exception("Invalid value for '%s'. Must be true or false." %
+ raise TypeError("Invalid value for '%s'. Must be true or false." %
self.name)
@@ -147,6 +147,6 @@ class EnumField(Field):
def _Parse(self, value):
if value not in self.options:
- raise Exception("Invalid enum value for field '%s'. Must be one of (%s)" %
+ raise TypeError("Invalid enum value for field '%s'. Must be one of (%s)" %
(self.name, ', '.join(self.options)))
return str(value)
diff --git a/crosperf/image_checksummer.py b/crosperf/image_checksummer.py
index 3571ad95..6ba9a180 100644
--- a/crosperf/image_checksummer.py
+++ b/crosperf/image_checksummer.py
@@ -25,7 +25,7 @@ class ImageChecksummer(object):
self.label.name)
self._checksum = None
if self.label.image_type != 'local':
- raise Exception('Called Checksum on non-local image!')
+ raise RuntimeError('Called Checksum on non-local image!')
if self.label.chromeos_image:
if os.path.exists(self.label.chromeos_image):
self._checksum = FileUtils().Md5File(self.label.chromeos_image,
@@ -33,7 +33,7 @@ class ImageChecksummer(object):
logger.GetLogger().LogOutput('Computed checksum is '
': %s' % self._checksum)
if not self._checksum:
- raise Exception('Checksum computing error.')
+ raise RuntimeError('Checksum computing error.')
logger.GetLogger().LogOutput('Checksum is: %s' % self._checksum)
return self._checksum
@@ -50,7 +50,7 @@ class ImageChecksummer(object):
def Checksum(self, label, log_level):
if label.image_type != 'local':
- raise Exception('Attempt to call Checksum on non-local image.')
+ raise RuntimeError('Attempt to call Checksum on non-local image.')
with self._lock:
if label.name not in self._per_image_checksummers:
self._per_image_checksummers[label.name] = (
@@ -59,7 +59,7 @@ class ImageChecksummer(object):
try:
return checksummer.Checksum()
- except Exception, e:
+ except:
logger.GetLogger().LogError('Could not compute checksum of image in label'
" '%s'." % label.name)
- raise e
+ raise
diff --git a/crosperf/label.py b/crosperf/label.py
index b9fc9330..3326efa7 100644
--- a/crosperf/label.py
+++ b/crosperf/label.py
@@ -51,14 +51,14 @@ class Label(object):
if self.image_type == 'local':
chromeos_root = FileUtils().ChromeOSRootFromImage(chromeos_image)
if not chromeos_root:
- raise Exception("No ChromeOS root given for label '%s' and could not "
- "determine one from image path: '%s'." %
- (name, chromeos_image))
+ raise RuntimeError("No ChromeOS root given for label '%s' and could "
+ "not determine one from image path: '%s'." %
+ (name, chromeos_image))
else:
chromeos_root = FileUtils().CanonicalizeChromeOSRoot(chromeos_root)
if not chromeos_root:
- raise Exception("Invalid ChromeOS root given for label '%s': '%s'." %
- (name, chromeos_root))
+ raise RuntimeError("Invalid ChromeOS root given for label '%s': '%s'." %
+ (name, chromeos_root))
self.chromeos_root = chromeos_root
if not chrome_src:
@@ -70,8 +70,8 @@ class Label(object):
else:
chromeos_src = misc.CanonicalizePath(chrome_src)
if not chromeos_src:
- raise Exception("Invalid Chrome src given for label '%s': '%s'." %
- (name, chrome_src))
+ raise RuntimeError("Invalid Chrome src given for label '%s': '%s'." %
+ (name, chrome_src))
self.chrome_src = chromeos_src
self._SetupChecksum()
diff --git a/crosperf/machine_manager.py b/crosperf/machine_manager.py
index a9b2a169..0ee17c53 100644
--- a/crosperf/machine_manager.py
+++ b/crosperf/machine_manager.py
@@ -297,7 +297,7 @@ class MachineManager(object):
' '.join(image_chromeos_args))
retval = image_chromeos.DoImage(image_chromeos_args)
if retval:
- raise Exception("Could not image machine: '%s'." % machine.name)
+ raise RuntimeError("Could not image machine: '%s'." % machine.name)
else:
self.num_reimages += 1
machine.checksum = checksum
diff --git a/crosperf/machine_manager_unittest.py b/crosperf/machine_manager_unittest.py
index 321b5878..ccf2cd1e 100755
--- a/crosperf/machine_manager_unittest.py
+++ b/crosperf/machine_manager_unittest.py
@@ -194,7 +194,7 @@ class MachineManagerTest(unittest.TestCase):
mock_run_cmd.return_value = 1
try:
self.mm.ImageMachine(machine, LABEL_LUMPY)
- except Exception:
+ except RuntimeError:
self.assertEqual(mock_checksummer.call_count, 0)
self.assertEqual(mock_run_cmd.call_count, 2)
self.assertEqual(mock_run_croscmd.call_count, 1)
diff --git a/crosperf/results_cache.py b/crosperf/results_cache.py
index 3296fe1a..8bd23181 100644
--- a/crosperf/results_cache.py
+++ b/crosperf/results_cache.py
@@ -74,7 +74,7 @@ class Result(object):
file_index)))
ret = self.ce.CopyFiles(file_to_copy, dest_file, recursive=False)
if ret:
- raise Exception('Could not copy results file: %s' % file_to_copy)
+ raise IOError('Could not copy results file: %s' % file_to_copy)
def CopyResultsTo(self, dest_dir):
self.CopyFilesTo(dest_dir, self.perf_data_files)
@@ -188,7 +188,7 @@ class Result(object):
if mo:
result = mo.group(1)
return result
- raise Exception('Could not find results directory.')
+ raise RuntimeError('Could not find results directory.')
def FindFilesInResultsDir(self, find_args):
if not self.results_dir:
@@ -197,7 +197,7 @@ class Result(object):
command = 'find %s %s' % (self.results_dir, find_args)
ret, out, _ = self.ce.RunCommandWOutput(command, print_to_console=False)
if ret:
- raise Exception('Could not run find command!')
+ raise RuntimeError('Could not run find command!')
return out
def GetResultsFile(self):
@@ -225,8 +225,8 @@ class Result(object):
perf_data_file)
perf_report_file = '%s.report' % perf_data_file
if os.path.exists(perf_report_file):
- raise Exception('Perf report file already exists: %s' %
- perf_report_file)
+ raise RuntimeError('Perf report file already exists: %s' %
+ perf_report_file)
chroot_perf_report_file = misc.GetInsideChrootPath(self.chromeos_root,
perf_report_file)
perf_path = os.path.join(self.chromeos_root, 'chroot', 'usr/bin/perf')
@@ -367,7 +367,7 @@ class Result(object):
(self.temp_dir, os.path.join(cache_dir, AUTOTEST_TARBALL)))
ret = self.ce.RunCommand(command, print_to_console=False)
if ret:
- raise Exception('Could not untar cached tarball')
+ raise RuntimeError('Could not untar cached tarball')
self.results_dir = self.temp_dir
self.perf_data_files = self.GetPerfDataFiles()
self.perf_report_files = self.GetPerfReportFiles()
@@ -414,7 +414,7 @@ class Result(object):
'-cjf %s .' % (self.results_dir, tarball))
ret = self.ce.RunCommand(command)
if ret:
- raise Exception("Couldn't store autotest output directory.")
+ raise RuntimeError("Couldn't store autotest output directory.")
# Store machine info.
# TODO(asharif): Make machine_manager a singleton, and don't pass it into
# this function.
@@ -432,7 +432,8 @@ class Result(object):
if ret:
command = 'rm -rf {0}'.format(temp_dir)
self.ce.RunCommand(command)
- raise Exception('Could not move dir %s to dir %s' % (temp_dir, cache_dir))
+ raise RuntimeError('Could not move dir %s to dir %s' %
+ (temp_dir, cache_dir))
@classmethod
def CreateFromRun(cls,
@@ -468,7 +469,7 @@ class Result(object):
try:
result.PopulateFromCacheDir(cache_dir, test, suite)
- except Exception as e:
+ except RuntimeError as e:
logger.LogError('Exception while using cache: %s' % e)
return None
return result
diff --git a/crosperf/settings.py b/crosperf/settings.py
index 0722eb97..ad5ed622 100644
--- a/crosperf/settings.py
+++ b/crosperf/settings.py
@@ -24,13 +24,13 @@ class Settings(object):
def AddField(self, field):
name = field.name
if name in self.fields:
- raise Exception('Field %s defined previously.' % name)
+ raise SyntaxError('Field %s defined previously.' % name)
self.fields[name] = field
def SetField(self, name, value, append=False):
if name not in self.fields:
- raise Exception("'%s' is not a valid field in '%s' settings" %
- (name, self.settings_type))
+ raise SyntaxError("'%s' is not a valid field in '%s' settings" %
+ (name, self.settings_type))
if append:
self.fields[name].Append(value)
else:
@@ -39,12 +39,12 @@ class Settings(object):
def GetField(self, name):
"""Get the value of a field with a given name."""
if name not in self.fields:
- raise Exception("Field '%s' not a valid field in '%s' settings." %
- (name, self.name))
+ raise SyntaxError("Field '%s' not a valid field in '%s' settings." %
+ (name, self.name))
field = self.fields[name]
if not field.assigned and field.required:
- raise Exception("Required field '%s' not defined in '%s' settings." %
- (name, self.name))
+ raise SyntaxError("Required field '%s' not defined in '%s' settings." %
+ (name, self.name))
return self.fields[name].Get()
def Inherit(self):
@@ -64,7 +64,7 @@ class Settings(object):
"""Check that all required fields have been set."""
for name in self.fields:
if not self.fields[name].assigned and self.fields[name].required:
- raise Exception('Field %s is invalid.' % name)
+ raise SyntaxError('Field %s is invalid.' % name)
def GetXbuddyPath(self, path_str, board, chromeos_root, log_level):
prefix = 'remote'
diff --git a/crosperf/settings_factory.py b/crosperf/settings_factory.py
index 8e8bb5e8..372c7ff3 100644
--- a/crosperf/settings_factory.py
+++ b/crosperf/settings_factory.py
@@ -223,4 +223,4 @@ class SettingsFactory(object):
if settings_type == 'benchmark':
return BenchmarkSettings(name)
- raise Exception("Invalid settings type: '%s'." % settings_type)
+ raise TypeError("Invalid settings type: '%s'." % settings_type)
diff --git a/dejagnu/gdb_dejagnu.py b/dejagnu/gdb_dejagnu.py
index b6dcd6ac..c01d909b 100755
--- a/dejagnu/gdb_dejagnu.py
+++ b/dejagnu/gdb_dejagnu.py
@@ -63,17 +63,17 @@ def ProcessArguments(argv):
options, args = parser.parse_args(argv)
if not options.chromeos_root:
- raise Exception('Missing argument for --chromeos_root.')
+ raise SyntaxError('Missing argument for --chromeos_root.')
if not options.remote:
- raise Exception('Missing argument for --remote.')
+ raise SyntaxError('Missing argument for --remote.')
if not options.board:
- raise Exception('Missing argument for --board.')
+ raise SyntaxError('Missing argument for --board.')
if options.cleanup == 'mount' and not options.mount:
- raise Exception('--cleanup=\'mount\' not valid unless --mount is given.')
+ raise SyntaxError('--cleanup=\'mount\' not valid unless --mount is given.')
if options.cleanup and not (options.cleanup == 'mount' or
options.cleanup == 'chroot' or
options.cleanup == 'chromeos'):
- raise Exception('Invalid option value for --cleanup')
+ raise SyntaxError('Invalid option value for --cleanup')
return options
@@ -92,7 +92,7 @@ class DejagnuExecuter(object):
## Compute target from board
self._target = misc.GetCtargetFromBoard(board, chromeos_root)
if not self._target:
- raise Exception('Unsupported board "%s"' % board)
+ raise RuntimeError('Unsupported board "%s"' % board)
self._executer = command_executer.GetCommandExecuter()
self._base_dir = base_dir
self._tmp_abs = None
@@ -180,7 +180,7 @@ class DejagnuExecuter(object):
if matcher:
gdb_reversion = matcher.group(1)
else:
- raise Exception('Failed to get gdb reversion.')
+ raise RuntimeError('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)
@@ -190,7 +190,7 @@ class DejagnuExecuter(object):
'sudo %s ebuild $(equery w cross-%s/gdb) clean compile' % (
self._mount_flag, self._target)))
if ret:
- raise Exception('ebuild gdb failed.')
+ raise RuntimeError('ebuild gdb failed.')
def PrepareGdbserver(self):
self.PrepareGdbserverDefault()
@@ -202,7 +202,7 @@ class DejagnuExecuter(object):
cmd,
print_to_console=True)
if ret:
- raise Exception('ebuild gdbserver failed.')
+ raise RuntimeError('ebuild gdbserver failed.')
cmd = ('scp -i {0} {1} '
'/build/{2}/usr/bin/gdbserver root@{3}:/usr/local/bin/'.format(
@@ -211,7 +211,7 @@ class DejagnuExecuter(object):
cmd,
print_to_console=True)
if ret:
- raise Exception('copy gdbserver failed.')
+ raise RuntimeError('copy gdbserver failed.')
if self._mount_flag:
self.MountSource(unmount=False)
@@ -257,7 +257,7 @@ class DejagnuExecuter(object):
path.join(self._tmp, 'site.exp')))
ret = self._executer.ChrootRunCommand(self._chromeos_root, cmd)
if ret:
- raise Exception('Make check failed.')
+ raise RuntimeError('Make check failed.')
# This method ensures necessary mount points before executing chroot comamnd.
def MountSource(self, unmount=False):
@@ -272,7 +272,7 @@ class DejagnuExecuter(object):
mount))
rv = self._executer.RunCommand(cmd)
if rv:
- raise Exception('Mount source failed.')
+ raise RuntimeError('Mount source failed.')
def ResultValidate(self):
self.PrepareResult()
diff --git a/dejagnu/run_dejagnu.py b/dejagnu/run_dejagnu.py
index b0f52c1c..b4cbc8f4 100755
--- a/dejagnu/run_dejagnu.py
+++ b/dejagnu/run_dejagnu.py
@@ -89,19 +89,19 @@ def ProcessArguments(argv):
options, args = parser.parse_args(argv)
if not options.chromeos_root:
- raise Exception('Missing argument for --chromeos_root.')
+ raise SyntaxError('Missing argument for --chromeos_root.')
if not options.remote:
- raise Exception('Missing argument for --remote.')
+ raise SyntaxError('Missing argument for --remote.')
if not options.board:
- raise Exception('Missing argument for --board.')
+ raise SyntaxError('Missing argument for --board.')
if options.cleanup == 'mount' and not options.mount:
- raise Exception('--cleanup=\'mount\' not valid unless --mount is given.')
+ raise SyntaxError('--cleanup=\'mount\' not valid unless --mount is given.')
if options.cleanup and not (
options.cleanup == 'mount' or \
options.cleanup == 'chroot' or options.cleanup == 'chromeos'):
- raise Exception('Invalid option value for --cleanup')
+ raise ValueError('Invalid option value for --cleanup')
if options.cleanup and options.keep_intermediate_files:
- raise Exception('Only one of --keep and --cleanup could be given.')
+ raise SyntaxError('Only one of --keep and --cleanup could be given.')
return options
@@ -125,7 +125,7 @@ class DejagnuExecuter(object):
## Compute target from board
self._target = misc.GetCtargetFromBoard(board, chromeos_root)
if not self._target:
- raise Exception('Unsupported board "%s"' % board)
+ raise ValueError('Unsupported board "%s"' % board)
self._executer = command_executer.GetCommandExecuter()
self._flags = flags or ''
self._base_dir = base_dir
@@ -250,11 +250,11 @@ class DejagnuExecuter(object):
if not path.isdir(self._gcc_source_dir_abs) and \
self._executer.RunCommand(
'sudo mkdir -p {0}'.format(self._gcc_source_dir_abs)):
- raise Exception("Failed to create \'{0}\' inside chroot.".format(
+ raise RuntimeError("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(
+ raise RuntimeError('{0} is not a valid gcc source tree.'.format(
self._gcc_source_dir_to_mount))
# We have these build directories -
@@ -277,11 +277,11 @@ class DejagnuExecuter(object):
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)):
- raise Exception('Failed to create \'{0}\' inside chroot.'.format(
+ raise RuntimeError('Failed to create \'{0}\' inside chroot.'.format(
self._gcc_top_build_dir))
if not (path.isdir(self._gcc_build_dir_to_mount) and path.join(
self._gcc_build_dir_to_mount, 'gcc')):
- raise Exception('{0} is not a valid gcc build tree.'.format(
+ raise RuntimeError('{0} is not a valid gcc build tree.'.format(
self._gcc_build_dir_to_mount))
# All check passed. Now mount gcc source and build directories.
@@ -301,7 +301,7 @@ class DejagnuExecuter(object):
gccrevision = 'gcc-9999'
gccversion = 'gcc-9999'
else:
- raise Exception('Failed to get gcc version.')
+ raise RuntimeError('Failed to get gcc version.')
gcc_portage_dir = '/var/tmp/portage/cross-%s/%s/work' % (self._target,
gccrevision)
@@ -316,7 +316,7 @@ class DejagnuExecuter(object):
'ebuild $(equery w cross-%s/gcc) clean prepare compile' % (
self._target)))
if ret:
- raise Exception('ebuild gcc failed.')
+ raise RuntimeError('ebuild gcc failed.')
def MakeCheck(self):
self.MountGccSourceAndBuildDir()
@@ -351,12 +351,13 @@ class DejagnuExecuter(object):
for mp in mount_points:
if unmount:
if mp.UnMount():
- raise Exception('Failed to unmount {0}'.format(mp.mount_dir))
+ raise RuntimeError('Failed to unmount {0}'.format(mp.mount_dir))
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 RuntimeError(
+ 'Failed to mount {0} onto {1}'.format(mp.external_dir,
+ mp.mount_dir))
else:
self._l.LogOutput('{0} mounted successfully.'.format(mp.mount_dir))
@@ -374,7 +375,7 @@ def TryAcquireMachine(remotes):
logger.GetLogger().LogWarning(
'*** Failed to lock machine \'{0}\'.'.format(r))
if not available_machine:
- raise Exception("Failed to acquire one machine from \'{0}\'.".format(
+ raise RuntimeError("Failed to acquire one machine from \'{0}\'.".format(
remotes))
return available_machine
diff --git a/fdo_scripts/profile_cycler.py b/fdo_scripts/profile_cycler.py
index 738535f5..7715612f 100755
--- a/fdo_scripts/profile_cycler.py
+++ b/fdo_scripts/profile_cycler.py
@@ -43,7 +43,7 @@ class CyclerProfiler:
'chrome-src-internal', 'src', 'data',
'page_cycler')
if not os.path.isdir(page_cycler_dir):
- raise Exception('Page cycler dir %s not found!' % page_cycler_dir)
+ raise RuntimeError('Page cycler dir %s not found!' % page_cycler_dir)
self._ce.CopyFiles(page_cycler_dir,
os.path.join(self.REMOTE_TMP_DIR, 'page_cycler'),
dest_machine=self._remote,
diff --git a/fdo_scripts/summarize_hot_blocks.py b/fdo_scripts/summarize_hot_blocks.py
index 6cf4164e..20c07fa4 100644
--- a/fdo_scripts/summarize_hot_blocks.py
+++ b/fdo_scripts/summarize_hot_blocks.py
@@ -74,7 +74,7 @@ class Collector(object):
os.path.join(self._tempdir, list_file)))
ret = self._ce.RunCommand(command)
if ret:
- raise Exception('Failed: %s' % command)
+ raise RuntimeError('Failed: %s' % command)
def SummarizeLines(self, data_file):
sum_lines = []
@@ -128,7 +128,7 @@ class Collector(object):
ret = self._ce.RunCommand(merge_command)
if ret:
- raise Exception('Failed: %s' % merge_command)
+ raise RuntimeError('Failed: %s' % merge_command)
print 'Generated general summary: ', summary_file
def SummarizePreOptimized(self, summary_file):
diff --git a/fdo_scripts/vanilla_vs_fdo.py b/fdo_scripts/vanilla_vs_fdo.py
index 66e15ce2..6f42839d 100644
--- a/fdo_scripts/vanilla_vs_fdo.py
+++ b/fdo_scripts/vanilla_vs_fdo.py
@@ -30,10 +30,10 @@ class Patcher(object):
full_args = '%s --dry-run' % args
ret = self._RunPatchCommand(full_args)
if ret:
- raise Exception('Patch dry run failed!')
+ raise RuntimeError('Patch dry run failed!')
ret = self._RunPatchCommand(args)
if ret:
- raise Exception('Patch application failed!')
+ raise RuntimeError('Patch application failed!')
def __enter__(self):
self._ApplyPatch('')
@@ -75,11 +75,11 @@ class FDOComparator(object):
command = misc.GetSetupBoardCommand(self._board, usepkg=True)
ret = self._ce.ChrootRunCommand(self._chromeos_root, command)
if ret:
- raise Exception("Couldn't run setup_board!")
+ raise RuntimeError("Couldn't run setup_board!")
command = misc.GetBuildPackagesCommand(self._board, True)
ret = self._ce.ChrootRunCommand(self._chromeos_root, command)
if ret:
- raise Exception("Couldn't run build_packages!")
+ raise RuntimeError("Couldn't run build_packages!")
def _ReportMismatches(self, build_log):
mismatch_signature = '-Wcoverage-mismatch'
@@ -123,7 +123,7 @@ class FDOComparator(object):
self._ReportMismatches(out)
if ret:
- raise Exception("Couldn't build chrome browser!")
+ raise RuntimeError("Couldn't build chrome browser!")
misc.LabelLatestImage(self._chromeos_root, self._board, label)
return label
@@ -160,7 +160,7 @@ class FDOComparator(object):
command = '%s %s' % (crosperf, experiment_file)
ret = self._ce.RunCommand(command)
if ret:
- raise Exception("Couldn't run crosperf!")
+ raise RuntimeError("Couldn't run crosperf!")
def _ImageRemote(self, label):
image_path = os.path.join(
@@ -182,7 +182,7 @@ class FDOComparator(object):
command = 'python %s %s' % (profile_cycler, ' '.join(profile_cycler_args))
ret = self._ce.RunCommand(command)
if ret:
- raise Exception("Couldn't profile cycler!")
+ raise RuntimeError("Couldn't profile cycler!")
def _BuildGenerateImage(self):
# TODO(asharif): add cflags as well.
diff --git a/image_chromeos.py b/image_chromeos.py
index f28998dc..d95434a7 100755
--- a/image_chromeos.py
+++ b/image_chromeos.py
@@ -138,7 +138,7 @@ def DoImage(argv):
list(options.remote.split()), options.chromeos_root)
should_unlock = True
except Exception as e:
- raise Exception('Error acquiring machine: %s' % str(e))
+ raise RuntimeError('Error acquiring machine: %s' % str(e))
reimage = False
local_image = False
@@ -191,8 +191,8 @@ def DoImage(argv):
if local_image:
if located_image.find(real_src_dir) != 0:
if located_image.find(real_chroot_dir) != 0:
- raise Exception('Located image: %s not in chromeos_root: %s' %
- (located_image, options.chromeos_root))
+ raise RuntimeError('Located image: %s not in chromeos_root: %s' %
+ (located_image, options.chromeos_root))
else:
chroot_image = located_image[len(real_chroot_dir):]
else:
diff --git a/remote_gcc_build.py b/remote_gcc_build.py
index 37285645..52cedfbc 100755
--- a/remote_gcc_build.py
+++ b/remote_gcc_build.py
@@ -197,7 +197,7 @@ def UploadManifest(manifest, chromeos_root, branch='master'):
command = 'git checkout -b {0} -t cros-internal/{1}'.format(BRANCH, branch)
ret = ce.RunCommand(command)
if ret:
- raise Exception('Command {0} failed'.format(command))
+ raise RuntimeError('Command {0} failed'.format(command))
# We remove the default.xml, which is the symbolic link of full.xml.
# After that, we copy our xml file to default.xml.
@@ -399,8 +399,8 @@ def Main(argv):
patch = []
chromeos_root = misc.CanonicalizePath(args.chromeos_root)
if args.chromeos_version and args.branch:
- raise Exception('You can not set chromeos_version and branch at the '
- 'same time.')
+ raise RuntimeError('You can not set chromeos_version and branch at the '
+ 'same time.')
manifests = None
if args.branch:
diff --git a/repo_to_repo.py b/repo_to_repo.py
index 77820529..3b3b9bc4 100755
--- a/repo_to_repo.py
+++ b/repo_to_repo.py
@@ -255,7 +255,7 @@ class GitRepo(Repo):
elif commit_message:
message_arg = '-m \'%s\'' % commit_message
else:
- raise Exception('No commit message given!')
+ raise RuntimeError('No commit message given!')
command += '&& git commit -v %s' % message_arg
return self._ce.RunCommand(command)
diff --git a/test_gcc_dejagnu.py b/test_gcc_dejagnu.py
index 37640710..41304a03 100755
--- a/test_gcc_dejagnu.py
+++ b/test_gcc_dejagnu.py
@@ -45,12 +45,12 @@ class DejagnuAdapter(object):
'--minilayout', '--jobs=8']
ret = setup_chromeos.Main(cmd)
if ret:
- raise Exception('Failed to checkout chromeos')
+ raise RuntimeError('Failed to checkout chromeos')
## Do cros_sdk and setup_board, otherwise build_tc in next step will fail.
cmd = 'cd {0} && cros_sdk --download'.format(self._chromeos_root)
ret = self._cmd_exec.RunCommand(cmd, terminated_timeout=9000)
if ret:
- raise Exception('Failed to create chroot.')
+ raise RuntimeError('Failed to create chroot.')
def SetupBoard(self):
cmd = './setup_board --board=' + self._board
@@ -58,7 +58,7 @@ class DejagnuAdapter(object):
cmd,
terminated_timeout=4000)
if ret:
- raise Exception('Failed to setup board.')
+ raise RuntimeError('Failed to setup board.')
def CheckoutGCC(self):
cmd = 'git clone {0} {1} && cd {1} && git checkout {2}'.format(
@@ -66,7 +66,7 @@ class DejagnuAdapter(object):
ret = self._cmd_exec.RunCommand(cmd, terminated_timeout=300)
if ret:
- raise Exception('Failed to checkout gcc.')
+ raise RuntimeError('Failed to checkout gcc.')
## Handle build_tc bug.
cmd = ('touch {0}/gcc/config/arm/arm-tune.md ' + \
'{0}/gcc/config/arm/arm-tables.opt').format(self._gcc_dir)
@@ -78,7 +78,7 @@ class DejagnuAdapter(object):
'--gcc_dir=' + self._gcc_dir]
ret = build_tc.Main(build_gcc_args)
if ret:
- raise Exception('Building gcc failed.')
+ raise RuntimeError('Building gcc failed.')
def CheckGCC(self):
args = [run_dejagnu.__file__, '--board=' + self._board,
@@ -189,7 +189,7 @@ def ProcessArguments(argv):
options = parser.parse_args(argv[1:])
if not options.board or not options.remote:
- raise Exception('--board and --remote are mandatory options.')
+ raise SyntaxError('--board and --remote are mandatory options.')
return options
diff --git a/test_gdb_dejagnu.py b/test_gdb_dejagnu.py
index a1c44dc9..4f44527f 100755
--- a/test_gdb_dejagnu.py
+++ b/test_gdb_dejagnu.py
@@ -32,12 +32,12 @@ class DejagnuAdapter(object):
'--minilayout', '--jobs=8']
ret = setup_chromeos.Main(cmd)
if ret:
- raise Exception('Failed to checkout chromeos')
+ raise RuntimeError('Failed to checkout chromeos')
## Do cros_sdk and setup_board, otherwise build_tc in next step will fail.
cmd = 'cd {0} && cros_sdk --download'.format(self._chromeos_root)
ret = self._cmd_exec.RunCommand(cmd, terminated_timeout=9000)
if ret:
- raise Exception('Failed to create chroot.')
+ raise RuntimeError('Failed to create chroot.')
def SetupBoard(self):
cmd = './setup_board --board=' + self._board
@@ -45,7 +45,7 @@ class DejagnuAdapter(object):
cmd,
terminated_timeout=4000)
if ret:
- raise Exception('Failed to setup board.')
+ raise RuntimeError('Failed to setup board.')
def CheckGDB(self):
args = [gdb_dejagnu.__file__, '--board=' + self._board,
@@ -135,7 +135,7 @@ def ProcessArguments(argv):
options = parser.parse_args(argv)
if not options.board or not options.remote:
- raise Exception('--board and --remote are mandatory options.')
+ raise SyntaxError('--board and --remote are mandatory options.')
return options