ATLAS Offline Software
diffPoolFiles.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4 
5 # @file: diffPoolFiles.py
6 # @purpose: check that 2 POOL files have same content (containers and sizes)
7 # @author: Sebastien Binet <binet@cern.ch>
8 # @date: March 2007
9 #
10 # @example:
11 #
12 # diffPoolFiles aod.pool ref.aod.pool
13 #
14 
15 __author__ = "Sebastien Binet"
16 
17 import sys
18 import os
19 
20 from optparse import OptionParser
21 
22 if __name__ == "__main__":
23 
24  parser = OptionParser(usage="usage: %prog [options] [-r] file1.pool [-f] file2.pool")
25  parser.add_option( "-r",
26  "--ref",
27  dest = "refFileName",
28  help = "The path to the first POOL file to analyze" )
29  parser.add_option( "-f",
30  "--file",
31  dest = "fileName",
32  help = "The path to the second POOL file to analyze" )
33  parser.add_option( "-v",
34  "--verbose",
35  action = "store_true",
36  dest = "verbose",
37  default = False,
38  help = "Switch to activate verbose printout" )
39  parser.add_option( "-s",
40  "--strict",
41  action = "store_true",
42  dest = "strict",
43  default = False,
44  help = "Compare both memSize and diskSize" )
45 
46 
47  (options, args) = parser.parse_args()
48 
49  if len(args) > 0 and args[0][0] != "-":
50  options.refFileName = args[0]
51  pass
52  if len(args) > 1 and args[1][0] != "-":
53  options.fileName = args[1]
54  pass
55 
56  if options.fileName is None or options.refFileName is None :
57  str(parser.print_help() or "")
58  sys.exit(1)
59  pass
60 
61  chkFileName = os.path.expandvars(os.path.expanduser(options.fileName))
62  refFileName = os.path.expandvars(os.path.expanduser(options.refFileName))
63 
64  import PyUtils.PoolFile as PF
65  diff = PF.DiffFiles( refFileName = refFileName,
66  chkFileName = chkFileName,
67  verbose = options.verbose,
68  strict = options.strict )
69 
70  diff.printSummary()
71  sys.exit(diff.status())
str
Definition: BTagTrackIpAccessor.cxx:11