Changes for delete on failed compile. wip
authorDaniel Jacobs <daniel.jacobs@nokia.com>
Mon, 29 Mar 2010 14:20:00 +0100
branchwip
changeset 443 2f5cedd04db9
parent 398 dde9ce4a8aa8
child 444 31c715210447
Changes for delete on failed compile.
sbsv2/raptor/lib/config/make.xml
sbsv2/raptor/lib/flm/e32abiv2.flm
sbsv2/raptor/lib/flm/globals.mk
sbsv2/raptor/python/raptor_make.py
sbsv2/raptor/test/smoke_suite/delete_on_failed_compile.py
sbsv2/raptor/test/smoke_suite/test_resources/simple/makevariants/delete_on_failed_compile_make_variants.xml
--- a/sbsv2/raptor/lib/config/make.xml	Thu Mar 25 15:42:26 2010 +0000
+++ b/sbsv2/raptor/lib/config/make.xml	Mon Mar 29 14:20:00 2010 +0100
@@ -13,6 +13,9 @@
 		<set name='TALON_TIMEOUT' value='600000'/>
 		<set name='TALON_DESCRAMBLE' value='1'/>
 		
+		<!-- Work around for RVCT compile failures -->
+		<set name='DELETE_ON_FAILED_COMPILE' value='1'/>
+		
 		<!-- Command-line for initialisation -->
 		<set name="initialise" value=""/>
 
@@ -70,6 +73,7 @@
 		<set name="build" value="$(EMAKE) HAVE_ORDERONLY= -r"/>
 		<set name="scrambled" value="false"/>
 		<set name='TALON_DESCRAMBLE' value=''/>
+		<set name='DELETE_ON_FAILED_COMPILE' value=''/>
 
 		<!-- workaround for damaged log output from emake -->
 		<set name="copylogfromannofile" value="true"/>
@@ -91,6 +95,7 @@
 		<set name="build" value="$(PVMGMAKE) HAVE_ORDERONLY=true  -r"/>
 		<set name="scrambled" value="false" />
 		<set name='TALON_DESCRAMBLE' value=''/>
+		<set name='DELETE_ON_FAILED_COMPILE' value=''/>
 	</var>
 
 	<alias name="pvmgmake" meaning="pvmgmake_engine"/>
--- a/sbsv2/raptor/lib/flm/e32abiv2.flm	Thu Mar 25 15:42:26 2010 +0000
+++ b/sbsv2/raptor/lib/flm/e32abiv2.flm	Mon Mar 29 14:20:00 2010 +0100
@@ -798,7 +798,7 @@
 			$(if $(NO_DEPEND_GENERATE),,$(DEPEND_OPTION) $(call dblquote,$(1).d)) \
 			$(if $(LINKERFEEDBACK_STAGE2),$(FEEDBACK_OPTION)$(call dblquote,$(FEEDBACKFILE))) \
 			$(if $(MULTIFILE_ENABLED),--multifile $(OUTPUT_OPTION) $(MULTIFILEOBJECT) \
-			--via $$(call dblquote, $(MULTIFILE_VIAFILE)),$(OUTPUT_OPTION) $$@ $$(call dblquote, $$<))  \
+			--via $$(call dblquote, $(MULTIFILE_VIAFILE)),$(OUTPUT_OPTION) $$@ $$(call dblquote, $$<)) $(RVCT22_DELETE_HACK) \
 	$(call endrule,compile)
 
 ifeq ($(NO_DEPEND_GENERATE),)
@@ -857,7 +857,7 @@
 			$(if $(USERINCLUDE),$(COMPILER_SYSTEM_INCLUDE_OPTION),)$(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$(call dblquote,$(USERINCLUDE)))      \
 			$(if $(SYSTEMINCLUDE),$(COMPILER_SYSTEM_INCLUDE_OPTION),)$(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$(call dblquote,$(SYSTEMINCLUDE)))  \
 			$(if $(NOHIDEALL),--no_hide_all,) \
-			$$(call dblquote, $$<) $(OUTPUT_OPTION) $$(@) \
+			$$(call dblquote, $$<) $(OUTPUT_OPTION) $$(@) $(RVCT22_DELETE_HACK) \
 	$(call endrule,e32cpponly)
 
 CLEANTARGETS:=$$(CLEANTARGETS) $(CPPONLYTARGET)
@@ -892,7 +892,7 @@
 			$(if $(SYSTEMINCLUDE),$(COMPILER_SYSTEM_INCLUDE_OPTION),)$(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$(call dblquote,$(SYSTEMINCLUDE)))  \
 			$(if $(NOHIDEALL),--no_hide_all,) \
 			$(if $(NO_DEPEND_GENERATE),,$(DEPEND_OPTION) $(call dblquote,$(DEPENDFILENAME))) \
