9 countRE = re.compile (
r'^count_(\w+)')
10 avoid = [
'index',
'print']
13 """returns a tuple. First value is true if summary hasn't found
14 any problems, else false."""
17 compared = summary.get(
'eventsCompared', -1)
18 if len( summary.keys()) != 2:
20 for key,value
in summary.iteritems():
21 if countRE.search(key):
23 return (retval, {
'count':count,
'compared':compared})
25 if __name__ ==
"__main__":
28 percentRE = re.compile (
r'%')
29 startOutputRE = re.compile (
r'^problems$')
30 success1RE = re.compile (
r"{'eventsCompared':\s+(\d+),\s+'count_(\S+)':\s+(\d+)\s*}")
31 success2RE = re.compile (
r"{'count_(\S+)':\s+(\d+),\s+'eventsCompared':\s+(\d+)\s*}")
32 loadingSoRE = re.compile (
r'loading (genobjectrootlibs/\w+)')
33 creatingSoRE = re.compile (
r'creating shared library (\S+)')
34 compRootRE = re.compile (
r' --compRoot=(\S+)')
35 descriptionRE = re.compile (
r'^edmOneToOneComparison.py (\w+).txt')
36 edmCommandRE = re.compile (
r'^(edmOneToOneComparison.py .+?)\s*$')
38 labelErrorRE = re.compile (
r"labelDict = GenObject._ntupleDict\[tupleName\]\['_label'\]")
39 missingLabelRE = re.compile (
r'not able to get')
40 terminatedRE = re.compile (
r'Terminated\s+\$EXE\s+\$@')
41 cppExceptionRE = re.compile (
r'\(C\+\+ exception\)')
42 missingCfgRE = re.compile (
r"raise.+Can't open configuration")
43 finishRE = re.compile (
r'finish')
44 dummyRE = re.compile (
r'edm::Wrapper<dummyType>')
45 noEdmWrapperRE = re.compile (
r"'ROOT' has no attribute 'edm::Wrapper")
46 uint32RE = re.compile (
r"Config file parser error 'operatoruint32_t")
47 nonSpacesRE = re.compile (
r'\S')
48 problemDict = {
'labelDict' : labelErrorRE,
49 'missingLabel' : missingLabelRE,
50 'terminate' : terminatedRE,
52 'cppException' : cppExceptionRE,
53 'missingCfg' : missingCfgRE,
54 'noEdmWrapper' : noEdmWrapperRE,
58 parser = optparse.OptionParser (
"Usage: %prog logfilePrefix [directory]")
59 parser.add_option (
"--counts", dest=
"counts",
60 action=
"store_true", default=
False,
61 help=
"Display counts only.")
62 parser.add_option (
'--mismatch', dest=
'mismatch',
64 help=
'Displays only mismatch output')
65 parser.add_option (
"--diffTree", dest=
"diffTree",
66 action=
"store_true", default=
False,
67 help=
"Shows diffTree printout.")
68 parser.add_option (
'--makeCompRoot', dest=
'makeCompRoot',
70 help=
'Prints commands to make compRoot files for difftree')
71 parser.add_option (
"--problem", dest=
"problem", type=
'string',
72 help=
"Displays problems matching PROBLEM")
74 options, args = parser.parse_args()
75 if not 1 <= len (args) <= 2:
76 raise RuntimeError,
"Must give directory and log file prefix"
77 logfilePrefix = percentRE.sub (
'*', args[0])
78 if logfilePrefix[-1] !=
'*':
85 files = glob (logfilePrefix)
89 for filename
in oldFiles:
90 files.append (logdir +
'/' + filename)
92 totalFiles = len (files)
106 source = open (log,
'r')
112 line = line.rstrip(
'\n')
113 match = edmCommandRE.search (line)
115 command = match.group(1)
116 match = loadingSoRE.search (line)
118 goShlib = match.group(1)
119 match = creatingSoRE.search (line)
121 goShlib = match.group(1)
123 match = descriptionRE.search (line)
125 objectName = match.group(1)
126 match = compRootRE.search (line)
128 compRoot = match.group(1)
129 match = loadingSoRE.search (line)
131 soName = match.group(1)
133 if not nonSpacesRE.search(line):
137 if startOutputRE.search(line):
141 if success1RE.search (line)
or success2RE.search(line):
144 for key, regex
in problemDict.iteritems():
146 if regex.search(line):
147 if key
in problemSet:
150 problems.setdefault(log,[]).
append(key)
151 if not problemTypes.has_key(key):
152 problemTypes[key] = 1
154 problemTypes[key] += 1
159 summary = eval (summaryLines)
160 ok = summaryOK (summary)
169 successes[log] = pprint.pformat (summary, indent=4)
173 if not problems.has_key (log)
and not ok[0]:
174 if not ok[0]
and summary:
176 problems[log] = pprint.pformat (summary, indent=4)
178 if objectName
and compRoot
and soName:
180 varNames = summary.get(objectName, {}).\
182 variables = [
'eta',
'phi']
183 for var
in sorted (varNames):
184 if var
not in variables
and var
not in avoid:
185 variables.append (var)
186 diffCmd =
'diffTreeTool.py --skipUndefined %s %s %s' \
187 % (compRoot, soName,
" ".
join(variables))
189 diffOutput[log] = diffCmd
191 problems[log] = [
'other',
'ran:%s' % ran,
192 'success:%s' % success]
194 if not problemTypes.has_key(key):
195 problemTypes[key] = 1
197 problemTypes[key] += 1
198 mismatches = problemTypes.get(
'mismatch', 0)
199 if problemTypes.has_key (
'mismatch'):
200 del problemTypes[
'mismatch']
201 print "total: ", len (files)
202 print "success: ", succeeded
203 print "mismatches: ", mismatches
204 print "weird: ", weird
205 print "Tool issue types:"
207 for key, value
in sorted (problemTypes.iteritems()):
208 print " %-15s: %4d" % (key, value)
210 print " ",
'-'*13,
" : ----"
211 print " %-15s: %4d + %d + %d + %d = %d" \
212 % (
'total', total, succeeded, mismatches, weird,
213 total + succeeded + mismatches + weird)
215 if not options.counts:
216 print "\nDetailed Problems list:"
217 for key, problemList
in sorted (problems.iteritems()):
218 if options.problem
and problemList[0] != options.problem:
220 if options.mismatch
and not isinstance (problemList, str):
223 print " %s:\n %s\n" % (key, problemList)
224 if options.mismatch
and goShlib
and compRoot:
225 print "diffTree %s %s" % (goShlib, compRoot)
226 diffCmd = diffOutput.get(key)
228 print commands.getoutput (diffCmd)
229 if not options.problem
and not options.mismatch:
230 print "\n",
'='*78,
'\n'
231 print "Success list:"
232 for key, successesList
in sorted (successes.iteritems()):
233 print " %s:\n %s\n" % (key, successesList)
static std::string join(char **cmd)
T get(const Candidate &c)