From 3e4363e9e516346e2fff4570847739f1945432cb Mon Sep 17 00:00:00 2001 From: Patrick Karl Czodrowski <patrick.czodrowski@cern.ch> Date: Fri, 15 Apr 2016 12:08:40 +0200 Subject: [PATCH] add cmake list (TrigValTools-00-04-23) * src/TRootCompare.cxx: Shorten root file names in .ps files * bin/atn_timeline.py: Make it more robust in case log file name cannot be parsed (ATR-13734) * TrigValTools-00-04-22 2016-03-29 Patrick Czodrowski <czodrows@cern.ch> * bin/trigtest.pl: implement solution for $cmt setting avoiding the using undef value in perl + ajust the exit bitmask * TrigValTools-00-04-21 2016-03-29 Patrick Czodrowski <czodrows@cern.ch> * bin/trigtest.pl: fix copy and paste typo by removing my in later $cmt re-definitions * TrigValTools-00-04-20 2016-03-26 Patrick Czodrowski <czodrows@cern.ch> * bin/trigtest.pl: change default_exitmask and add CMAKE_PREFIX_PATH to determine nighlty due to CMTPATH missing in cmake builds * TrigValTools-00-04-19 2016-03-07 Frank Winklmeier <fwinkl@cern> * bin/test-xml-autoconf.py: Use project from NICOS environment (CMake fix) * TrigValTools-00-04-18 ... (Long ChangeLog diff - truncated) --- .../TrigValTools/CMakeLists.txt | 38 +++++++++++++++++ .../TrigValTools/bin/atn_summary.pl | 6 +-- .../TrigValTools/bin/atn_timeline.py | 16 ++++--- .../TrigValTools/bin/chainDump.py | 4 +- .../TrigValTools/bin/check_log.pl | 2 +- .../TrigValTools/bin/test-xml-autoconf.py | 13 ++++-- .../TrigValTools/bin/trigperfmonrtt.py | 12 ++++-- .../TrigValTools/bin/trigtest.pl | 42 +++++++++++++++---- .../macros/TrigTest_CheckCounts.C | 4 +- .../TrigValTools/src/TRootCompare.cxx | 7 +++- 10 files changed, 113 insertions(+), 31 deletions(-) create mode 100644 Trigger/TrigValidation/TrigValTools/CMakeLists.txt diff --git a/Trigger/TrigValidation/TrigValTools/CMakeLists.txt b/Trigger/TrigValidation/TrigValTools/CMakeLists.txt new file mode 100644 index 00000000000..d42d4771664 --- /dev/null +++ b/Trigger/TrigValidation/TrigValTools/CMakeLists.txt @@ -0,0 +1,38 @@ +################################################################################ +# Package: TrigValTools +################################################################################ + +# Declare the package name: +atlas_subdir( TrigValTools ) + +# External dependencies: +find_package( ROOT COMPONENTS Hist Graf Gpad RIO Core Tree MathCore pthread Graf3d Html Postscript Gui GX11TTF GX11 ) + +include_directories(src) + +# Component(s) in the package: +atlas_add_library( TrigValTools + src/*.cxx + PUBLIC_HEADERS TrigValTools + PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ) + +atlas_add_dictionary( TrigValToolsDict + TrigValTools/TrigValToolsDict.h + TrigValTools/selection.xml + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} TrigValTools + OPTIONS " -I$(TRIGVALTOOLSROOT)/src" ) + +# Install files from the package: +atlas_install_python_modules( python/*.py bin/chainDump.py ) +atlas_install_joboptions( share/*.py ) +atlas_install_runtime( macros/*.C bin/chainDump.py ) +atlas_install_scripts( bin/*.py bin/*.pl bin/*.sh ) +atlas_install_generic( html/root2html/*.html + DESTINATION share/TrigValTools/root2html + EXECUTABLE ) +atlas_install_generic( html/perfmonrtt/perfmonrtt.* html/perfmonrtt/*.png html/perfmonrtt/intro.html + DESTINATION share/TrigValTools/perfmonrtt + EXECUTABLE ) + diff --git a/Trigger/TrigValidation/TrigValTools/bin/atn_summary.pl b/Trigger/TrigValidation/TrigValTools/bin/atn_summary.pl index 005c71f45d8..51831f2bae9 100755 --- a/Trigger/TrigValidation/TrigValTools/bin/atn_summary.pl +++ b/Trigger/TrigValidation/TrigValTools/bin/atn_summary.pl @@ -59,13 +59,13 @@ my %no_of_nightlies_exceptions = ('TrigMC',2); my %ERROR = ( OK => 0, SCRIPT_MISC => 1, - POST_TEST_BAD_EXIT => 2, - ROOTCOMP_MISMATCH => 4, + POST_TEST_BAD_EXIT => 2, + ROOTCOMP_MISMATCH => 4, ATHENA_BAD_EXIT => 8, CHECKCOUNTS_FAILED => 16, ATHENA_ERROR_IN_LOG => 32, ATHENA_REGTEST_FAILED => 64, - ATN_TIME_LIMIT => 128, + ATN_TIME_LIMIT => 128, PRECONDITION_FAILED_SO_NOT_RUN => 256 ); diff --git a/Trigger/TrigValidation/TrigValTools/bin/atn_timeline.py b/Trigger/TrigValidation/TrigValTools/bin/atn_timeline.py index f272b53f5d4..040d6cce260 100755 --- a/Trigger/TrigValidation/TrigValTools/bin/atn_timeline.py +++ b/Trigger/TrigValidation/TrigValTools/bin/atn_timeline.py @@ -42,8 +42,14 @@ def parseTestLog(log): # Test name from log file name # Example: Trigger_TrigValidation_TrigP1Test_49__TrigP1Test_TestConfiguration__AllPT_physicsV1_magField_on_off_on__x.loglog - test.name = re.match('.*?_([0-9]+.*)\.loglog',log).group(1) - test.alias = test.name.split('__')[2] + m = re.match('.*?_([0-9]+.*)\.loglog',log) + if m==None: + print "Cannot deduce test name from %s" % log + test.name = log + test.alias = '' + else: + test.name = re.match('.*?_([0-9]+.*)\.loglog',log).group(1) + test.alias = test.name.split('__')[2] for line in f: # Old NICOS version @@ -117,8 +123,8 @@ def main(): testdir = args[0] tests = getTimes(testdir, opts.package) - if tests==None: - print 'No test suites available in',testdir + if tests==None or len(tests)==0: + print 'No test suites available for %s in %s' % (opts.package,testdir) return 0 # Print tests and stats @@ -133,7 +139,7 @@ def main(): for i,t in enumerate(sorted(tests.values(), key=operator.attrgetter('suite','t1'))): f.write('%d %s %s\n' % (i,t.alias,t.suite)) f.close() - + dmin = sorted(tests.values(), key=operator.attrgetter('t1'))[0].t1 dmax = sorted(tests.values(), key=operator.attrgetter('t1'))[-1].t2 print diff --git a/Trigger/TrigValidation/TrigValTools/bin/chainDump.py b/Trigger/TrigValidation/TrigValTools/bin/chainDump.py index 6c900e20432..dc817cfebb6 100755 --- a/Trigger/TrigValidation/TrigValTools/bin/chainDump.py +++ b/Trigger/TrigValidation/TrigValTools/bin/chainDump.py @@ -322,7 +322,7 @@ class chainDump: print "look at file:", file tfile = ROOT.TFile(file) if tfile.IsZombie(): - print "WARNING: ", file, " is misisng or empty" + print "WARNING: ", file, " is missing or empty" return self.error # get list of directories @@ -398,7 +398,7 @@ class chainDump: continue tfile.cd("..") except: - print "ERROR2: cound not cd to directory: ", dir + print "ERROR: cound not cd to directory: ", dir else: print "WARNING: direcory ", dir," not found" diff --git a/Trigger/TrigValidation/TrigValTools/bin/check_log.pl b/Trigger/TrigValidation/TrigValTools/bin/check_log.pl index ae0a6138b03..841abb80809 100755 --- a/Trigger/TrigValidation/TrigValTools/bin/check_log.pl +++ b/Trigger/TrigValidation/TrigValTools/bin/check_log.pl @@ -101,7 +101,7 @@ sub scan_logfile(){ @patterns=(); if ($errors) { push @patterns, "^ERROR | ERROR | FATAL |CRITICAL |ABORT_CHAIN "; - push @patterns, "^Exception\:|Traceback|Shortened traceback|stack trace|^Algorithm stack\:|\.IncludeError|inconsistent use of tabs and spaces in indentation|glibc detected" + push @patterns, "^Exception\:|^Caught signal|^Core dump|Traceback|Shortened traceback|stack trace|^Algorithm stack\:|\.IncludeError|inconsistent use of tabs and spaces in indentation|glibc detected" } if ($warnings) { push @patterns, "WARNING "; diff --git a/Trigger/TrigValidation/TrigValTools/bin/test-xml-autoconf.py b/Trigger/TrigValidation/TrigValTools/bin/test-xml-autoconf.py index f78ece9f3ec..820942beb24 100755 --- a/Trigger/TrigValidation/TrigValTools/bin/test-xml-autoconf.py +++ b/Trigger/TrigValidation/TrigValTools/bin/test-xml-autoconf.py @@ -24,12 +24,17 @@ import os import re if len(sys.argv) < 2: - print 'Syntax: text-xml-autoconf.py test.xml' + print 'Syntax: text-xml-autoconf.py test.xml [output.xml]' sys.exit(1) -project = os.environ.get('AtlasProject','') +output = sys.stdout +if len(sys.argv)==3: + output = open(sys.argv[2],'w') + +# Get project from NICOS or asetup environment +project = os.environ.get('NICOS_PROJECT_NAME',os.environ.get('AtlasProject','')) if len(project)==0: - print 'Cannot read $AtlasProject' + print 'Cannot read $AtlasProject or $NICOS_PROJECT_NAME' sys.exit(1) reDisable = re.compile(".*<\!--\s*DISABLE-IN-PROJECT-BEGIN:\s*(.*)-->") @@ -54,5 +59,5 @@ for line in f: disable = False continue - if not disable: print line, + if not disable: output.write(line) diff --git a/Trigger/TrigValidation/TrigValTools/bin/trigperfmonrtt.py b/Trigger/TrigValidation/TrigValTools/bin/trigperfmonrtt.py index f8f9bab37cb..50632e85da8 100755 --- a/Trigger/TrigValidation/TrigValTools/bin/trigperfmonrtt.py +++ b/Trigger/TrigValidation/TrigValTools/bin/trigperfmonrtt.py @@ -418,8 +418,10 @@ class PerfMonRttResults: dDay = 0 if len(t.stateHistory)>0: - lastTime = t.stateHistory[-1][1] - dDay = (time.time()-time.mktime(time.strptime(lastTime,"%y/%m/%d %H:%M")))/(24*3600) + lastTime = t.stateHistory[-1][1] + if not isinstance(lastTime,int): # format changed at some point + lastTime = time.mktime(time.strptime(lastTime,"%y/%m/%d %H:%M")) + dDay = (time.time()-lastTime)/(24*3600) if dDay>8: log.debug("Skipping test (%s,%s,%s) for %s in rel_%d because it is %d days old" % @@ -751,8 +753,10 @@ class PerfMonRtt2Html(Rtt2Html): cssStatus = "success" if v[i].jobExitCode=="0" else "failure" if len(v[i].stateHistory)>0: - lastTime = v[i].stateHistory[-1][1] - dDay = (time.time()-time.mktime(time.strptime(lastTime,"%y/%m/%d %H:%M")))/(24*3600) + lastTime = v[i].stateHistory[-1][1] + if not isinstance(lastTime,int): # format changed at some point + lastTime = time.mktime(time.strptime(lastTime,"%y/%m/%d %H:%M")) + dDay = (time.time()-lastTime)/(24*3600) # For today's tests figure out which results are still from last week # We define any results older than 4 days as old (somewhat arbitrary but works) if i==iToday and dDay>4: diff --git a/Trigger/TrigValidation/TrigValTools/bin/trigtest.pl b/Trigger/TrigValidation/TrigValTools/bin/trigtest.pl index eb1f0657646..f0eea4cd19d 100755 --- a/Trigger/TrigValidation/TrigValTools/bin/trigtest.pl +++ b/Trigger/TrigValidation/TrigValTools/bin/trigtest.pl @@ -50,7 +50,8 @@ $docout = "doc.txt"; # bit positions marked 1 will be used, 0 will not be used. # SCRIPT_MISC is on the right, ATN_TIME_LIMIT on the left # This default mask can be modified via the 'extra_failure_codes' test directive -$default_exitmask = 0b00101001; +# only "shout" if we see/have: ATHENA_BAD_EXIT => 8 decimal 8 in bit is 0b00001000 thus +$default_exitmask = 0b00001000; # Exit mask of the last run test. Not nice but the easiest way to implement # this on top of all the other ugly things in this script. @@ -179,14 +180,14 @@ sub command_line(){ 'debug!' => \$debug, 'verify!' => \$verify, 'verifyconfig!' => \$verifyconfig, - 'showsummary' => \$showsummary, + 'showsummary' => \$showsummary, 'failkey=s' => \$failkey, 'warnkey=s' => \$warnkey, 'config=s' => \$configfile, - 'test=s' => \@tests, - 'rundir=s' => \$run_dir, - 'cleardir!' => \$clear_dir, - 'package=s' => \$testpackagefq); + 'test=s' => \@tests, + 'rundir=s' => \$run_dir, + 'cleardir!' => \$clear_dir, + 'package=s' => \$testpackagefq); if ($help || !$result) { usage(); prog_error_exit("usage",'SCRIPT_MISC'); @@ -1048,7 +1049,13 @@ sub run_test($){ # get the nightly we are using form the CMTPATH my $nightly = ""; - my $cmt = $ENV{'CMTPATH'}; + my $cmt = ""; + if(defined $ENV{'CMAKE_PREFIX_PATH'}){ + $cmt = $ENV{'CMAKE_PREFIX_PATH'}; + } + else{ + $cmt = $ENV{'CMTPATH'}; + } my $nightlykey = 'builds/nightlies/'; my $keylength = length $nightlykey; my $start = rindex($cmt,$nightlykey) ; @@ -1065,13 +1072,16 @@ sub run_test($){ # rootcomp if ($config{$id}->{'rootcomp'}){ my $rootcomp_file1 = $config{$id}->{'rootcomp_file1'}; - my $rootcomp_file2 = $config{$id}->{'rootcomp_file2'}; + my $rootcomp_file2 = $config{$id}->{'rootcomp_file2'}; if( $nightly ne "" ) { # allow for custom tests with two files $rootcomp_file2 =~ s/latest/$nightly/g ; } $rootcomp_file1 = resolveSymlinks($rootcomp_file1); $rootcomp_file2 = resolveSymlinks($rootcomp_file2); + + if (-e $rootcomp_file1) { + if (-e $rootcomp_file2) { my $rc=systemcall("$config{$id}->{'rootcomp_cmd'} $rootcomp_file1 $rootcomp_file2 > $rootcompout 2>&1", TRUE); if ($rc != 0){ print "=== $name WARNING: monitoring histogram mismatch detected by rootcomp\n"; @@ -1079,8 +1089,18 @@ sub run_test($){ } else { print "=== $name: rootcomp: monitoring histograms match. \n"; } + } + else { + print "=== Alert: $rootcomp_file2 does not exist \n"; + } + } + else { + print "=== Alert: $rootcomp_file1 does not exist \n"; + } #systemcall("cat $rootcompout"); + if (-e $rootcompout) { systemcall("grep -A 5 '^Summary' $rootcompout"); + } } # checkcount @@ -1258,6 +1278,8 @@ sub run_test($){ } else { print "=== This test looks for reference from svn\n"; } + if (-e $reffile) { + # print "old/reference file exists!\n"; systemcall("echo -e 'total lines in old/reference:' `wc -l $reffile` >>$regtestout",TRUE); systemcall("echo -e 'total lines in new/test :' `wc -l $newfile` >>$regtestout",TRUE); systemcall("echo -e '< old/reference\n> new/test' >> $regtestout", TRUE); @@ -1283,6 +1305,10 @@ sub run_test($){ $regtestresult = FALSE; next REGTEST; } + } + else { + print "=== Alert! old/reference file: $reffile does not exist - check if this is a new release!\n"; + } } if (!$regtestresult){ push @statuscodes, 'ATHENA_REGTEST_FAILED'; diff --git a/Trigger/TrigValidation/TrigValTools/macros/TrigTest_CheckCounts.C b/Trigger/TrigValidation/TrigValTools/macros/TrigTest_CheckCounts.C index 3db6ea3c0ad..6ab66ed019e 100644 --- a/Trigger/TrigValidation/TrigValTools/macros/TrigTest_CheckCounts.C +++ b/Trigger/TrigValidation/TrigValTools/macros/TrigTest_CheckCounts.C @@ -251,7 +251,7 @@ void TrigTest_CheckCounts(Int_t toler, const std::string& reffile, std::string gDirectory->GetObject(*hname,tchain); if(tchain==0) { - cout << "checkcounts test warning : no " << *hname + cout << "checkcounts test info : no " << *hname << " in expert-monitoring.root" << endl; continue; } @@ -340,7 +340,7 @@ void TrigTest_CheckCounts(Int_t toler, const std::string& reffile, std::string gDirectory->GetObject(*honame,otchain); if(otchain==0) { - cout << "checkcounts test warning : no " << *honame << " in " + cout << "checkcounts test info : no " << *honame << " in " << reffile << endl; continue; } diff --git a/Trigger/TrigValidation/TrigValTools/src/TRootCompare.cxx b/Trigger/TrigValidation/TrigValTools/src/TRootCompare.cxx index 9e2e2e1c4c1..790d8e45fed 100644 --- a/Trigger/TrigValidation/TrigValTools/src/TRootCompare.cxx +++ b/Trigger/TrigValidation/TrigValTools/src/TRootCompare.cxx @@ -263,13 +263,16 @@ void TRootCompare::processKey(TDirectory& dir, TKey& key) title+=href.GetName(); text.DrawTextNDC(0.5,0.99,title); + const int maxchars = 120; // max #chars for title if (_file) { text.SetTextColor(kBlue); - text.DrawTextNDC(0.5,0.96,_file->GetName()); + string s(_file->GetName()); + text.DrawTextNDC(0.5,0.93,s.substr(s.size()-maxchars).c_str()); } if (_refFile) { text.SetTextColor(kRed); - text.DrawTextNDC(0.5,0.93,_refFile->GetName()); + string s(_refFile->GetName()); + text.DrawTextNDC(0.5,0.96,s.substr(s.size()-maxchars).c_str()); } if (_psFile!="") printCanvas(_psFile); -- GitLab