-			$$(call dblquote, $$<) $(OUTPUT_OPTION) $$(@) \
+			$$(call dblquote, $$<) $(OUTPUT_OPTION) $$(@) $(RVCT22_DELETE_HACK) \
 	$(call endrule,e32listing)
 
 CLEANTARGETS:=$$(CLEANTARGETS) $(LISTINGTARGET)
@@ -987,7 +987,7 @@
 			$(call makemacrodef,-D,$(COMPILER_INTERWORK_DEFINES) $(CDEFS) $(CIADEFS)) $(CPP_LANG_OPTION)      \
 	 		$(if $(USERINCLUDE),$(COMPILER_SYSTEM_INCLUDE_OPTION),)$$(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$$(call dblquote,$(USERINCLUDE)))     \
 	 		$(if $(SYSTEMINCLUDE),$(COMPILER_SYSTEM_INCLUDE_OPTION),)$$(call concat, $(COMPILER_SYSTEM_INCLUDE_OPTION),$$(call dblquote,$(SYSTEMINCLUDE))) \
-	 		$$(call dblquote, $$<) $(OUTPUT_OPTION) $$@ \
+	 		$$(call dblquote, $$<) $(OUTPUT_OPTION) $$@ $(RVCT22_DELETE_HACK) \
 	$(call endrule,cia2cpp2o)
 
 
@@ -1013,7 +1013,7 @@
 $(e32abiv2_PREFILE): $1 $(PROJECT_META) $(if $(DEPENDFILE),,RESOURCE BITMAP EXPORT)
 	$(call startrule,cia2cpp,,$1) \
 	$(if $(PERTURBSTARTTIME),$(RANSLEEP) $(PERTURBMSECS) ;,) \
-	$(CC) $(e32abiv2_PREFILE_OPTIONS) $(OUTPUT_OPTION) $$@ $$(call dblquote,$1) \
+	$(CC) $(e32abiv2_PREFILE_OPTIONS) $(OUTPUT_OPTION) $$@ $$(call dblquote,$1) $(RVCT22_DELETE_HACK) \
 	$(if $(NO_DEPEND_GENERATE),,&& $(CC) -M $(e32abiv2_PREFILE_OPTIONS) --depend_format=unix $(OUTPUT_OPTION) $$@ $$(call dblquote,$1) > $(call dblquote,$(e32abiv2_PREFILE).d)) \
 	$(call endrule,cia2cpp)
 
@@ -1058,12 +1058,12 @@
 		$(if $(PERTURBSTARTTIME),$(RANSLEEP) $(PERTURBMSECS) ;,) \
 		$(CC) $(e32abiv2_asm_OPTIONS) \
 		$(if $(NO_DEPEND_GENERATE),,$(DEPEND_OPTION) $(call dblquote,$(DEPENDFILENAME))) \
-	 	$$(call dblquote, $$<) $(OUTPUT_OPTION) $$@ \
+	 	$$(call dblquote, $$<) $(OUTPUT_OPTION) $$@ $(RVCT22_DELETE_HACK) \
 	$(call endrule,asmcompile)
 ifeq ($(NO_DEPEND_GENERATE),)
 	$(call startrule,asmdependencies) \
 		$(CC) -M $(subst --no_rtti,,$(e32abiv2_asm_OPTIONS)) --depend_format=unix \
-	  	$(OUTPUT_OPTION) $$@ $$(call dblquote,$2) > $(call dblquote,$(DEPENDFILENAME)) \
+	  	$(OUTPUT_OPTION) $$@ $$(call dblquote,$2) > $(call dblquote,$(DEPENDFILENAME)) $(RVCT22_DELETE_HACK) \
 	$(call endrule,asmdependencies)
 endif
 
--- a/sbsv2/raptor/lib/flm/globals.mk	Thu Mar 25 15:42:26 2010 +0000
+++ b/sbsv2/raptor/lib/flm/globals.mk	Mon Mar 29 14:20:00 2010 +0100
@@ -52,6 +52,11 @@
 $(eval $(call sgt_addcmds,$(1)))
 endef
 
+# Enable DELETE_ON_FAILED_COMPILE work around for failed RVCT 2.2 compiles
+ifneq ($(DELETE_ON_FAILED_COMPILE),)
+RVCT22_DELETE_HACK:=|| ($$(GNURM) $$@; exit 1;)
+endif # ifneq ($(DELETE_ON_FAILED_COMPILE),)
+
 ALLTARGET:=ALL
 
 .PHONY:: $(ALLTARGET)
