SF bug 1861 : display informative messages when timeouts occur in build tasks. fix
authortimothy.murphy@nokia.com
Fri, 19 Feb 2010 18:35:09 +0000
branchfix
changeset 237 dd11681bd6f3
parent 236 a2dc04c8e649
child 238 bd7f12067a47
child 239 697a7a6b9680
SF bug 1861 : display informative messages when timeouts occur in build tasks.
sbsv2/raptor/RELEASE-NOTES.txt
sbsv2/raptor/python/plugins/filter_terminal.py
sbsv2/raptor/test/smoke_suite/timeout.py
sbsv2/raptor/util/talon/process.c
sbsv2/raptor/util/talon/talon.c
--- a/sbsv2/raptor/RELEASE-NOTES.txt	Fri Feb 19 17:47:52 2010 +0000
+++ b/sbsv2/raptor/RELEASE-NOTES.txt	Fri Feb 19 18:35:09 2010 +0000
@@ -1,5 +1,7 @@
 Release Notes for Symbian Build System v2
 
+- SF Bug 1861 - [Raptor] More helpful console message in case of Error 128 (timeout)
+
 next version
 
 Defect Fixes:
--- a/sbsv2/raptor/python/plugins/filter_terminal.py	Fri Feb 19 17:47:52 2010 +0000
+++ b/sbsv2/raptor/python/plugins/filter_terminal.py	Fri Feb 19 18:35:09 2010 +0000
@@ -230,6 +230,8 @@
 			# detect the status report from a recipe
 			if text.find('failed') != -1:
 				self.failed = True
+				if text.find("reason='timeout'") != -1:
+					self.timedout = True
 			else:
 				self.failed = False
 			return
@@ -282,6 +284,7 @@
 
 			# This variable holds all recipe information
 			self.failed = False # Recipe status
+			self.timedout = False # Did it Timeout?
 			self.recipeBody = []
 			self.recipelineExceeded = 0
 			return		
@@ -298,16 +301,30 @@
 				
 				if self.failed == True:
 					if not self.analyseonly:
