Merge error fixes with filterwhat stuff wip
authorraptorbot <raptorbot@systemstesthead.symbian.intra>
Sun, 17 Jan 2010 22:59:11 +0000
branchwip
changeset 126 7309affc5a05
parent 125 dc823469fda2 (diff)
parent 122 816955f04aaa (current diff)
child 127 874022828cfd
Merge error fixes with filterwhat stuff
--- a/sbsv2/raptor/RELEASE-NOTES.txt	Sun Jan 17 15:44:38 2010 +0000
+++ b/sbsv2/raptor/RELEASE-NOTES.txt	Sun Jan 17 22:59:11 2010 +0000
@@ -3,13 +3,33 @@
 
 Next version
 
-Other Changes:
-Combine Linking and Postlinking into a single step
-New 'Patchable Constants' target type: TARGETTYPE pdll
-Support exit codes from next version of the trace compiler which will issue them
-New (experimental) FilterWhatComp filter.  Simulates abld log output for use with parse_what.pl for packing up zips by component.
-New graphical build visualisation tool (bin/timelines.py). Requires pygame and PyOpenGL. 
-New a log analyser for recording the total time spent in each type of recipe in the build (recipestats.py). 
+- Combine Linking and Postlinking into a single step
+- New 'Patchable Constants' target type: TARGETTYPE pdll
+- Support exit codes from next version of the trace compiler which will issue them
+- New sbs_filter script and batchfile to ease the use of sbs_filter.py.  
+    Allows filters to be executed over a log after a build has been done.
+    e.g.
+  	sbs_filter --filters=FilterWhat < logfile.log 
+    (This runs a "--what" without regenerating any makefiles or reparsing
+    the matadata.)
+- New (beta) FilterWhatComp filter.  Simulates abld log output for
+   use with parse_what.pl for packing up zips by component.  Whatcomp output
+   uses the incoming epocroot value.  i.e. if epocroot is relative then so is
+   the what output.  e.g. if EPOCROOT=\   then the output will be of the form
+   "\epoc32\release\armv5\...."  If it's "..\myepocroot" then the output will
+   be "..\myepocroot\epoc32\release\armv5".  If it's absolute then the what
+   output will also be absolute.
+- New FilterCheck filter.  This can be used with sbs_filter to perform the 
+   equivalent of --check using the log output from a build.  It is more
+   efficient than --check because the metadata is not parsed and no makefiles
+   are generated. e.g.
+  	sbs_filter --filters=FilterCheck < logfile.log 
+- New (beta) graphical build visualisation tool (bin/timelines.py). Requires pygame
+   and PyOpenGL. e.g.  python timelines.py < filename.log
+- New (beta) log analyser (recipestats.py) for recording the total time spent in 
+   each type of recipe in the build. e.g. python recipestats.py < filename.log > stats.csv
+   The output is in CSV format.  
+
 
 
 version 2.11.3
--- a/sbsv2/raptor/bin/sbs	Sun Jan 17 15:44:38 2010 +0000
+++ b/sbsv2/raptor/bin/sbs	Sun Jan 17 22:59:11 2010 +0000
@@ -79,7 +79,6 @@
 	__PYTHON__=$($u "$__PYTHON__")
 
 	export SBS_HOME=$($u "$SBS_HOME")
-	export EPOCROOT=$($u "$EPOCROOT")
 
 	export PATH=${__MINGW__}/bin:${__CYGWIN__}/bin:$SBS_HOME/$HOSTPLATFORM_DIR/bin:$PATH
 
--- a/sbsv2/raptor/bin/sbs_filter	Sun Jan 17 15:44:38 2010 +0000
+++ b/sbsv2/raptor/bin/sbs_filter	Sun Jan 17 22:59:11 2010 +0000
@@ -57,7 +57,6 @@
 	__PYTHON__=$($u "$__PYTHON__")
 
 	export SBS_HOME=$($u "$SBS_HOME")
-	export EPOCROOT=$($u "$EPOCROOT")
 
 	export PATH=${__MINGW__}/bin:${__CYGWIN__}/bin:$SBS_HOME/$HOSTPLATFORM_DIR/bin:$PATH
 
