Re: [GRASS-dev] [GRASS GIS] #3819: Add test coverage of C files

2019-04-18 Thread GRASS GIS
#3819: Add test coverage of C files
--+-
  Reporter:  pmav99   |  Owner:  grass-dev@…
  Type:  enhancement  | Status:  new
  Priority:  normal   |  Milestone:
 Component:  Compiling|Version:  svn-trunk
Resolution:   |   Keywords:
   CPU:  Unspecified  |   Platform:  Unspecified
--+-

Comment (by rouault):

 > GDAL is already using gcov/lcov, too, so it might make sense to see how
 they have integrated them

 This is quite messy to be honest. Partly because I didn't try to make this
 better :-) So basically, I've a job that forks the GDAL master branch and
 re-applies the following changes on top of it :
 
https://github.com/rouault/gdal_coverage/commit/3b63c70890a0897dcbe1cbd49f36b76e0a5e704a
 But the gist is build with lcov, run the tests, run lcov, filter some
 stuff in its output to have a clean report, run genhtml and then push this
 to a github repo. The interesting part that could be more or less reused
 by GRASS is in
 
https://github.com/rouault/gdal_coverage/commit/3b63c70890a0897dcbe1cbd49f36b76e0a5e704a
 #diff-46c965c7db8bedae7518f42e783c44dd

-- 
Ticket URL: 
GRASS GIS 

___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] [GRASS GIS] #3819: Add test coverage of C files

2019-04-18 Thread GRASS GIS
#3819: Add test coverage of C files
--+-
  Reporter:  pmav99   |  Owner:  grass-dev@…
  Type:  enhancement  | Status:  new
  Priority:  normal   |  Milestone:
 Component:  Compiling|Version:  svn-trunk
Resolution:   |   Keywords:
   CPU:  Unspecified  |   Platform:  Unspecified
--+-

Comment (by pmav99):

 For the record, GDAL is already using gcov/lcov, too, so it might make
 sense to see how they have integrated them: https://gdalautotest-coverage-
 results.github.io/coverage_html/index.html

-- 
Ticket URL: 
GRASS GIS 

___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

[GRASS-dev] [GRASS GIS] #3819: Add test coverage of C files

2019-04-18 Thread GRASS GIS
#3819: Add test coverage of C files
-+-
 Reporter:  pmav99   |  Owner:  grass-dev@…
 Type:  enhancement  | Status:  new
 Priority:  normal   |  Milestone:
Component:  Compiling|Version:  svn-trunk
 Keywords:   |CPU:  Unspecified
 Platform:  Unspecified  |
-+-
 Disclaimer: I've only tested with gcc.

 Using the info from these links I managed to get test coverage for the C
 codebase:

 - https://stackoverflow.com/questions/16682606/how-to-resovle-gcov-init-
 undefined-reference-issue-when-link
 - https://stackoverflow.com/questions/39086957/test-coverage-from-swig-
 compiled-c-python-code

 1. install [https://gcc.gnu.org/onlinedocs/gcc/Gcov.html gcov]
 2. Compile with these options:
 {{{
 export CFLAGS='-O0 -fPIC -march=native -std=gnu99 -fprofile-arcs -ftest-
 coverage -g'
 export LDFLAGS='-s -lgcov --coverage'
 }}}
 3. Run tests
 4. Generate test coverage reports (there may be warning/errors):
 {{{
 mkdir -p coverage
 gcovr -r . --filter="" --html --html-details -o coverage/coverage.html
 }}}
 5. Inspect coverage:
 {{{
 firefox coverage/coverage.html
 }}}

 If possible, this should be added to fatra and once #3771 is resolved, on
 travis too.

 I guess that it would also make sense to add a configure option like e.g.
 [https://www.gaia-gis.it/fossil/libspatialite/artifact/f5c88dedc9888f65
 libspatialite]:
 {{{

 #---
 #--enable-gcov
 #
 # Check whether --enable-gcov was given.
 if test "${enable_gcov+set}" = set; then :
   enableval=$enable_gcov;
 fi

 if test "x$enable_gcov" = "xyes"; then
 CFLAGS=$CFLAGS" -fprofile-arcs -ftest-coverage -g"
 GCOV_FLAGS="-lgcov"
 fi
 #---
 }}}

-- 
Ticket URL: 
GRASS GIS 

___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev