3 from contentValuesLib
import *
6 """ Option parser class """
8 optparse.OptionParser.__init__(self, usage=
"%prog [options] root_file ...", version=
"%prog 0.0.1", conflict_handler=
"resolve")
9 self.add_option(
"--silent",
"-s", action=
"store_true", dest=
"silent", default=
False, help=
"silent mode: specify return code and exit")
10 self.add_option(
"--subsystem",
"-c", action=
"store", type=
"string", dest=
"subsystem", default=
None, help=
"Specify test subsystem")
12 if __name__ ==
"__main__":
16 (opts, args) = optManager.parse_args()
21 print "At least one ROOT file must be priovided, use --help for hit"
29 print "File [", rfile,
"] not exists or is not accessible?"
32 ss = opts[
'subsystem']
37 (run_number, values) =
getSummaryValues(file_name = rfile, shift_type =
None, translate =
False, filters =
None)
39 if values ==
None or len(values) == 0:
40 print "No content summary values found. Skipping file: %s" % rfile
44 for sub
in SUBSYSTEMS.keys():
46 if not ss ==
None and not sub == ss:
49 if not values.has_key(sub):
50 messages.append(
"%s: missing subsystem!" % sub)
56 for folder
in FOLDERS.keys():
58 if not values[sub].has_key(folder):
59 messages.append(
"%s: missing folder EventInfo/%s" % (sub, folder))
62 if len(values[sub][folder]) == 0:
63 messages.append(
"%s: empty folder EventInfo/%s" % (sub, FOLDERS[folder][1]))
66 sfolders.append(folder)
68 if not values[sub][folder].has_key(
'Summary'):
69 messages.append(
"%s: missing summary value EventInfo/%s" % (sub, FOLDERS[folder][1]))
71 for key
in values[sub][folder].
keys():
74 if not skeys.has_key(key):
80 for folder
in sfolders:
81 if skeys[key].
count(folder) == 0: nfound.append(folder)
83 messages.append(
"%s: value (%s)/%s not found in (%s)" % (sub,
','.
join(skeys[key]), key,
','.
join(nfound)))
85 if not opts[
'silent']:
86 for message
in sorted(messages):
print message
87 print "%d errors found" % len(messages)
89 if len(messages) > 0: sys.exit(1)
static std::string join(char **cmd)