@@ -89,3 +88,4 @@
 	echo "Cannot start sbs_filter - $FILTER_START not found." 1>&2
 	echo "Check your SBS_HOME environment variable." 1>&2
 fi
+
--- a/sbsv2/raptor/bin/sbs_filter.py	Sun Jan 17 15:44:38 2010 +0000
+++ b/sbsv2/raptor/bin/sbs_filter.py	Sun Jan 17 22:59:11 2010 +0000
@@ -61,22 +61,29 @@
 	the_raptor.out.open(raptor_params, the_raptor.filterList.split(','), pbox)
 	
 except Exception, e:
-	sys.stderr.write("filter exception: %s\n" % str(e))
-	traceback.print_ex()
+	sys.stderr.write("error: problem while creating filters %s\n" % str(e))
+	traceback.print_exc()
 	sys.exit(1)
 		
 # read stdin a line at a time and pass it to the Raptor object
-line = " "
-while line:
-	line = sys.stdin.readline()
-	the_raptor.out.write(line)
+try:
+	line = " "
+	while line:
+		line = sys.stdin.readline()
+		the_raptor.out.write(line)
+except:
+	sys.stderr.write("error: problem while filtering: %s\n" % str(e))
+	traceback.print_exc()
+	sys.exit(1)
 
-# from Raptor.CloseLog()
-if not the_raptor.out.summary():
-	the_raptor.errorCode = 1
+the_raptor_errorCode = 0
+
+# Print the summary (this can't return errors)
+the_raptor.out.summary()
 	
 if not the_raptor.out.close():
-	the_raptor.errorCode = 1
+	print "BADCLOSE"
+	the_raptor.errorCode = 2
 	
 # return the error code
 sys.exit(the_raptor.errorCode)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/python/plugins/filter_check.py	Sun Jan 17 22:59:11 2010 +0000
@@ -0,0 +1,29 @@
+#
+# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+# Filter class for doing --what and --check operations
+#
+
+import os
+import sys
+import re
+import filter_interface
+import filter_what
+
+class FilterCheck(filter_what.FilterWhat):
+
+        def __init__(self): 
+		super(filter_what.FilterWhat,self).__init__()
+		self.check = True
+
--- a/sbsv2/raptor/python/plugins/filter_what.py	Sun Jan 17 15:44:38 2010 +0000
+++ b/sbsv2/raptor/python/plugins/filter_what.py	Sun Jan 17 22:59:11 2010 +0000
@@ -22,6 +22,10 @@
 
 class FilterWhat(filter_interface.Filter):
 
+	def __init__(self):
+		super(filter_interface.Filter,self).__init__()
+		self.path_prefix_to_strip = None
+		self.path_prefix_to_add_on = None
 	
 	def print_file(self, line, start, end):
 		"Ensure DOS slashes on Windows"
@@ -33,6 +37,12 @@
 			filename = line[(start + 1):end].replace("/","\\")
 		else:
 			filename = line[(start + 1):end]
+
+		if self.path_prefix_to_strip:
+			if filename.startswith(self.path_prefix_to_strip):
+				filename = filename[len(self.path_prefix_to_strip):]
+			if self.path_prefix_to_add_on != None:
+				filename = self.path_prefix_to_add_on + filename
 			
 		if self.check:
 			if not os.path.isfile(filename):
--- a/sbsv2/raptor/python/plugins/filter_whatcomp.py	Sun Jan 17 15:44:38 2010 +0000
+++ b/sbsv2/raptor/python/plugins/filter_whatcomp.py	Sun Jan 17 22:59:11 2010 +0000
@@ -23,11 +23,15 @@
 
 class FilterWhatComp(filter_what.FilterWhat):
 
+        def __init__(self): 
+		super(filter_what.FilterWhat, self).__init__()
+
 	def write(self, text):
 		"process some log text"
+		ok = True
 		
 		for line in text.splitlines():
