Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partrans cover #1051

Merged
merged 38 commits into from
Mar 11, 2021
Merged

Partrans cover #1051

merged 38 commits into from
Mar 11, 2021

Conversation

nrnhines
Copy link
Member

@nrnhines nrnhines commented Mar 5, 2021

This has two new features that I find very helpful for coverage.

  1. -DNRN_ENABLE_COVERAGE=ON provides two targets. make cover_begin and make cover_html
    -DNRN_COVERAGE_FILES="semicolon;separated;list;of;files;" limits coverage to those files. I've found that the workflow cycle
    speeds up very satisfyingly
  2. While working on partrans.cpp issues I've found it very helpful to excercise the hoc_execerror calls using the expect_error function.

I built with

cmake .. -DCMAKE_INSTALL_PREFIX=install -DIV_DIR=$HOME/neuron/ivcmake/build/install -DPYTHON_EXECUTABLE=`which python3` -DNRN_ENABLE_TESTS=ON -DNRN_ENABLE_COVERAGE=ON -DNRN_COVERAGE_FILES="src/nrniv/partrans.cpp

At present in test/pynrn

python test_partrans.py
mpiexec -n 2 nrniv -mpi -python test_partrans.py

gives for src/nrniv/partrans.cpp

Lines:	461	530	87.0 %
Date:	2021-03-05 08:01:30		Functions:	75	96	78.1 %
```

nrnhines and others added 18 commits February 21, 2021 13:32
  more convenient for more complicated messages for
  hoc_execerror(const char*, const char*)

Avoid issues when creating 0 length arrays in pc.setup_transfer().
 Message truncates after 512 bytes.
 fileio.cpp no -Wall warnings.
Experiencing two problems: 1) threads 2) voltage source with
extracellular inserted and two targets for it.
Enabled by '-DNRN_ENABLE_COVERAGE=ON'  (default, coverage of everything).
-DNRN_COVERAGE_FILES='semicolon;list;of;files;to;cover'
The files are relative to PROJECT_SOURCE_DIR, e.g.src/nrniv/partrans.cpp
and, for now, can only be the sources involved in the nrniv_lib target.

Provides:
 'make cover_begin' to initialize coverage.
 'make cover_html' generate an html report with all coverage
                   since last 'make cover_begin'
@nrnhines nrnhines marked this pull request as draft March 5, 2021 13:17
Copy link
Member

@alexsavulescu alexsavulescu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice !

# Specific coverage files:
# - OFF : Disable code coverage.
# - ON : Collect code coverage for files (default all).
# - <string> : semicolon (;) separated list of files to collect coverage.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the idea 🚀

CMakeLists.txt Outdated Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented Mar 7, 2021

Codecov Report

Merging #1051 (ebc8113) into master (81eebf4) will increase coverage by 1.28%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1051      +/-   ##
==========================================
+ Coverage   29.29%   30.57%   +1.28%     
==========================================
  Files         570      570              
  Lines      108683   108666      -17     
==========================================
+ Hits        31835    33227    +1392     
+ Misses      76848    75439    -1409     
Impacted Files Coverage Δ
src/nrniv/have2want.cpp 97.82% <100.00%> (+97.82%) ⬆️
src/nrniv/partrans.cpp 99.58% <100.00%> (+57.18%) ⬆️
src/ivos/OS/table.h 50.00% <0.00%> (-50.00%) ⬇️
src/oc/hoc.cpp 65.14% <0.00%> (+0.15%) ⬆️
src/nrnpython/nrnpy_hoc.cpp 52.96% <0.00%> (+0.18%) ⬆️
src/nrnoc/init.cpp 78.14% <0.00%> (+0.22%) ⬆️
src/nrniv/nrncore_write/io/nrncore_io.cpp 74.60% <0.00%> (+0.39%) ⬆️
src/oc/code2.cpp 32.10% <0.00%> (+0.52%) ⬆️
src/nrnoc/treeset.cpp 77.09% <0.00%> (+0.54%) ⬆️
src/nrnoc/fadvance.cpp 52.90% <0.00%> (+0.66%) ⬆️
... and 24 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 81eebf4...ebc8113. Read the comment docs.

src/nrniv/partrans.cpp Outdated Show resolved Hide resolved
src/nrniv/partrans.cpp Outdated Show resolved Hide resolved
src/nrniv/partrans.cpp Outdated Show resolved Hide resolved
src/nrniv/partrans.cpp Outdated Show resolved Hide resolved
nrnhines and others added 7 commits March 8, 2021 06:46
Co-authored-by: Alexandru Săvulescu <alexandru.savulescu@epfl.ch>
Co-authored-by: Alexandru Săvulescu <alexandru.savulescu@epfl.ch>
Co-authored-by: Alexandru Săvulescu <alexandru.savulescu@epfl.ch>
Co-authored-by: Alexandru Săvulescu <alexandru.savulescu@epfl.ch>
@nrnhines nrnhines marked this pull request as ready for review March 9, 2021 00:09
@nrnhines nrnhines merged commit 9549c75 into master Mar 11, 2021
@nrnhines nrnhines deleted the partrans-cover branch March 11, 2021 16:28
alexsavulescu added a commit that referenced this pull request Apr 13, 2021
* hoc_execerr(const char* fmt, ...)
  more convenient for more complicated messages than
  hoc_execerror(const char*, const char*)
  Message truncated after 512 bytes.

* docstring for hoc_execerr(const char fmt, ...)

* Cmake configured code coverage.
Enabled by '-DNRN_ENABLE_COVERAGE=ON'  (default, coverage of everything).
-DNRN_COVERAGE_FILES='semicolon;list;of;files;to;cover'
The files are relative to PROJECT_SOURCE_DIR, e.g.src/nrniv/partrans.cpp
and, for now, can be any sources underneath nrn/src.
Provides:
 'make cover_begin' to initialize coverage.
 'make cover_html' generate an html report with all coverage  since last 'make cover_begin'

* Edit cmake and coverage docs

* Use a KSChan HGap to help with Impedance tests.

* partrans.cpp: replace OS/list.h and nrnhash.h with std:...

The consequence of fewer functions increases function coverage
from 79% to 93%.

* partrans: -Wall warning free

* partrans.cpp improve some error messages

Coverage functions 100% and lines 99.6%.

Co-authored-by: Pramod Kumbhar <pramod.s.kumbhar@gmail.com>
Co-authored-by: Alexandru Săvulescu <alexandru.savulescu@epfl.ch>
alexsavulescu added a commit that referenced this pull request Apr 14, 2021
alexsavulescu added a commit that referenced this pull request Apr 30, 2021
* hoc_execerr(const char* fmt, ...)
  more convenient for more complicated messages than
  hoc_execerror(const char*, const char*)
  Message truncated after 512 bytes.

* docstring for hoc_execerr(const char fmt, ...)

* Cmake configured code coverage.
Enabled by '-DNRN_ENABLE_COVERAGE=ON'  (default, coverage of everything).
-DNRN_COVERAGE_FILES='semicolon;list;of;files;to;cover'
The files are relative to PROJECT_SOURCE_DIR, e.g.src/nrniv/partrans.cpp
and, for now, can be any sources underneath nrn/src.
Provides:
 'make cover_begin' to initialize coverage.
 'make cover_html' generate an html report with all coverage  since last 'make cover_begin'

* Edit cmake and coverage docs

* Use a KSChan HGap to help with Impedance tests.

* partrans.cpp: replace OS/list.h and nrnhash.h with std:...

The consequence of fewer functions increases function coverage
from 79% to 93%.

* partrans: -Wall warning free

* partrans.cpp improve some error messages

Coverage functions 100% and lines 99.6%.

Co-authored-by: Pramod Kumbhar <pramod.s.kumbhar@gmail.com>
Co-authored-by: Alexandru Săvulescu <alexandru.savulescu@epfl.ch>
@alexsavulescu alexsavulescu mentioned this pull request Mar 22, 2022
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants