ChasteGuides/RunningBinariesFromCommandLine

When scons is used to compile a test suite, it puts the compiled binary in the build folder, in a sub-folder that depends on the build options. For example, for

scons test_suite=global/test/TestException.hpp

the binary is global/build/debug/TestExceptionRunner. However, for

scons build=GccOpt_ndebug test_suite=global/test/TestException.hpp

the binary is global/build/optimised_ndebug/TestExceptionRunner.

When scons is used to run (after compiling) tests, certain environment variables are set up. If running binaries directly, you may need to set them yourself. If the binary doesn't run, from the main Chaste directory do

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/lib

before running. Also, scons sets the environment variable CHASTE_TEST_OUTPUT if it is not already defined. If CHASTE_TEST_OUTPUT is not set when the binary is run, output will be put in the testoutput folder in the main Chaste directory, rather than your normal test output directory. So you may want to export CHASTE_TEST_OUTPUT too.

Overall, we can use the following: from the main Chaste directory do:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/lib
export CHASTE_TEST_OUTPUT=<somewhere>
scons compile_only=1 test_suite=global/test/TestException.hpp 
./global/build/debug/TestExceptionRunner

The exports of course just need to be done once a session, and could be put in your .bashrc file in your home directory, in order to set them for every session.