Skip to content

Neuron doesn't return exit code to command line when there is an error #335

@iomaganaris

Description

@iomaganaris

During creating tests for NEURON I found out that when there is an error and NEURON quits from the HOC interpreter, it doesn't return an exit code (1) to the command-line shell.
This would be a useful addition, especially for extending the unit tests.
Example:

magkanar:~/bbp/nrn_bbp/build$ bin/nrniv /home/magkanar/bbp/nrn_bbp/test/hoc_tests/connect_dend/connect_dend.hoc
NEURON -- VERSION 7.8.0-162-g597ea9dc+ catch_test (597ea9dc+) 2019-11-25
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2019
See http://neuron.yale.edu/neuron/credits

bin/nrniv: Couldn't find: nrngui.hoc
 in /home/magkanar/bbp/nrn_bbp/test/hoc_tests/connect_dend/connect_dend.hoc near line 1
 load_file("nrngui.hoc")
                        ^
        0 
        1 
        Vector[1] 
        Vector[0] 
bin/nrniv: run undefined function
 in /home/magkanar/bbp/nrn_bbp/test/hoc_tests/connect_dend/connect_dend.hoc near line 58
 run()
      ^
        run()
sh: 1: /home/magkanar/bbp/nrn_bbp/build/install/share/nrn/lib/cleanup: not found
magkanar:~/bbp/nrn_bbp/build$ echo $?
0

Another related useful addition for testing would be a function in HOC or/and python like quit() to return specific values, like: quit(0) to return 0 to the command-line shell and quit(1) to return 1.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions