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

Jed Brown jed at jedbrown.org
Fri Mar 16 11:35:48 CDT 2018


Satish Balay <balay at mcs.anl.gov> writes:

> 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')

So OBJDIR is only used in one place (so can just define it in that
scope) and PETSC_ARCH is only ever used to define OBJDIR.

But PETSC_DIR is needed by make_htmlpage (so both modes require it).

Not tested, but I assume this would work:

diff --git i/lib/petsc/bin/maint/gcov.py w/lib/petsc/bin/maint/gcov.py
index 6d0e1e0342..f4072c3076 100755
--- i/lib/petsc/bin/maint/gcov.py
+++ w/lib/petsc/bin/maint/gcov.py
@@ -15,8 +15,6 @@ 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):
 
@@ -38,6 +36,8 @@ def run_gcov(gcov_dir):
             csrc_file = file_name.endswith('.c')
             if csrc_file:
                 c_file = file_name.split('.c')[0]
+                PETSC_ARCH = os.environ['PETSC_ARCH']
+                OBJDIR = os.path.join(PETSC_DIR, PETSC_ARCH, 'obj')
                 objpath = os.path.join(OBJDIR, os.path.relpath(c_file, PETSC_DIR))
                 gcov_graph_file = objpath+".gcno"
                 gcov_data_file  = objpath+".gcda"


More information about the petsc-dev mailing list