-			ok =filter_what.FilterWhat.write(self, line)
+			ok = filter_what.FilterWhat.write(self, line)
 			if not ok:
 				break
 				
@@ -44,3 +48,9 @@
 		
 	def end_bldinf(self):
 		self.outfile.write("++ Finished\n")
+
+        def open(self, build_parameters):
+		t = filter_what.FilterWhat.open(self, build_parameters)
+		self.path_prefix_to_strip = os.path.abspath(build_parameters.epocroot)
+		self.path_prefix_to_add_on = build_parameters.incoming_epocroot
+		return t
--- a/sbsv2/raptor/python/raptor.py	Sun Jan 17 15:44:38 2010 +0000
+++ b/sbsv2/raptor/python/raptor.py	Sun Jan 17 22:59:11 2010 +0000
@@ -58,12 +58,15 @@
 # defaults can use EPOCROOT
 
 if "EPOCROOT" in os.environ:
-        epocroot = os.environ["EPOCROOT"].replace("\\","/")
+	incoming_epocroot = os.environ["EPOCROOT"]
+        epocroot = incoming_epocroot.replace("\\","/")
 else:
 	if 'linux' in hostplatform:
 		epocroot=os.environ['HOME'] + os.sep + "epocroot"
 		os.environ["EPOCROOT"] = epocroot
+		incoming_epocroot = epocroot
 	else:
+		incoming_epocroot = "\\"
 		epocroot = "/"
 		os.environ["EPOCROOT"] = os.sep
 
@@ -1334,6 +1337,8 @@
 class BuildStats(object):
 
 	def __init__(self, raptor_instance):
+		self.incoming_epocroot = incoming_epocroot
+		self.epocroot = epocroot
 		self.logFileName = raptor_instance.logFileName
 		self.quiet = raptor_instance.quiet
 		self.doCheck = raptor_instance.doCheck
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/whatcomp.py	Sun Jan 17 22:59:11 2010 +0000
@@ -0,0 +1,65 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+
+from raptor_tests import SmokeTest
+import generic_path
+import os
+
+def run():
+	t = SmokeTest()
+	t.usebash = True
+	result = SmokeTest.PASS
+
+	abs_epocroot = os.path.abspath(os.environ["EPOCROOT"]).replace("\\","/")
+	cwd = os.getcwd().replace("\\","/")
+
+	relative_epocroot = os.path.relpath(abs_epocroot,cwd).replace("\\","/")
+
+	
+
+	description = """This tests the whatcomp filter.  As a byproduct it uses (and thus smoke-tests) sbs_filter.py"""
+	command = "sbs -b smoke_suite/test_resources/simple/bld.inf -c %s -m ${SBSMAKEFILE} -f ${SBSLOGFILE} what  && " + \
+		  "EPOCROOT=%s sbs_filter --filters FilterWhatComp < ${SBSLOGFILE} &&" % relative_epocroot + \
+		  "EPOCROOT=%s sbs_filter --filters FilterWhatComp < ${SBSLOGFILE}"  % abs_epocroot
+	targets = [
+		]	
+	buildtargets = [
+		]
+	mustmatch = [
+		"-- abld -w",
+		"Chdir .*/smoke_suite/test_resources/simple",
+		relative_epocroot + "/epoc32/release/armv5/urel/test.exe",
+		relative_epocroot + "/epoc32/release/armv5/urel/test.exe.map",
+		abs_epocroot + "/epoc32/release/armv5/urel/test.exe",
+		abs_epocroot + "/epoc32/release/armv5/urel/test.exe.map",
+	] 
+	mustnotmatch = [
+	"error: no (CHECK|WHAT) information found"
+	]
+	warnings = 0
+	
+	t.id = "0106"
+	t.name = "filter_whatcomp_sbs_filter"
+	t.description = description
+	t.command = command % "arm.v5.urel.gcce4_4_1"
+	t.targets = targets
+	t.mustmatch = mustmatch
+	t.mustnotmatch = mustnotmatch
+	t.warnings = warnings
+	t.run()
+
+	t.print_result()
+	return t