def UndoCheckouts(self):
        FailureToUncheckAll = False

        if self.MakeFileWithPath != "" :
            if clearcase.isCheckedOut(self.MakeFileWithPath):
                self.PrintToScreenAndFile("Undoing makefile checkout", True)
                if clearcase.uncheckout(self.MakeFileWithPath):
                    UnexpectedError = "Error while trying to uncheckout makefile"
                    self.PrintToScreenAndFile(UnexpectedError,False)
                    FailureToUncheckAll = True
        
        self.PrintToScreenAndFile("Undoing Checkouts...", True)
        for currentFileToEditIndex in range(0, self.FileToEditIndex + 1):
            if clearcase.isCheckedOut(self.FileToEditWithPath[currentFileToEditIndex]):
                self.PrintToScreenAndFile("Undoing checkout of file %s..." % self.FileToEditWithPath[currentFileToEditIndex], True)
                if clearcase.uncheckout(self.FileToEditWithPath[currentFileToEditIndex], keep = True) != None:
                    UnexpectedError = "Error while trying to uncheckout file %s!" % self.FileToEditWithPath[currentFileToEditIndex]
                    self.PrintToScreenAndFile(UnexpectedError, False)
                    FailureToUncheckAll = True
                else:
                    self.PrintToScreenAndFile("File %s has been unchecked out" % self.FileToEditWithPath[currentFileToEditIndex], True)
        if FailureToUncheckAll == True:
            raise RuntimeError, "Unable to Checkout All Files"
    def ModifyAndBuildFaultInjectionFile(self, fileModificationsDictionary, TestName):
        makefileModificationsDictionaryRM = { \
			'makefile': [ \
			# # # # # # # # # # # # # # # # # # # # # # # # #
			'''
            # Start Fault Injection Point 1
            # End Fault Injection Point 1
            # Fault Injection Code Start
RM :=cmd /C del /F /Q
            # Fault Injection Code End
		    '''
			]
        }
        makefileModificationsDictionaryDEL = { \
			'makefile':[ \
			# # # # # # # # # # # # # # # # # # # # # # # # # 
			''' 
            # Start Fault Injection Point 2
            # End Fault Injection Point 2
            # Fault Injection Code Start
	-$(RM) ".\\apexbin.h"
	-$(RM) ".\\._2"
	-$(RM) ".\\._4"
	-$(RM) ".\\apex.*"
	-$(RM) ".\\*.bin"
	-$(RM) ".\\OS\\*.o"
	-$(RM) ".\\OS\\*.d"
	-$(RM) ".\\*.o"
	-$(RM) ".\\*.d"
	-$(RM) ".\\ControlBus\\*.o"
	-$(RM) ".\\ControlBus\\*.d"
	-$(RM) ".\\OS\\*.o"
	-$(RM) ".\\OS\\*.d"
	-$(RM) ".\\Utility\\*.o"
	-$(RM) ".\\Utility\\*.d"
            # Fault Injection Code End
		    '''
			]
        }

        if len(sys.argv) != 0 :

            if sys.argv[1] == "BlackfinDiag" :

                self.ProductName = BLACKFIN_PRODUCT_NAME

                self.Init(TestName)

                self.DiagEditPath      = self.ViewPath + "\\" + BLACKFIN_PRODUCT_FOLDER + "\\" + BLACKFIN_DIAG_PATH
		
                self.CleanBuildCmd = ".\\" + BLACKFIN_BUILD_SCRIPT + " " + self.BranchPath + " " + BLACKFIN_PROJECT_FOLDER + " " + BLACKFIN_MAKE_CLEAN_CMD
		
                self.BuildExecutableCmd = ".\\" + BLACKFIN_BUILD_SCRIPT + " " + self.BranchPath + " " + BLACKFIN_PROJECT_FOLDER + " " + BLACKFIN_MAKE_CMD

                self.ResultsOfBuildFolder = self.ViewPath + "\\" + BLACKFIN_PRODUCT_FOLDER + "\\"  + BLACKFIN_PROJECT_FOLDER + "\\" + BLACKFIN_BUILD_TYPE_FOLDER

                self.MakeFileWithPath = ""

            elif sys.argv[1] == "BlackfinOS" :

                self.ProductName = BLACKFIN_PRODUCT_NAME

                self.Init(TestName)

                self.DiagEditPath      = self.ViewPath + "\\" + BLACKFIN_PRODUCT_FOLDER + "\\" + BLACKFIN_OS_PATH
		
                self.CleanBuildCmd = ".\\" + BLACKFIN_BUILD_SCRIPT + " " + self.BranchPath + " " + BLACKFIN_PROJECT_FOLDER + " " + BLACKFIN_MAKE_CLEAN_CMD
		
                self.BuildExecutableCmd = ".\\" + BLACKFIN_BUILD_SCRIPT + " " + self.BranchPath + " " + BLACKFIN_PROJECT_FOLDER + " " + BLACKFIN_MAKE_CMD

                self.ResultsOfBuildFolder = self.ViewPath + "\\" + BLACKFIN_PRODUCT_FOLDER + "\\"  + BLACKFIN_PROJECT_FOLDER + "\\" + BLACKFIN_BUILD_TYPE_FOLDER

                self.MakeFileWithPath = ""


            elif sys.argv[1] == "ApexDiag" :

                self.ProductName = APEX_PRODUCT_NAME 

                self.Init(TestName)

                self.DiagEditPath      = self.ViewPath + "\\" + APEX_PRODUCT_FOLDER + "\\" + APEX_DIAG_PATH

                self.CleanBuildCmd = ".\\" + APEX_BUILD_SCRIPT + " " + self.BranchPath + " " + APEX_MAKE_CLEAN_CMD
		
                self.BuildExecutableCmd = ".\\" + APEX_BUILD_SCRIPT + " " + self.BranchPath + " " + APEX_MAKE_CMD

                self.ResultsOfBuildFolder = self.ViewPath + "\\" + APEX_PRODUCT_FOLDER + "\\"  + APEX_PROJECT_FOLDER

                self.MakeFileWithPath = self.ViewPath + "\\" + APEX_PRODUCT_FOLDER + "\\"  + APEX_PROJECT_FOLDER + "\\makefile"
        
                if clearcase.isCheckedOut(self.MakeFileWithPath):
                    if clearcase.uncheckout(self.MakeFileWithPath, keep = True) != None:
                        UnexpectedError = "Error while trying to uncheckout file %s!" % self.MakeFileWithPath
                        self.PrintToScreenAndFile(UnexpectedError, False)
                        raise RuntimeError, UnexpectedError
                    UnexpectedError = "File %s already Checked Out!" % self.MakeFileWithPath
                    self.PrintToScreenAndFile(UnexpectedError, False)
                    raise RuntimeError, UnexpectedError
                self.PrintToScreenAndFile("File %s is not already checked out" % self.MakeFileWithPath, True)

                # Check the file out.
                self.PrintToScreenAndFile("Checking out file %s" % self.MakeFileWithPath, True)
                if clearcase.checkout(self.MakeFileWithPath, False, 'Temporary Checkout for Fault Injection Test.') != None:
                    UnexpectedError = "Error while trying to checkout file %s!" % self.MakeFileWithPath
                    self.PrintToScreenAndFile(UnexpectedError, False)
                    raise RuntimeError, UnexpectedError
                self.PrintToScreenAndFile("File %s has been checked out." % self.MakeFileWithPath, True)
        
                # Modify the file.
                self.ModifyFile(makefileModificationsDictionaryRM, "makefile", self.MakeFileWithPath)
                self.ModifyFile(makefileModificationsDictionaryDEL, "makefile", self.MakeFileWithPath)

            elif sys.argv[1] == "ApexOS" :

                self.ProductName = APEX_PRODUCT_NAME

                self.Init(TestName)

                self.DiagEditPath      = self.ViewPath + "\\" + APEX_PRODUCT_FOLDER + "\\" + APEX_OS_PATH

                self.CleanBuildCmd = ".\\" + APEX_BUILD_SCRIPT + " " + self.BranchPath + " " + APEX_MAKE_CLEAN_CMD
		
                self.BuildExecutableCmd = ".\\" + APEX_BUILD_SCRIPT + " " + self.BranchPath + " " + APEX_MAKE_CMD

                self.ResultsOfBuildFolder = self.ViewPath + "\\" + APEX_PRODUCT_FOLDER + "\\"  + APEX_PROJECT_FOLDER

                self.MakeFileWithPath = self.ViewPath + "\\" + APEX_PRODUCT_FOLDER + "\\"  + APEX_PROJECT_FOLDER + "\\makefile"
        
                if clearcase.isCheckedOut(self.MakeFileWithPath):
                    if clearcase.uncheckout(self.MakeFileWithPath, keep = True) != None:
                        UnexpectedError = "Error while trying to uncheckout file %s!" % self.MakeFileWithPath
                        self.PrintToScreenAndFile(UnexpectedError, False)
                        raise RuntimeError, UnexpectedError
                    UnexpectedError = "File %s already Checked Out!" % self.MakeFileWithPath
                    self.PrintToScreenAndFile(UnexpectedError, False)
                    raise RuntimeError, UnexpectedError
                self.PrintToScreenAndFile("File %s is not already checked out" % self.MakeFileWithPath, True)

                # Check the file out.
                self.PrintToScreenAndFile("Checking out file %s" % self.MakeFileWithPath, True)
                if clearcase.checkout(self.MakeFileWithPath, False, 'Temporary Checkout for Fault Injection Test.') != None:
                    UnexpectedError = "Error while trying to checkout file %s!" % self.MakeFileWithPath
                    self.PrintToScreenAndFile(UnexpectedError, False)
                    raise RuntimeError, UnexpectedError
                self.PrintToScreenAndFile("File %s has been checked out." % self.MakeFileWithPath, True)
        
                # Modify the file.
                self.ModifyFile(makefileModificationsDictionaryRM, "makefile", self.MakeFileWithPath)
                self.ModifyFile(makefileModificationsDictionaryDEL, "makefile", self.MakeFileWithPath)
            else :

                raise RuntimeError, "Invalid command line arg"
        self.ModifyFileBuildFaultInjectionTest(fileModificationsDictionary, TestName)