00001 #!/usr/local/bin/python 00002 # 00003 # Copyright 2005 00004 # by 00005 # The Board of Trustees of the 00006 # Leland Stanford Junior University. 00007 # All rights reserved. 00008 # 00009 00010 __facility__ = "Online" 00011 __abstract__ = "V&V test case for the <exclude> tag" 00012 __author__ = "S. Tuvi <Stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online" 00013 __date__ = ("$Date: 2006/07/17 18:47:31 $").split(' ')[1] 00014 __version__ = "$Revision: 1.3 $" 00015 __release__ = "$Name: R04-12-00 $" 00016 __credits__ = "SLAC" 00017 00018 import LATTE.copyright_SLAC 00019 00020 import threading 00021 import logging as log 00022 import time 00023 00024 from LATTE.runcontrol.rcTransitions import rcTransitions 00025 00026 class userApplication(rcTransitions): 00027 """V&V test case for the <exclude> tag""" 00028 def __init__(self, rc, userId, debug): 00029 rcTransitions.__init__(self, rc, userId, debug) 00030 log.debug("userApplication.__init__()") 00031 # Initialize the registers to known values 00032 self.__newVal = 0xab 00033 log.info("Initializing TEM[0,1].tkr_trgseq to 0x%x" % self.__newVal) 00034 self.__tem0val = self.lat.TEM[0].tkr_trgseq 00035 self.__tem1val = self.lat.TEM[1].tkr_trgseq 00036 self.lat.TEM[0].tkr_trgseq = self.__newVal 00037 self.lat.TEM[1].tkr_trgseq = self.__newVal 00038 log.info("Global exclude flags: %s" 00039 % self.lat.getAllExcludeFlags()) 00040 log.info("Current exclude flags for TEM 1: %s" 00041 % self.lat.TEM[1].getExcludeFlags()) 00042 00043 def getName(self): 00044 return __name__ 00045 00046 def setup(self): 00047 log.debug("userApplication.setup()") 00048 00049 # A state transition can be rejected by not returning None 00050 return None 00051 00052 def startRun(self): 00053 log.debug("userApplication.startRun()") 00054 00055 if self.rc is not None: 00056 self.rc.doStop() 00057 00058 # A state transition can be rejected by not returning None 00059 return None 00060 00061 def stopRun(self): 00062 log.debug("userApplication.stopRun()") 00063 00064 result1 = True 00065 exp = self.__tem0val 00066 val = self.lat.TEM[0].tkr_trgseq 00067 if val != exp: 00068 log.error("Did not see the expected change in TEM[0].tkr_trgseq:") 00069 log.error("Expecting 0x%x, got 0x%x instead" % (exp, val)) 00070 result1 = False 00071 else: 00072 log.info("TEM[0].tkr_trgseq has the expected value of 0x%x" % val) 00073 00074 result2 = True 00075 exp = self.__newVal 00076 val = self.lat.TEM[1].tkr_trgseq 00077 if val != exp: 00078 log.error("Unexpected change in TEM[1].tkr_trgseq:") 00079 log.error("Expecting 0x%x, got 0x%x instead" % (exp, val)) 00080 result2 = False 00081 else: 00082 log.info("TEM[1].tkr_trgseq has the expected value of 0x%x" % val) 00083 00084 if result1 and result2: 00085 self.setCompletionStatus(self.COMPL_STATUS_PASSED) 00086 else: 00087 self.setCompletionStatus(self.COMPL_STATUS_FAILED) 00088 00089 # The STOP_RUN transition can not be rejected 00090