Skip to content

Add Robert's API tests to CTest#2365

Merged
ramcdougal merged 6 commits into
apifrom
olupton/api
Jun 25, 2023
Merged

Add Robert's API tests to CTest#2365
ramcdougal merged 6 commits into
apifrom
olupton/api

Conversation

@olupton

@olupton olupton commented May 22, 2023

Copy link
Copy Markdown
Collaborator

Logically sits on top of #2357, currently targeting master so all the CI runs.

@azure-pipelines

Copy link
Copy Markdown

✔️ 7f6ce29 -> Azure artifacts URL

@olupton olupton requested a review from ramcdougal May 22, 2023 18:25
@olupton olupton changed the base branch from master to api May 22, 2023 18:32
@olupton olupton marked this pull request as ready for review May 22, 2023 18:33
@olupton

olupton commented May 22, 2023

Copy link
Copy Markdown
Collaborator Author

@ramcdougal I think this is the plumbing you need; the failures are at least somewhat genuine..

For what it's worth, the pattern in netcon.cpp is sketchier than what I had in mind. There we are trying to launch an executable that has undefined symbols with the promise that they will appear before they are actually called/used.

What I was originally suggesting as a way of avoiding explicit calls to dlsym was to build a shared library (libfoo.so) with undefined symbols (the API functions), but to load the definitions of those symbols (libnrniv.so) before ever opening libfoo.so. It doesn't seem shocking to me that the pattern in netcon.cpp is fragile/non-portable.

@olupton

olupton commented May 22, 2023

Copy link
Copy Markdown
Collaborator Author

By the way, the reference files I added here were generated with AppleClang on an Intel MacBook and -O2.

@olupton olupton mentioned this pull request May 22, 2023
@azure-pipelines

Copy link
Copy Markdown

✔️ 7f6ce29 -> Azure artifacts URL

@ramcdougal ramcdougal merged commit 0c85738 into api Jun 25, 2023
ramcdougal added a commit that referenced this pull request May 31, 2024
* initial partial API

* nrnpy_set_pr_etal should be extern C

* nrn_call_function leaves results on stack

* segments, properties

* including hocdec.h to try to avoid Datum errors on some systems

* sectionlist and allsec hoc_Item getters

* symbol and object introspection

* symbol table getting and interating

* object ref, push

* Renamed files to avoid having two nrnapi.h files.

On some systems (most? but not the one I used for everything else),
some files tried to include the wrong nrnapi.h during the
"make install" phase.

* neuronapi.cpp no longer uses its .h, that is now a header for 3rd party tools

* switched to enum for stack types

* needed typedefs for C to be happy

* test: sections.c

* clang-format

* replaced hoc_Item with new synonym nrn_Item

* netcon example shows no need for dlsym

* support for .so files in addition to .dylib

* removed an excess const

We'll still treat the pointer as const, but the user has no reason to care.

* Add Robert's API tests to CTest (#2365)

* build + run tests

* fixups

* different fixup

* add -rdynamic

* bugfix flagged by ASan

* fix to header file name of api

* hh_sim and sections work with handles
don't have quantitative identity with the old hh_sim results, but very
close.

* rename stack_types_t per @olupton

* replace param_handle with param

* working vclamp

* unified API property functions

* getters use const args

* forgot to commit sections

* vector_capacity now on const obj

* Several improvements

 - C/C++ api header included in implementation
 - signatures made compatible
 - public nrn_Item defined as inheriting from hoc_Item
 - dropped overlapping definitions. types are both fw declarations and
   opaque types

* Make tests link against nrniv_lib, no dlopen

* Address sonar lint reservations

* Make comparisons be part of the test and account for fp innacuraciesa

* Tests to find ref files

* api: Make tests resilient to accumulated errors

* Use in-test ref result, depending on NRN_ENABLE_CORENEURON

* Use free for allocated c strings

* Dont alloc Section Item to heap as its not used.

NOTE: It seems that Sections are never freed. However we are
lacking API to free Sections and Symbols in general.

* Address intel compiler complain

* Free memb_func[].dparam_semantics

* Switch dparam_semantics to unique_ptr (no raw!)

* Memb_list to do its memory management

* Memb_list to be aware of its potential "view" condition and not free

* Back pdata free

* nrn_init to better initialize mpi

* Addressed a number of warnings, inc avoidiing potential double free

* Addressed sonarcloud issues

* fix the merge with master

* Fix test/api/netcon.cpp after merge with master

  - after RANDOM construct (#2627) was merged,
    netstim.mod uses Random123 by default
  - before this, netstim was using scoprand by default
    and reference results were from the same
  - now, explicitly use Random123 in the test and update
    reference results

* fix warning [-Wimplicit-exception-spec-mismatch]

---------

Co-authored-by: Olli Lupton <oliver.lupton@epfl.ch>
Co-authored-by: Fernando Pereira <fernando.pereira@epfl.ch>
Co-authored-by: Pramod Kumbhar <pramod.s.kumbhar@gmail.com>
Co-authored-by: Nicolas Cornu <nicolas.cornu@epfl.ch>
Co-authored-by: Michael Hines <michael.hines@yale.edu>
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.

3 participants