--- a/sbsv2/raptor/python/raptor_make.py	Thu Mar 25 15:42:26 2010 +0000
+++ b/sbsv2/raptor/python/raptor_make.py	Mon Mar 29 14:20:00 2010 +0100
@@ -117,6 +117,12 @@
 			self.talonshell = str(evaluator.Get("TALON_SHELL"))
 			self.talontimeout = str(evaluator.Get("TALON_TIMEOUT"))
 			self.talonretries = str(evaluator.Get("TALON_RETRIES"))
+			
+			# Get the ####################################	
+			delete_on_failed_compile_s = evaluator.Get("DELETE_ON_FAILED_COMPILE")
+			self.delete_on_failed_compile = ""
+			if delete_on_failed_compile_s is not None and delete_on_failed_compile_s != "":
+				self.delete_on_failed_compile = "1"
 
 			# commands
 			self.initCommand = evaluator.Get("initialise")
@@ -230,6 +236,7 @@
 FLMHOME:=%s
 SHELL:=%s
 THIS_FILENAME:=$(firstword $(MAKEFILE_LIST))
+DELETE_ON_FAILED_COMPILE:=%s 
 
 %s
 
@@ -241,6 +248,7 @@
 			 self.raptor.filesystem,
 			 str(self.raptor.systemFLM),
 			 self.shellpath,
