Properly return exit codes to indicate build_tc failure.
This is useful for other scripts depending on this script, for example, test_gcc_dejagnu.py.
PRESUBMIT=passed
R=asharif
CC=bjanakiraman,cmtice,llozano,yunlian
APPROVED=yunlian
OCL=63855-p2
RCL=63948-p2
RDATE=2012/11/09 10:08:26
P4 change: 42797630
diff --git a/v14/build_tc.py b/v14/build_tc.py
index 8ab4ab6..6f82e89 100755
--- a/v14/build_tc.py
+++ b/v14/build_tc.py
@@ -54,14 +54,16 @@
def Build(self):
self.RunSetupBoardIfNecessary()
+ rv = 1
try:
self.UninstallTool()
self.MoveMaskFile()
self.MountSources(False)
self.RemoveCompiledFile()
- self.BuildTool()
+ rv = self.BuildTool()
finally:
self.UnMoveMaskFile()
+ return rv
def RemoveCompiledFile(self):
compiled_file = os.path.join(self._chromeos_root,
@@ -138,7 +140,7 @@
env_string = " ".join(["%s=\"%s\"" % var for var in env.items()])
command = "emerge =cross-%s/%s-9999" % (self._ctarget, self._name)
full_command = "sudo %s %s" % (env_string, command)
- self._ce.ChrootRunCommand(self._chromeos_root, full_command)
+ return self._ce.ChrootRunCommand(self._chromeos_root, full_command)
def MoveMaskFile(self):
self._new_mask_file = None
@@ -256,16 +258,16 @@
not options.noincremental, build_env)
toolchain_parts.append(tp)
+ rv = 0
try:
for tp in toolchain_parts:
if options.mount_only or options.unmount_only:
tp.MountSources(options.unmount_only)
else:
- tp.Build()
+ rv = rv + tp.Build()
finally:
print "Exiting..."
- return 0
-
+ return rv
if __name__ == "__main__":
retval = Main(sys.argv)