sbsv2/raptor/test/smoke_suite/delete_on_failed_compile.py
branchwip
changeset 443 2f5cedd04db9
child 444 31c715210447
equal deleted inserted replaced
398:dde9ce4a8aa8 443:2f5cedd04db9
       
     1 #
       
     2 # Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 # All rights reserved.
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of the License "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 #
       
     9 # Initial Contributors:
       
    10 # Nokia Corporation - initial contribution.
       
    11 #
       
    12 # Contributors:
       
    13 #
       
    14 # Description: 
       
    15 #
       
    16 
       
    17 import os
       
    18 from raptor_tests import AntiTargetSmokeTest
       
    19 
       
    20 def setEnvVar(envvarname, newvalue):
       
    21 	""" If the environment variable envvarname exists in the environment, set it to newvalue 
       
    22 	and return the original value of envvarname. If envvarname does not exist, return None. """
       
    23 	
       
    24 	oldvalue = None
       
    25 	
       
    26 	if envvarname in os.environ:
       
    27 		oldvalue = os.environ[envvarname]
       
    28 		os.environ[envvarname] = newvalue
       
    29 	
       
    30 	return oldvalue
       
    31 		
       
    32 
       
    33 def run():
       
    34 	# Set the ARM license file environment variables to junk files to ensure failed compiles.
       
    35 	saved_armlmd_license_file = setEnvVar("ARMLMD_LICENSE_FILE", "123@456")
       
    36 	saved_lm_license_file = setEnvVar("LM_LICENSE_FILE", "123@456")
       
    37 	
       
    38 	t = AntiTargetSmokeTest()
       
    39 	t.id = "116"
       
    40 	t.name = "delete_on_failed_compile"
       
    41 	t.description = "Test that object files are not present following a forced failed compile."
       
    42 	
       
    43 	t.usebash = True
       
    44 	base_command = "sbs -b smoke_suite/test_resources/simple/bld.inf -c armv5 -k"
       
    45 	
       
    46 	t.id = "116a" # Ensure everything is reallyclean before the test
       
    47 	t.name = "delete_on_failed_compile_reallyclean_01"
       
    48 	t.errors = 0
       
    49 	t.returncode = 0
       
    50 	t.antitargets = [ "" ]
       
    51 	t.command = base_command + " reallyclean"
       
    52 	t.run()
       
    53 	
       
    54 	t.id = "116b"  # Object files should *not* be present after this forced failed compile
       
    55 	t.name = "delete_on_failed_compile_build"
       
    56 	t.errors = 1
       
    57 	t.returncode = 1
       
    58 	# None of these files should be present
       
    59 	t.addbuildantitargets('smoke_suite/test_resources/simple/bld.inf', 
       
    60 		[	"test_/armv5/udeb/test.o",
       
    61 			"test_/armv5/udeb/test1.o",
       
    62 			"test_/armv5/udeb/test2.o",
       
    63 			"test_/armv5/udeb/test3.o",
       
    64 			"test_/armv5/udeb/test4.o",
       
    65 			"test_/armv5/udeb/test5.o",
       
    66 			"test_/armv5/udeb/test6.o",
       
    67 			"test_/armv5/urel/test.o",
       
    68 			"test_/armv5/urel/test1.o",
       
    69 			"test_/armv5/urel/test2.o",
       
    70 			"test_/armv5/urel/test3.o",
       
    71 			"test_/armv5/urel/test4.o",
       
    72 			"test_/armv5/urel/test5.o",
       
    73 			"test_/armv5/urel/test6.o"  ])
       
    74 	t.command = base_command
       
    75 	t.run()
       
    76 	
       
    77 	t.id = "116c"
       
    78 	t.name = "delete_on_error_reallyclean_02"
       
    79 	t.errors = 0
       
    80 	t.returncode = 0
       
    81 	t.self.antitargets = [] # Remove the list of anti-targets
       
    82 	t.command = base_command + " reallyclean"
       
    83 	t.run()
       
    84 	
       
    85 	t.id = "116d"  # In this step, the object files should be there, but their contents will be invalid
       
    86 	t.name = "delete_on_error_custom_make_engine"
       
    87 	sbshome = os.environ["SBS_HOME"].replace("\\","/").rstrip("/")
       
    88 	t.errors = 0
       
    89 	t.returncode = 0
       
    90 	t.mustmatch_singleline = []
       
    91 	t.command = base_command + " -e make_test --configpath=%s/test/smoke_suite/test_resources/simple/makevariants" % sbshome 
       
    92 	t.addbuildtargets('smoke_suite/test_resources/simple/bld.inf', 
       
    93 		[	"test_/armv5/udeb/test.o",
       
    94 			"test_/armv5/udeb/test1.o",
       
    95 			"test_/armv5/udeb/test2.o",
       
    96 			"test_/armv5/udeb/test3.o",
       
    97 			"test_/armv5/udeb/test4.o",
       
    98 			"test_/armv5/udeb/test5.o",
       
    99 			"test_/armv5/udeb/test6.o",
       
   100 			"test_/armv5/urel/test.o",
       
   101 			"test_/armv5/urel/test1.o",
       
   102 			"test_/armv5/urel/test2.o",
       
   103 			"test_/armv5/urel/test3.o",
       
   104 			"test_/armv5/urel/test4.o",
       
   105 			"test_/armv5/urel/test5.o",
       
   106 			"test_/armv5/urel/test6.o"  ])
       
   107 	t.run()
       
   108 	
       
   109 	t.id = "116e"
       
   110 	t.name = "delete_on_error_reallyclean_03"
       
   111 	t.errors = 0
       
   112 	t.returncode = 0
       
   113 	t.self.targets = [] # Remove the list of targets
       
   114 	t.command = base_command + " reallyclean"
       
   115 	t.run()
       
   116 	
       
   117 	# Restore the license file environment variables, provided they existed.
       
   118 	if saved_armlmd_license_file != None:
       
   119 		saved_armlmd_license_file = setEnvVar("ARMLMD_LICENSE_FILE", saved_armlmd_license_file)
       
   120 	if saved_lm_license_file != None:
       
   121 		saved_lm_license_file = setEnvVar("LM_LICENSE_FILE", saved_lm_license_file)
       
   122 	
       
   123 	t.id = "116"
       
   124 	t.name = ""
       
   125 	t.print_result()
       
   126 	return t