Skip to content

Commit

Permalink
Provide NMODL binary path for RANDOM test (#2717)
Browse files Browse the repository at this point in the history
- if NMODL is installed externally, it's not in $PATH
   and hence test_nmodlrandom_syntax.py was failing
   (see BlueBrain/nmodl/pull/1150)
 - provide the path NMODL binary from CMake to avoid this issue
  • Loading branch information
pramodk authored Feb 9, 2024
1 parent 1cad60d commit 17bd2c8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ if(NRN_ENABLE_CORENEURON)
get_property(CORENRN_LIB_LINK_FLAGS GLOBAL PROPERTY CORENRN_LIB_LINK_FLAGS)
get_property(CORENRN_NEURON_LINK_FLAGS GLOBAL PROPERTY CORENRN_NEURON_LINK_FLAGS)
get_property(CORENRN_ENABLE_SHARED GLOBAL PROPERTY CORENRN_ENABLE_SHARED)
get_property(CORENRN_NMODL_BINARY GLOBAL PROPERTY CORENRN_NMODL_BINARY)
# NEURON tests that link against CoreNEURON need to depend on it.
set(CORENEURON_TARGET_TO_DEPEND coreneuron-for-tests)

Expand Down
2 changes: 1 addition & 1 deletion src/coreneuron/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ else()
FILES ${NMODL_PROJECT_BINARY_DIR}/share/nmodl/nrnunits.lib
DESTINATION share/nmodl
COMPONENT nrnunits)

endif()
set_property(GLOBAL PROPERTY CORENRN_NMODL_BINARY "${CORENRN_NMODL_BINARY}")

# set correct arguments for nmodl for cpu/gpu target
set(CORENRN_NMODL_FLAGS
Expand Down
6 changes: 4 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -655,8 +655,10 @@ if(NRN_ENABLE_PYTHON)
NAME test_nmodlrandom_syntax_py_${processor}
REQUIRES coreneuron ${processor} ${modtests_preload_sanitizer}
SCRIPT_PATTERNS test/coreneuron/test_nmodlrandom_syntax.py
ENVIRONMENT ${modtests_processor_env} ${nrnpython_mpi_env}
COVERAGE_FILE=.coverage.coreneuron_test_nmodlrandom_syntax_py
ENVIRONMENT
${modtests_processor_env} ${nrnpython_mpi_env}
COVERAGE_FILE=.coverage.coreneuron_test_nmodlrandom_syntax_py
NMODL_BINARY=${CORENRN_NMODL_BINARY}
COMMAND ${modtests_launch_py} test/coreneuron/test_nmodlrandom_syntax.py)
nrn_add_test(
GROUP coreneuron_modtests
Expand Down
5 changes: 4 additions & 1 deletion test/coreneuron/test_nmodlrandom_syntax.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from neuron import h
import subprocess
from pathlib import Path
import os


# default args generate accepted nmodl string
Expand Down Expand Up @@ -75,7 +76,9 @@ def chk_nmodl(txt, program="nocmodl", rcode=False):


def test_syntax():
for program in ["nocmodl", "nmodl"]:
# nmodl could be external installation (not in PATH)
nmodl_binary = os.environ.get("NMODL_BINARY", "nmodl")
for program in ["nocmodl", nmodl_binary]:
foo = False
assert chk_nmodl(modfile(), program, rcode=True)
assert chk_nmodl(modfile(s0="ASSIGNED{rv1}"), program)
Expand Down

0 comments on commit 17bd2c8

Please sign in to comment.