+			 self.delete_on_failed_compile,
 			 talon_settings,
 			 self.raptor.systemFLM.Append('globals.mk') )
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/delete_on_failed_compile.py	Mon Mar 29 14:20:00 2010 +0100
@@ -0,0 +1,126 @@
+#
+# Copyright (c) 2010 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: 
+#
+
+import os
+from raptor_tests import AntiTargetSmokeTest
+
+def setEnvVar(envvarname, newvalue):
+	""" If the environment variable envvarname exists in the environment, set it to newvalue 
+	and return the original value of envvarname. If envvarname does not exist, return None. """
+	
+	oldvalue = None
+	
+	if envvarname in os.environ:
+		oldvalue = os.environ[envvarname]
+		os.environ[envvarname] = newvalue
+	
+	return oldvalue
+		
+
+def run():
+	# Set the ARM license file environment variables to junk files to ensure failed compiles.
+	saved_armlmd_license_file = setEnvVar("ARMLMD_LICENSE_FILE", "123@456")
+	saved_lm_license_file = setEnvVar("LM_LICENSE_FILE", "123@456")
+	
+	t = AntiTargetSmokeTest()
+	t.id = "116"
+	t.name = "delete_on_failed_compile"
+	t.description = "Test that object files are not present following a forced failed compile."
+	
+	t.usebash = True
+	base_command = "sbs -b smoke_suite/test_resources/simple/bld.inf -c armv5 -k"
+	
+	t.id = "116a" # Ensure everything is reallyclean before the test
+	t.name = "delete_on_failed_compile_reallyclean_01"
+	t.errors = 0
+	t.returncode = 0
+	t.antitargets = [ "" ]
+	t.command = base_command + " reallyclean"
+	t.run()
+	
+	t.id = "116b"  # Object files should *not* be present after this forced failed compile
+	t.name = "delete_on_failed_compile_build"
+	t.errors = 1
+	t.returncode = 1
+	# None of these files should be present
+	t.addbuildantitargets('smoke_suite/test_resources/simple/bld.inf', 
+		[	"test_/armv5/udeb/test.o",
+			"test_/armv5/udeb/test1.o",
+			"test_/armv5/udeb/test2.o",
+			"test_/armv5/udeb/test3.o",
+			"test_/armv5/udeb/test4.o",
+			"test_/armv5/udeb/test5.o",
+			"test_/armv5/udeb/test6.o",
+			"test_/armv5/urel/test.o",
+			"test_/armv5/urel/test1.o",
+			"test_/armv5/urel/test2.o",
+			"test_/armv5/urel/test3.o",
+			"test_/armv5/urel/test4.o",
+			"test_/armv5/urel/test5.o",
+			"test_/armv5/urel/test6.o"  ])
+	t.command = base_command
+	t.run()
+	
+	t.id = "116c"
+	t.name = "delete_on_error_reallyclean_02"
+	t.errors = 0
+	t.returncode = 0
+	t.self.antitargets = [] # Remove the list of anti-targets
+	t.command = base_command + " reallyclean"
+	t.run()
+	
+	t.id = "116d"  # In this step, the object files should be there, but their contents will be invalid
+	t.name = "delete_on_error_custom_make_engine"
+	sbshome = os.environ["SBS_HOME"].replace("\\","/").rstrip("/")
+	t.errors = 0
+	t.returncode = 0
+	t.mustmatch_singleline = []
+	t.command = base_command + " -e make_test --configpath=%s/test/smoke_suite/test_resources/simple/makevariants" % sbshome 
+	t.addbuildtargets('smoke_suite/test_resources/simple/bld.inf', 
+		[	"test_/armv5/udeb/test.o",
+			"test_/armv5/udeb/test1.o",
+			"test_/armv5/udeb/test2.o",
+			"test_/armv5/udeb/test3.o",
+			"test_/armv5/udeb/test4.o",
+			"test_/armv5/udeb/test5.o",
+			"test_/armv5/udeb/test6.o",
+			"test_/armv5/urel/test.o",
+			"test_/armv5/urel/test1.o",
+			"test_/armv5/urel/test2.o",
+			"test_/armv5/urel/test3.o",
+			"test_/armv5/urel/test4.o",
+			"test_/armv5/urel/test5.o",
+			"test_/armv5/urel/test6.o"  ])
+	t.run()
+	
+	t.id = "116e"
+	t.name = "delete_on_error_reallyclean_03"
+	t.errors = 0
+	t.returncode = 0
+	t.self.targets = [] # Remove the list of targets
+	t.command = base_command + " reallyclean"
+	t.run()
+	
+	# Restore the license file environment variables, provided they existed.
+	if saved_armlmd_license_file != None:
+		saved_armlmd_license_file = setEnvVar("ARMLMD_LICENSE_FILE", saved_armlmd_license_file)
+	if saved_lm_license_file != None:
+		saved_lm_license_file = setEnvVar("LM_LICENSE_FILE", saved_lm_license_file)
+	
+	t.id = "116"
+	t.name = ""
+	t.print_result()
+	return t
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/simple/makevariants/delete_on_failed_compile_make_variants.xml	Mon Mar 29 14:20:00 2010 +0100
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<build xmlns="http://symbian.com/xml/build" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symbian.com/xml/build ../../schema/build/2_0.xsd">
+	<!-- Some make engines for test purposes -->
+	
+	<!-- Raptor make engine for GNU make -->
+	<var name="make_engine">
+		<varRef ref="default.locations"/>
+
+		<!-- Shell settings -->
+		<set name='DEFAULT_SHELL' value='$(SBS_HOME)/$(HOSTPLATFORM_DIR)/bin/talon$(DOTEXE)' type='tool'/>
+		<set name='TALON_SHELL' value='$(SBS_SHELL)' type='tool'/>
+		<set name='USE_TALON' value='1'/>
+		<set name='TALON_TIMEOUT' value='600000'/>
+		<set name='TALON_DESCRAMBLE' value='1'/>
+		
+		<!-- Command-line for initialisation -->
+		<set name="initialise" value=""/>
+
+		<!-- Command-line for shutdown -->
+		<set name="shutdown" value=""/>
+
+		<!-- Command-line for build  -->
+		<set name="build" value="$(GNUMAKE38) HAVE_ORDERONLY=1 -r" type="tool"/>
+
+		<!-- Options  -->
+		<set name="makefile" value="-f"/>
+		<set name="keep_going" value="-k"/>
+		<set name="jobs" value="-j"/>
+		
+		<!-- The following are stuck on the commandline before any options
+		     specified by the sbs "mo" option, so they can be overridden -->
+		<set name="defaultoptions" value=""/>
+
+		<!-- How to split out the makefiles -->
+		<set name="selectors" value="export,bitmap,resource_deps,resource,default"/>
+		<set name="export.selector.iface" value="\.export$"/>
+		<set name="export.selector.target" value="EXPORT"/>
+		<set name="bitmap.selector.iface" value="\.(bitmap|extension|mifconv)$"/>
+		<set name="bitmap.selector.target" value="BITMAP"/>
+		<set name="resource_deps.selector.iface" value="\.resource$"/>
+		<set name="resource_deps.selector.target" value="RESOURCE_DEPS"/>
+		<set name="resource_deps.selector.ignoretargets" value="^(RESOURCE|CLEAN|CLEANEXPORT|REALLYCLEAN)$"/>
+		<set name="resource.selector.iface" value="\.(resource|extension|mif2cdlindex|nativejava)$"/>
+		<set name="resource.selector.target" value="RESOURCE"/>
+		<set name="default.selector.iface" value="\.(?!export$|bitmap$|resource$|mifconv$|mif2cdlindex$|nativejava$).*$"/>
+		<set name="default.selector.target" value="ALL"/>
+
+		<!-- is the text output with -j buffered or scrambled? -->
+		<set name="scrambled" value="true"/>
+	</var>
+	
+	<alias name="make_test" meaning="make_engine"/>
+
+	<!-- use the talon shell -->
+	<var name="make_no_talon_engine_test" extends="make_engine_test">
+	        <set name='DEFAULT_SHELL' value='$(SBS_SHELL)' type='tool'/>
+	        <set name='USE_TALON' value=''/>
+	</var>
+
+
+</build>