sbs_filter: Fix so that return code is 0 on success (was always 1)
filter_whatcomp: add a test for this
--- a/sbsv2/raptor/bin/sbs_filter Sun Jan 17 19:47:29 2010 +0000
+++ b/sbsv2/raptor/bin/sbs_filter Sun Jan 17 20:52:46 2010 +0000
@@ -78,6 +78,7 @@
FILTER_START="$SBS_HOME/bin/sbs_filter.py"
+STATE=0
if [ -e "$FILTER_START" ]; then
# run the source version
${__PYTHON__} "$FILTER_START" "$@"
@@ -88,3 +89,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 19:47:29 2010 +0000
+++ b/sbsv2/raptor/bin/sbs_filter.py Sun Jan 17 20:52:46 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))
+ 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/test/smoke_suite/whatcomp.py Sun Jan 17 20:52:46 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