7 from optparse 
import OptionParser
 
   10  simple script to run diff-root only on tests which show differences in diff-pool 
   11  either create a diff pool by hand first or just download the ESDTAGCOMM_comparison_log  
   12  of the current nightly: 
   14  wget https://atlas-rtt.cern.ch/prod/tct/rel_3/20.1.X.Y-VAL/build/x86_64-slc6-gcc48-opt/offline/Tier0ChainTests/ESDTAGCOMM_comparison/ESDTAGCOMM_comparison_log 
   16  then execute the script with the comparison log: 
   18  ./runDiffRootOnChanged.py -f ESDTAGCOMM_comparison_log 
   25  first evaluate last 40 lines of the diff-pool log 
   26  and extract tests with changed 
   31     f = 
open(filename, 
'r')
 
   32     lines = f.readlines(); f.close()
 
   33     for line 
in lines[-40:]:
 
   35             changed_tests.append(line.split()[0])           
 
   40   exectute diff-root command 
   43     outfile = 
"%s_%s.log" %(test, ftype)
 
   44     command =  
"acmd.py diff-root %s %s --error-mode resilient --ignore-leaves RecoTimingObj_p1_HITStoRDO_timings RecoTimingObj_p1_RAWtoESD_mems RecoTimingObj_p1_RAWtoESD_timings RAWtoESD_mems RAWtoESD_timings ESDtoAOD_mems ESDtoAOD_timings HITStoRDO_timings  --entries 10  >> %s" %(pool_list[0], pool_list[1], outfile)
 
   53   since some pool files are located on eos others are on afs 
   54   this little hack is needed to get all files for the comparison 
   58     repl = 
"rel%s" %(ref.split(
"rel")[1].
split(
"/")[0])
 
   59     newversion = 
"rel_%i" %(
int(repl.split(
"_")[1])+1)
 
   60     filename = ref.replace(repl,newversion)
 
   61     if os.path.isfile(filename):
 
   62         ESD_list.append(filename)
 
   66   extract path to pool files from diff-pool log  
   67   skip tests with failing tests 
   68   then execute diff_root for every pair 
   77         f = 
open(logfile, 
'r')
 
   79             if ".pool.root" in line 
and "open" in line 
and test 
in line:
 
   81                     AOD_list.append( line.split(
'[')[1].
split(
']')[0])
 
   83                     ESD_list.append( line.split(
'[')[1].
split(
']')[0]) 
 
   87         if len(ESD_list) == 1:
 
   89         if len(AOD_list) == 1:
 
   93             print (
"ERROR missing ESD file for diff-root comparison"           )
 
   95             print (
"INFO evaluate ESD diff-root")
 
   99             print (
"ERROR missing AOD file for diff-root comparison")
 
  101             print (
"INFO evaluate AOD diff-root")
 
  107     rels = [
"rel_2",
"rel_3"]
 
  109         path = 
"/afs/cern.ch/atlas/project/RTT/prod/Results/tct/REL/20.1.X.Y-VAL/build/x86_64-slc6-gcc48-opt/offline/Tier0ChainTests/%s/" %(test)
 
  116             aod = path.replace(
"REL",rel)+
"myAOD.pool.root" 
  117             esd = path.replace(
"REL",rel)+
"myESD.pool.root" 
  118             if os.path.isfile(aod):
 
  120             if os.path.isfile(esd):
 
  124         if len(ESD_list) < 2:
 
  125             print (
"ERROR missing ESD file for diff-root comparison"           )
 
  127             print (
"INFO evaluate ESD diff-root")
 
  130         if len(AOD_list) < 2:
 
  131             print (
"ERROR missing AOD file for diff-root comparison")
 
  133             print (
"INFO evaluate AOD diff-root")
 
  136 parser=OptionParser(usage=
"\n ./runDiffRootOnChanged.py --file <file name with full diff-pool log > \n")
 
  137 parser.add_option(
"-f",
"--file"      ,type=
"string"        ,dest=
"filename"    ,default=
"none"    ,help=
"diff pool log file")
 
  138 parser.add_option(
"-d",
"--dryRun", action=
"store_true"  ,dest=
"dryrun"  ,default=
False     ,help=
"only dumps commands on screen")
 
  141 (options,args)=parser.parse_args()
 
  142 logfile = options.filename
 
  146 print (
"INFO following tests changed")
 
  152     print (
"All Tests are identical no further checks needed")