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'^Summary$')
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,
56 'operator' : re.compile (
r"onfig file parser error 'operator"),
57 'useless' : re.compile (
r'no member functions that are useful'),
58 'lazy' : re.compile (
r': Assertion'),
59 'detset' : re.compile (
r"AttributeError: 'edm::DetSet"),
60 'doubleint' : re.compile (
r'AttributeError: (int|double)'),
63 parser = optparse.OptionParser (
"Usage: %prog logfilePrefix [directory]")
64 parser.add_option (
"--counts", dest=
"counts",
65 action=
"store_true", default=
False,
66 help=
"Display counts only.")
67 parser.add_option (
'--mismatch', dest=
'mismatch',
69 help=
'Displays only mismatch output')
70 parser.add_option (
"--diffTree", dest=
"diffTree",
71 action=
"store_true", default=
False,
72 help=
"Shows diffTree printout.")
73 parser.add_option (
'--makeCompRoot', dest=
'makeCompRoot',
75 help=
'Prints commands to make compRoot files for difftree')
76 parser.add_option (
"--problem", dest=
"problem", type=
'string',
77 help=
"Displays problems matching PROBLEM")
79 options, args = parser.parse_args()
80 if not 1 <= len (args) <= 2:
81 raise RuntimeError,
"Must give directory and log file prefix"
82 logfilePrefix = percentRE.sub (
'*', args[0])
83 if logfilePrefix[-1] !=
'*':
90 files = glob (logfilePrefix)
94 for filename
in oldFiles:
95 files.append (logdir +
'/' + filename)
97 totalFiles = len (files)
111 source = open (log,
'r')
117 line = line.rstrip(
'\n')
118 match = edmCommandRE.search (line)
120 command = match.group(1)
121 match = loadingSoRE.search (line)
123 goShlib = match.group(1)
124 match = creatingSoRE.search (line)
126 goShlib = match.group(1)
128 match = descriptionRE.search (line)
130 objectName = match.group(1)
131 match = compRootRE.search (line)
133 compRoot = match.group(1)
134 match = loadingSoRE.search (line)
136 soName = match.group(1)
138 if not nonSpacesRE.search(line):
142 if startOutputRE.search(line):
146 if success1RE.search (line)
or success2RE.search(line):
149 for key, regex
in problemDict.iteritems():
151 if regex.search(line):
152 if key
in problemSet:
155 problems.setdefault(log,[]).
append(key)
156 if not problemTypes.has_key(key):
157 problemTypes[key] = 1
159 problemTypes[key] += 1
164 summary = eval (summaryLines)
165 ok = summaryOK (summary)
174 successes[log] = pprint.pformat (summary, indent=4)
178 if not problems.has_key (log)
and not ok[0]:
179 if not ok[0]
and summary:
181 problems[log] = pprint.pformat (summary, indent=4)
183 if objectName
and compRoot
and soName:
185 varNames = summary.get(objectName, {}).\
187 variables = [
'eta',
'phi']
188 for var
in sorted (varNames):
189 if var
not in variables
and var
not in avoid:
190 variables.append (var)
191 diffCmd =
'diffTreeTool.py --skipUndefined %s %s %s' \
192 % (compRoot, soName,
" ".
join(variables))
194 diffOutput[log] = diffCmd
196 problems[log] = [
'other',
'ran:%s' % ran,
197 'success:%s' % success]
199 if not problemTypes.has_key(key):
200 problemTypes[key] = 1
202 problemTypes[key] += 1
203 mismatches = problemTypes.get(
'mismatch', 0)
204 if problemTypes.has_key (
'mismatch'):
205 del problemTypes[
'mismatch']
206 print "total: ", len (files)
207 print "success: ", succeeded
208 print "mismatches: ", mismatches
209 print "weird: ", weird
210 print "Tool issue types:"
212 for key, value
in sorted (problemTypes.iteritems()):
213 print " %-15s: %4d" % (key, value)
215 print " ",
'-'*13,
" : ----"
216 print " %-15s: %4d + %d + %d + %d = %d" \
217 % (
'total', total, succeeded, mismatches, weird,
218 total + succeeded + mismatches + weird)
220 if not options.counts:
221 print "\nDetailed Problems list:"
222 for key, problemList
in sorted (problems.iteritems()):
223 if options.problem
and problemList[0] != options.problem:
225 if options.mismatch
and not isinstance (problemList, str):
228 print " %s:\n %s\n" % (key, problemList)
229 if options.mismatch
and goShlib
and compRoot:
230 print "diffTree %s %s" % (goShlib, compRoot)
231 diffCmd = diffOutput.get(key)
233 print commands.getoutput (diffCmd)
234 if not options.problem
and not options.mismatch:
235 print "\n",
'='*78,
'\n'
236 print "Success list:"
237 for key, successesList
in sorted (successes.iteritems()):
238 print " %s:\n %s\n" % (key, successesList)
static std::string join(char **cmd)
T get(const Candidate &c)