-						sys.stderr.write("\n FAILED %s for %s: %s\n" % \
+						reason=""
+						if self.timedout:
+							reason="(timeout)"
+
+						sys.stderr.write("\n FAILED %s %s for %s: %s\n" % \
 								(self.recipe_dict['name'],
+								reason,
 								self.recipe_dict['config'],
 								self.recipe_dict['name_to_user']))
 	
 						mmppath = generic_path.Path(self.recipe_dict['mmp']).From(generic_path.CurrentDir()).GetShellPath()
-						sys.stderr.write("  mmp: %s\n" % mmppath)
-						for L in self.recipeBody:
-							if not L.startswith('+'):
-								sys.stdout.write("   %s\n" % L.rstrip())
+						if mmppath is not "":
+							sys.stderr.write("  mmp: %s\n" % mmppath)
+						if self.timedout:
+							sys.stderr.write( \
+"""    Timeouts may be due to network related issues (e.g. license servers),
+    tool bugs or abnormally large components. TALON_TIMEOUT can be adjusted 
+    in the make engine configuration if required.  Make engines may have 
+    their own timeouts that Raptor cannot influence
+""")
+						else:
+							for L in self.recipeBody:
+								if not L.startswith('+'):
+									sys.stdout.write("   %s\n" % L.rstrip())
 					self.err_count += 1
 				else:
 					r = Recipe.factory(self.recipe_dict['name'], "".join(self.recipeBody))
--- a/sbsv2/raptor/test/smoke_suite/timeout.py	Fri Feb 19 17:47:52 2010 +0000
+++ b/sbsv2/raptor/test/smoke_suite/timeout.py	Fri Feb 19 18:35:09 2010 +0000
@@ -21,9 +21,7 @@
 	t = SmokeTest()
 	t.description = "test that long commands time out and get retried"
 	
-	exitCode = "15"
-	if t.onWindows:
-		exitCode = "128" # why are they different?
+	exitCode = "128"
 
 	t.id = "60a"
 	t.name = "timeout"
@@ -31,7 +29,7 @@
 	t.command = "sbs -b smoke_suite/test_resources/timeout/bld.inf -f-"
 
 	t.mustmatch = [
-		"status exit='failed' code='" + exitCode + "' attempt='1'",
+		"status exit='failed' code='" + exitCode + "' attempt='1' *reason='timeout'",
 	]
 	t.errors = -1
 	t.returncode = 1
@@ -43,9 +41,9 @@
 	t.command = "sbs -b smoke_suite/test_resources/timeout/bld.inf -t 3 -f-"
 
 	t.mustmatch = [
-		"status exit='retry' code='" + exitCode + "' attempt='1'",
-		"status exit='retry' code='" + exitCode + "' attempt='2'",
-		"status exit='failed' code='" + exitCode + "' attempt='3'",
+		"status exit='retry' code='" + exitCode + "' attempt='1' *reason='timeout'",
+		"status exit='retry' code='" + exitCode + "' attempt='2' *reason='timeout'",
+		"status exit='failed' code='" + exitCode + "' attempt='3' *reason='timeout'",
 	]
 	t.errors = -1
 	t.returncode = 1
--- a/sbsv2/raptor/util/talon/process.c	Fri Feb 19 17:47:52 2010 +0000
+++ b/sbsv2/raptor/util/talon/process.c	Fri Feb 19 18:35:09 2010 +0000
@@ -176,11 +176,15 @@
 		p->returncode = WEXITSTATUS(status);
 		DEBUG(("process exited normally \n"));
 	} else {
-		p->causeofdeath = PROC_SOMEODDDEATH;
-		if (WIFSIGNALED(status))
-			p->returncode = WTERMSIG(status);
-		else
+		if (p->causeofdeath == PROC_TIMEOUTDEATH)
 			p->returncode = 128;
+		else {	
+			p->causeofdeath = PROC_SOMEODDDEATH;
+			if (WIFSIGNALED(status))
+				p->returncode = WTERMSIG(status);
+			else
+				p->returncode = 128;
+		}
 		DEBUG(("process terminated \n"));
 	}
 	
--- a/sbsv2/raptor/util/talon/talon.c	Fri Feb 19 17:47:52 2010 +0000
+++ b/sbsv2/raptor/util/talon/talon.c	Fri Feb 19 18:35:09 2010 +0000
@@ -38,7 +38,7 @@
 
 #define TALON_ATTEMPT_STRMAX 32
 #define RECIPETAG_STRMAX 2048
-#define STATUS_STRMAX 100
+#define STATUS_STRMAX 120
 
 #define TALONDELIMITER '|'
 #define VARNAMEMAX 100
@@ -549,14 +549,18 @@
 
 			if (dotagging) 
 			{
-				char *forcesuccessstr = force_success == 0 ? "" : " forcesuccess='FORCESUCCESS'";
+				char *flagsstr = force_success == 0 ? "" : " flags='FORCESUCCESS'";
+				char *reasonstr = "" ;
+
+				if (p->causeofdeath == PROC_TIMEOUTDEATH)
+					reasonstr = " reason='timeout'";
 
 				if (p->returncode != 0)
 				{
 					char *exitstr = retries > 0 ? "retry" : "failed";
-					snprintf(status, STATUS_STRMAX - 1, "\n<status exit='%s' code='%d' attempt='%d'%s />", exitstr, p->returncode, attempt, forcesuccessstr );
+					snprintf(status, STATUS_STRMAX - 1, "\n<status exit='%s' code='%d' attempt='%d'%s%s />", exitstr, p->returncode, attempt, flagsstr, reasonstr );
 				} else {
-					snprintf(status, STATUS_STRMAX - 1, "\n<status exit='ok' attempt='%d'%s />", attempt, forcesuccessstr );
+					snprintf(status, STATUS_STRMAX - 1, "\n<status exit='ok' attempt='%d'%s%s />", attempt, flagsstr, reasonstr );
 				}
 				status[STATUS_STRMAX-1] = '\0';