From: James P. T. <jpt...@us...> - 2007-09-24 15:45:13
|
Update of /cvsroot/aaf/AAF/Utilities/AAFAnalyzer/python In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv13543/python Modified Files: analyzer.py analyzerhtml_shortcut.py parse.py Log Message: Minor updates to get build working with vc7.1, and to add covered and noted results support to the python html summary generation code. Index: parse.py =================================================================== RCS file: /cvsroot/aaf/AAF/Utilities/AAFAnalyzer/python/parse.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** parse.py 19 Jul 2007 00:03:51 -0000 1.3 --- parse.py 24 Sep 2007 15:45:08 -0000 1.4 *************** *** 62,71 **** def get_all(self): ! all=self.get_id()+': '+self.get_name()+ '\n\n' all=all+'Description: ' +self.get_details() + '\n\n' ! all=all+'Type: ' +self.get_type() + '\n' ! all=all+'Document: ' +self.get_document() + '\n' ! all=all+'Section: ' +self.get_section() + '\n' ! all=all+'Version: ' +self.get_version() return all --- 62,71 ---- def get_all(self): ! all=self.get_id()+': ' +self.get_name()+ '\n\n' all=all+'Description: ' +self.get_details() + '\n\n' ! all=all+'Type: ' +self.get_type() + '\n' ! all=all+'Document: ' +self.get_document() + '\n' ! all=all+'Section: ' +self.get_section() + '\n' ! all=all+'Version: ' +self.get_version() return all *************** *** 199,205 **** return (reqs) ! # This function parses ! # Method parses requirement coverage data from file created by the ! # analyzer.py script def parse_file_coverage(filename, requirements): --- 199,204 ---- return (reqs) ! # This function parses requirement coverage data from file created by ! # the analyzer.py script def parse_file_coverage(filename, requirements): *************** *** 218,223 **** filen=line.strip('File Name: ').strip().split('/')[-1] ! # Update the Pass/Fail/Warn status on each requirement for each ! # file via a dictionary stored in the Requirement object elif 'Passing Requirements:' in line and 'None' not in line: for req in line.strip().replace('Passing Requirements: ','').split('; '): --- 217,233 ---- filen=line.strip('File Name: ').strip().split('/')[-1] ! # Update the Covered/Noted/Pass/Fail/Warn ! # status on each requirement for each file via ! # a dictionary stored in the Requirement ! # object ! ! elif 'Covered Requirements:' in line and 'None' not in line: ! for req in line.strip().replace('Covered Requirements: ','').split('; '): ! requirements[req].set_file_test_result_for_file(filen,'Covered') ! ! elif 'Noted Requirements:' in line and 'None' not in line: ! for req in line.strip().replace('Noted Requirements: ','').split('; '): ! requirements[req].set_file_test_result_for_file(filen,'Noted') ! elif 'Passing Requirements:' in line and 'None' not in line: for req in line.strip().replace('Passing Requirements: ','').split('; '): *************** *** 226,230 **** elif 'Warning Requirements:' in line and 'None' not in line: for req in line.replace('Warning Requirements:','').strip().split('; '): ! requirements[req].set_file_test_result_for_file(filen, 'Passed with Warning') elif 'Failing Requirements:' in line and 'None' not in line: --- 236,240 ---- elif 'Warning Requirements:' in line and 'None' not in line: for req in line.replace('Warning Requirements:','').strip().split('; '): ! requirements[req].set_file_test_result_for_file(filen, 'Warned') elif 'Failing Requirements:' in line and 'None' not in line: *************** *** 313,319 **** # Temporary dictionaries to store pass/warn/fail result counts per file. ! fails = {} ! warns = {} ! passes = {} # Sort requirements for display --- 323,331 ---- # Temporary dictionaries to store pass/warn/fail result counts per file. ! covers = {} ! notes = {} ! fails = {} ! warns = {} ! passes = {} # Sort requirements for display *************** *** 365,368 **** --- 377,384 ---- # update summary counts + if file not in covers: + covers[file] = 0 + if file not in notes: + notes[file] = 0 if file not in fails: fails[file] = 0 *************** *** 374,381 **** if testResult == 'Failed': fails[file] = fails[file] + 1 ! elif testResult == 'Passed with Warning': warns[file] = warns[file] + 1 elif testResult == 'Passed': passes[file] = passes[file] + 1 else: assert False, "unkown test result" --- 390,401 ---- if testResult == 'Failed': fails[file] = fails[file] + 1 ! elif testResult == 'Warned': warns[file] = warns[file] + 1 elif testResult == 'Passed': passes[file] = passes[file] + 1 + elif testResult == 'Noted': + notes[file] = notes[file] + 1 + elif testResult == 'Covered': + covers[file] = covers[file] + 1 else: assert False, "unkown test result" *************** *** 400,405 **** for i in range(0,len(files)): file = files[i] ! data[summaryRow][fileSetCol+i] = str(passes[file]) + ' passed<br>' \ ! + str(warns[file]) + ' warned<br>' \ + str(fails[file]) + ' failed<br>' --- 420,428 ---- for i in range(0,len(files)): file = files[i] ! data[summaryRow][fileSetCol+i] = \ ! str(covers[file]) + ' covered<br>' \ ! + str(notes[file]) + ' noted<br>' \ ! + str(passes[file]) + ' passed<br>' \ ! + str(warns[file]) + ' warned<br>' \ + str(fails[file]) + ' failed<br>' *************** *** 471,475 **** if testResultData[row][col] == 'Failed': TD = TD + ' bgcolor="#CC0000"' ! elif testResultData[row][col] == 'Passed with Warning': TD = TD + ' bgcolor="#FFCC00"' if col > 0: --- 494,498 ---- if testResultData[row][col] == 'Failed': TD = TD + ' bgcolor="#CC0000"' ! elif testResultData[row][col] == 'Warned': TD = TD + ' bgcolor="#FFCC00"' if col > 0: Index: analyzerhtml_shortcut.py =================================================================== RCS file: /cvsroot/aaf/AAF/Utilities/AAFAnalyzer/python/analyzerhtml_shortcut.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** analyzerhtml_shortcut.py 19 Jul 2007 14:10:16 -0000 1.2 --- analyzerhtml_shortcut.py 24 Sep 2007 15:45:08 -0000 1.3 *************** *** 12,17 **** # assuming the following: # ! # 1) The temp output files and html file should be written to the present ! # working directory and given temporary names. # 2) The requirents file is in the present working directory. # 3) The analyzer executable is the in the present working directory. --- 12,18 ---- # assuming the following: # ! # 1) The temp output files and html file should be written to the ! # system's standard tempory file location as reported by the python ! # tempfile module. # 2) The requirents file is in the present working directory. # 3) The analyzer executable is the in the present working directory. *************** *** 72,80 **** # Give people 5 seconds to see what just happened. - os.write(1,"closing in ") for i in range(5,0,-1): ! n = os.write(1, "%d seconds" % i ) time.sleep(1) ! if i > 1: ! for j in range(0,n): ! os.write(1, "\b") --- 73,80 ---- # Give people 5 seconds to see what just happened. for i in range(5,0,-1): ! n = os.write(1, "closing in %d seconds" % i ) time.sleep(1) ! os.write(1, n*"\b") ! os.write(1, n*" ") ! Index: analyzer.py =================================================================== RCS file: /cvsroot/aaf/AAF/Utilities/AAFAnalyzer/python/analyzer.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** analyzer.py 19 Jul 2007 14:10:16 -0000 1.3 --- analyzer.py 24 Sep 2007 15:45:08 -0000 1.4 *************** *** 71,75 **** # result file under than name "File Set". i.e. The file set is report # in the same way that indivual files are reported. This is not very ! # flexible. It woudl be better to return the file set data as a value # (and perhaps do away completly with the temp file). # --- 71,75 ---- # result file under than name "File Set". i.e. The file set is report # in the same way that indivual files are reported. This is not very ! # flexible. It would be better to return the file set data as a value # (and perhaps do away completly with the temp file). # *************** *** 77,80 **** --- 77,82 ---- def filescov(openTmpResultFile, files): + covered=[] + noted=[] passed=[] warn=[] *************** *** 90,93 **** --- 92,99 ---- for line in curfile: + if 'Covered Requirements:' in line and 'None' not in line: + covered=covered+(line.replace('Covered Requirements: ', '').replace('\n', '')).split('; ') + if 'Noted Requirements:' in line and 'None' not in line: + noted=passed+(line.replace('Noted Requirements: ', '').replace('\n', '')).split('; ') if 'Passing Requirements:' in line and 'None' not in line: passed=passed+(line.replace('Passing Requirements: ', '').replace('\n', '')).split('; ') *************** *** 98,121 **** openTmpResultFile.seek(0) ! passed=list(set(passed).difference(set(warn)).difference(set(fail))) ! passed.sort() ! warn=list(set(warn).difference(set(fail))) ! warn.sort() ! fail=list(set(fail)) fail.sort() - openTmpResultFile.write('File Set:\n') - - if passed==[]: - passed.append('None') - if warn==[]: - warn.append('None') if fail==[]: fail.append('None') for f in files: openTmpResultFile.write('\t%s\n' % f) ! openTmpResultFile.write('Passing Requirements: ' + '; '.join(passed) +'\n') ! openTmpResultFile.write('Warning Requirements: ' + '; '.join(warn) +'\n') ! openTmpResultFile.write('Failing Requirements: ' + '; '.join(fail) +'\n\n') openTmpResultFile.writelines(curfile) --- 104,148 ---- openTmpResultFile.seek(0) ! ! failSet = set(fail) ! fail = list(failSet) fail.sort() if fail==[]: fail.append('None') + + warnSet = set(warn).difference(failSet) + warn =list(warnSet) + warn.sort() + if warn==[]: + warn.append('None') + + passedSet = set(passed).difference(warnSet).difference(failSet) + passed = list(passedSet) + passed.sort() + if passed==[]: + passed.append('None') + + notedSet = set(noted).difference(passedSet).difference(warnSet).difference(failSet) + noted = list(notedSet) + noted.sort() + if noted==[]: + noted.append('None') + + coveredSet = set(covered).difference(notedSet).difference(passedSet).difference(warnSet).difference(failSet) + covered= list( coveredSet ) + covered.sort() + if covered==[]: + covered.append('None') + + openTmpResultFile.write('File Set:\n') for f in files: openTmpResultFile.write('\t%s\n' % f) ! ! openTmpResultFile.write('Covered Requirements: ' + '; '.join(covered) + '\n') ! openTmpResultFile.write('Noted Requirements: ' + '; '.join(noted) + '\n') ! openTmpResultFile.write('Passing Requirements: ' + '; '.join(passed) + '\n') ! openTmpResultFile.write('Warning Requirements: ' + '; '.join(warn) + '\n') ! openTmpResultFile.write('Failing Requirements: ' + '; '.join(fail) + '\n\n') openTmpResultFile.writelines(curfile) |