3 from __future__
import print_function
10 countRE = re.compile (
r'^count_(\w+)')
11 avoid = [
'index',
'print']
14 """returns a tuple. First value is true if summary hasn't found
15 any problems, else false."""
18 compared = summary.get(
'eventsCompared', -1)
19 if len( summary) != 2:
21 for key,value
in summary.items():
22 if countRE.search(key):
24 return (retval, {
'count':count,
'compared':compared})
26 if __name__ ==
"__main__":
29 percentRE = re.compile (
r'%')
30 startOutputRE = re.compile (
r'^Summary$')
31 success1RE = re.compile (
r"{'eventsCompared':\s+(\d+),\s+'count_(\S+)':\s+(\d+)\s*}")
32 success2RE = re.compile (
r"{'count_(\S+)':\s+(\d+),\s+'eventsCompared':\s+(\d+)\s*}")
33 loadingSoRE = re.compile (
r'loading (genobjectrootlibs/\w+)')
34 creatingSoRE = re.compile (
r'creating shared library (\S+)')
35 compRootRE = re.compile (
r' --compRoot=(\S+)')
36 descriptionRE = re.compile (
r'^edmOneToOneComparison.py (\w+).txt')
37 edmCommandRE = re.compile (
r'^(edmOneToOneComparison.py .+?)\s*$')
39 labelErrorRE = re.compile (
r"labelDict = GenObject._ntupleDict\[tupleName\]\['_label'\]")
40 missingLabelRE = re.compile (
r'not able to get')
41 terminatedRE = re.compile (
r'Terminated\s+\$EXE\s+\$@')
42 cppExceptionRE = re.compile (
r'\(C\+\+ exception\)')
43 missingCfgRE = re.compile (
r"raise.+Can't open configuration")
44 finishRE = re.compile (
r'finish')
45 dummyRE = re.compile (
r'edm::Wrapper<dummyType>')
46 noEdmWrapperRE = re.compile (
r"'ROOT' has no attribute 'edm::Wrapper")
47 uint32RE = re.compile (
r"Config file parser error 'operatoruint32_t")
48 nonSpacesRE = re.compile (
r'\S')
49 problemDict = {
'labelDict' : labelErrorRE,
50 'missingLabel' : missingLabelRE,
51 'terminate' : terminatedRE,
53 'cppException' : cppExceptionRE,
54 'missingCfg' : missingCfgRE,
55 'noEdmWrapper' : noEdmWrapperRE,
57 'operator' : re.compile (
r"onfig file parser error 'operator"),
58 'useless' : re.compile (
r'no member functions that are useful'),
59 'lazy' : re.compile (
r': Assertion'),
60 'detset' : re.compile (
r"AttributeError: 'edm::DetSet"),
61 'doubleint' : re.compile (
r'AttributeError: (int|double)'),
64 parser = optparse.OptionParser (
"Usage: %prog logfilePrefix [directory]")
65 parser.add_option (
"--counts", dest=
"counts",
66 action=
"store_true", default=
False,
67 help=
"Display counts only.")
68 parser.add_option (
'--mismatch', dest=
'mismatch',
70 help=
'Displays only mismatch output')
71 parser.add_option (
"--diffTree", dest=
"diffTree",
72 action=
"store_true", default=
False,
73 help=
"Shows diffTree printout.")
74 parser.add_option (
'--makeCompRoot', dest=
'makeCompRoot',
76 help=
'Prints commands to make compRoot files for difftree')
77 parser.add_option (
"--problem", dest=
"problem", type=
'string',
78 help=
"Displays problems matching PROBLEM")
80 options, args = parser.parse_args()
81 if not 1 <= len (args) <= 2:
82 raise RuntimeError(
"Must give directory and log file prefix")
83 logfilePrefix = percentRE.sub (
'*', args[0])
84 if logfilePrefix[-1] !=
'*':
91 files = glob (logfilePrefix)
95 for filename
in oldFiles:
96 files.append (logdir +
'/' + filename)
98 totalFiles = len (files)
112 source = open (log,
'r')
118 line = line.rstrip(
'\n')
119 match = edmCommandRE.search (line)
121 command = match.group(1)
122 match = loadingSoRE.search (line)
124 goShlib = match.group(1)
125 match = creatingSoRE.search (line)
127 goShlib = match.group(1)
129 match = descriptionRE.search (line)
131 objectName = match.group(1)
132 match = compRootRE.search (line)
134 compRoot = match.group(1)
135 match = loadingSoRE.search (line)
137 soName = match.group(1)
139 if not nonSpacesRE.search(line):
143 if startOutputRE.search(line):
147 if success1RE.search (line)
or success2RE.search(line):
150 for key, regex
in problemDict.items():
152 if regex.search(line):
153 if key
in problemSet:
156 problems.setdefault(log,[]).
append(key)
157 if key
not in problemTypes:
158 problemTypes[key] = 1
160 problemTypes[key] += 1
165 summary = eval (summaryLines)
166 ok = summaryOK (summary)
175 successes[log] = pprint.pformat (summary, indent=4)
179 if log
not in problems
and not ok[0]:
180 if not ok[0]
and summary:
182 problems[log] = pprint.pformat (summary, indent=4)
184 if objectName
and compRoot
and soName:
186 varNames = summary.get(objectName, {}).\
187 get(
'_var', {}).
keys()
188 variables = [
'eta',
'phi']
189 for var
in sorted (varNames):
190 if var
not in variables
and var
not in avoid:
191 variables.append (var)
192 diffCmd =
'diffTreeTool.py --skipUndefined %s %s %s' \
193 % (compRoot, soName,
" ".
join(variables))
195 diffOutput[log] = diffCmd
197 problems[log] = [
'other',
'ran:%s' % ran,
198 'success:%s' % success]
200 if key
not in problemTypes:
201 problemTypes[key] = 1
203 problemTypes[key] += 1
204 mismatches = problemTypes.get(
'mismatch', 0)
205 if 'mismatch' in problemTypes:
206 del problemTypes[
'mismatch']
207 print(
"total: ", len (files))
208 print(
"success: ", succeeded)
209 print(
"mismatches: ", mismatches)
210 print(
"weird: ", weird)
211 print(
"Tool issue types:")
213 for key, value
in sorted (problemTypes.items()):
214 print(
" %-15s: %4d" % (key, value))
216 print(
" ",
'-'*13,
" : ----")
217 print(
" %-15s: %4d + %d + %d + %d = %d" \
218 % (
'total', total, succeeded, mismatches, weird,
219 total + succeeded + mismatches + weird))
221 if not options.counts:
222 print(
"\nDetailed Problems list:")
223 for key, problemList
in sorted (problems.items()):
224 if options.problem
and problemList[0] != options.problem:
226 if options.mismatch
and not isinstance (problemList, str):
229 print(
" %s:\n %s\n" % (key, problemList))
230 if options.mismatch
and goShlib
and compRoot:
231 print(
"diffTree %s %s" % (goShlib, compRoot))
232 diffCmd = diffOutput.get(key)
234 print(subprocess.getoutput (diffCmd))
235 if not options.problem
and not options.mismatch:
236 print(
"\n",
'='*78,
'\n')
237 print(
"Success list:")
238 for key, successesList
in sorted (successes.items()):
239 print(
" %s:\n %s\n" % (key, successesList))
boost::dynamic_bitset append(const boost::dynamic_bitset<> &bs1, const boost::dynamic_bitset<> &bs2)
this method takes two bitsets bs1 and bs2 and returns result of bs2 appended to the end of bs1 ...
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
static std::string join(char **cmd)