Use exception instead of sys.exit().

Addresses a review comment from frankf at https://codereview.chromium.org/157743004/

BUG=142642

Review URL: https://codereview.chromium.org/154153008

git-svn-id: http://src.chromium.org/svn/trunk/src/build@250302 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
thakis@chromium.org 2014-02-11 02:52:10 +00:00
Родитель f0077495b5
Коммит ea75f3e120
1 изменённых файлов: 6 добавлений и 8 удалений

Просмотреть файл

@ -123,19 +123,17 @@ class TestPackageExecutable(TestPackage):
else: else:
target_name = self.suite_path + '_stripped' target_name = self.suite_path + '_stripped'
if not os.path.isfile(target_name): if not os.path.isfile(target_name):
logging.critical('Did not find %s, build target %s', raise Exception('Did not find %s, build target %s' %
target_name, self.suite_name + '_stripped') (target_name, self.suite_name + '_stripped'))
sys.exit(1)
target_mtime = os.stat(target_name).st_mtime target_mtime = os.stat(target_name).st_mtime
source_mtime = os.stat(self.suite_path).st_mtime source_mtime = os.stat(self.suite_path).st_mtime
if target_mtime < source_mtime: if target_mtime < source_mtime:
logging.critical( raise Exception(
'stripped binary (%s, timestamp %d) older than ' 'stripped binary (%s, timestamp %d) older than '
'source binary (%s, timestamp %d), build target %s', 'source binary (%s, timestamp %d), build target %s' %
target_name, target_mtime, self.suite_path, source_mtime, (target_name, target_mtime, self.suite_path, source_mtime,
self.suite_name + '_stripped') self.suite_name + '_stripped'))
sys.exit(1)
test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name
adb.PushIfNeeded(target_name, test_binary) adb.PushIfNeeded(target_name, test_binary)