- 時間撮記:
- 2016-5-6 下午02:22:01 (9 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/ValidationKit/testdriver/reporter.py
r60851 r60863 940 940 """ File like class for the test pipe (TXS EXEC and similar). """ 941 941 def __init__(self): 942 self.sPrefix = ''; 943 self.fStarted = False; 944 self.fClosed = False; 942 self.sPrefix = ''; 943 self.fStarted = False; 944 self.fClosed = False; 945 self.sTagBuffer = None; 945 946 946 947 def __del__(self): … … 979 980 try: 980 981 g_oReporter.subXmlWrite(self, sText, utils.getCallerName()); 982 # Parse the supplied text and look for <Failed.../> tags to keep track of the 983 # error counter. This is only a very lazy aproach. 984 sText.strip(); 985 idxText = 0; 986 while len(sText) > 0: 987 if self.sTagBuffer is None: 988 # Look for the start of a tag. 989 idxStart = sText[idxText:].find('<'); 990 if idxStart != -1: 991 # Look for the end of the tag. 992 idxEnd = sText[idxStart:].find('>'); 993 994 # If the end was found inside the current buffer, parse the line, 995 # else we have to save it for later. 996 if idxEnd != -1: 997 idxEnd += idxStart + 1; 998 self._processXmlElement(sText[idxStart:idxEnd]); 999 idxText = idxEnd; 1000 else: 1001 self.sTagBuffer = sText[idxStart:]; 1002 idxText = len(sText); 1003 else: 1004 idxText = len(sText); 1005 else: 1006 # Search for the end of the tag and parse the whole tag. 1007 idxEnd = sText[idxText:].find('>'); 1008 if idxEnd != -1: 1009 idxEnd += idxStart + 1; 1010 self._processXmlElement(self.sTagBuffer + sText[idxText:idxEnd]); 1011 self.sTagBuffer = None; 1012 idxText = idxEnd; 1013 else: 1014 self.sTagBuffer = self.sTagBuffer + sText[idxText:]; 1015 idxText = len(sText); 1016 1017 sText = sText[idxText:]; 1018 sText = sText.lstrip(); 981 1019 except: 982 1020 traceback.print_exc(); 983 1021 return None; 984 1022 985 1023 def _processXmlElement(self, sElement): 1024 """ 1025 Processes a complete XML tag (so far we only search for the Failed to tag 1026 to keep track of the error counter. 1027 """ 1028 # Make sure we don't parse any space between < and the element name. 1029 sElement = sElement.strip(); 1030 1031 # Find the end of the name 1032 idxEndName = sElement.find(' '); 1033 if idxEndName == -1: 1034 idxEndName = sElement.find('/'); 1035 if idxEndName == -1: 1036 idxEndName = sElement.find('>'); 1037 1038 if idxEndName != -1: 1039 if sElement[1:idxEndName] == 'Failed': 1040 g_oLock.acquire(); 1041 g_oReporter.testIncErrors(); 1042 g_oLock.release(); 1043 else: 1044 error('_processXmlElement(%s)' % sElement); 1045 sys.exit('error'); 986 1046 # 987 1047 # The public APIs.
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器