[petsc-dev] Test Code Coverage (gcov) page is missing

Satish Balay balay at mcs.anl.gov
Fri Mar 16 10:40:26 CDT 2018


On Fri, 16 Mar 2018, Junchao Zhang wrote:

> The coverage page at http://ftp.mcs.anl.gov/pub/petsc/nightlylogs/index.html
> is missing. When I read certain PETSc code, I feel some if conditions will
> never be met (i.e., there are dead statements). To confirm that, I want to
> know which tests run into that condition.

Thanks - its updated now.


Jed,

I must have messedup the testing of the latest gcov changes..

>>>>>>>
[thwomp:petsc/nightlylogs/gcov] petsc> cat ~/nightlylogs/archive/2018/03/16/gcov-snapshot-update.log
Traceback (most recent call last):
  File "/sandbox/petsc/petsc.clone/lib/petsc/bin/maint/gcov.py", line 18, in <module>
    PETSC_ARCH = os.environ['PETSC_ARCH']
  File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__
    raise KeyError(key)
KeyError: 'PETSC_ARCH'
<<<<<<<

So the issue is - this script is run in 2 different modes:

lib/petsc/bin/maint/gcov.py:        print "         ./gcov.py -run_gcov      "
lib/petsc/bin/maint/gcov.py:        print "         ./gcov.py -merge_gcov [LOC] tarballs"

For the second mode is with [LOC] - i.e there is no prior build - i.e no PETSC_ARCH

So how about the following change?

diff --git a/lib/petsc/bin/maint/gcov.py b/lib/petsc/bin/maint/gcov.py
index 6d0e1e0..0a49978 100755
--- a/lib/petsc/bin/maint/gcov.py
+++ b/lib/petsc/bin/maint/gcov.py
@@ -14,10 +14,6 @@ import operator
 import sys
 from   time import gmtime,strftime
 
-PETSC_DIR = os.environ['PETSC_DIR']
-PETSC_ARCH = os.environ['PETSC_ARCH']
-OBJDIR = os.path.join(PETSC_DIR, PETSC_ARCH, 'obj')
-
 def run_gcov(gcov_dir):
 
     # 1. Runs gcov
@@ -389,11 +385,15 @@ def make_htmlpage(gcov_dir,LOC,tarballs):
 
 def main():
 
+    global PETSC_DIR,PETSC_ARCH,OBJDIR
     USER = os.environ['USER']
     gcov_dir = "/tmp/gcov-"+USER
+    PETSC_DIR = os.environ['PETSC_DIR']
 
     if (sys.argv[1] == "-run_gcov"):
         print "Running gcov and creating tarball"
+        PETSC_ARCH = os.environ['PETSC_ARCH']
+        OBJDIR = os.path.join(PETSC_DIR, PETSC_ARCH, 'obj')
         run_gcov(gcov_dir)
         make_tarball(gcov_dir)
     elif (sys.argv[1] == "-merge_gcov"):


Satish


More information about the petsc-dev mailing list