Running stan-dev/stan tests

I’m having trouble with the stan-dev/stan test models.

I clone the repo:

git clone --recursive https://github.com/stan-dev/stan.git

I run the tests:

./runTests.py -j8 src/test

I get this error and things break:

/gtest_1.8.1/include -I lib/stan_math/lib/gtest_1.8.1 -I lib/stan_math/lib/gtest_1.8.1/include -I lib/stan_math/lib/gtest_1.8.1 -I lib/stan_math/lib/gtest_1.8.1/include -I lib/stan_math/lib/gtest_1.8.1 -I lib/stan_math/lib/gtest_1.8.1/include -I lib/stan_math/lib/gtest_1.8.1 -I lib/stan_math/lib/gtest_1.8.1/include -I lib/stan_math/lib/gtest_1.8.1 -I lib/stan_math/lib/gtest_1.8.1/include -I lib/stan_math/lib/gtest_1.8.1          -DBOOST_DISABLE_ASSERTS           -c -o test/stan/lang/grammars/statement_2_grammar_inst.o src/stan/lang/grammars/statement_2_grammar_inst.cpp
src/test/performance/logistic_test.cpp:47:10: fatal error: test/test-models/performance/logistic.hpp: No such file or directory
 #include <test/test-models/performance/logistic.hpp>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I tried the command here to no avail: Running single model integration test

~/stan-current$ make src/test/test-models/good/map_rect.hpp-test
make: *** No rule to make target 'src/test/test-models/good/map_rect.hpp-test'.  Stop.

Even though this file exists:

~/stan-current$ ls src/test/test-models/good/map_rect.stan 
src/test/test-models/good/map_rect.stan

@syclik any ideas? (I’m trying to test some code that needs a valid stan model compiled in)

This is the output with -d turned on:

...
 No need to remake target 'makefile'.
Updating goal targets....
Considering target file 'src/test/test-models/good/map_rect.hpp-test'.
 File 'src/test/test-models/good/map_rect.hpp-test' does not exist.
 Looking for an implicit rule for 'src/test/test-models/good/map_rect.hpp-test'.
 Trying pattern rule with stem 'map_rect'.
 Trying implicit prerequisite 'src/test/test-models/good/map_rect.hpp'.
 Trying pattern rule with stem 'map_rect.hpp-test'.
 Trying implicit prerequisite 'src/test/test-models/good/map_rect.hpp-test,v'.
 Trying pattern rule with stem 'map_rect.hpp-test'.
 Trying implicit prerequisite 'src/test/test-models/good/RCS/map_rect.hpp-test,v'.
 Trying pattern rule with stem 'map_rect.hpp-test'.
 Trying implicit prerequisite 'src/test/test-models/good/RCS/map_rect.hpp-test'.
 Trying pattern rule with stem 'map_rect.hpp-test'.
 Trying implicit prerequisite 'src/test/test-models/good/s.map_rect.hpp-test'.
 Trying pattern rule with stem 'map_rect.hpp-test'.
 Trying implicit prerequisite 'src/test/test-models/good/SCCS/s.map_rect.hpp-test'.
 Trying pattern rule with stem 'map_rect'.
 Trying implicit prerequisite 'src/test/test-models/good/map_rect.hpp'.
 Looking for a rule with intermediate file 'src/test/test-models/good/map_rect.hpp'.
  Avoiding implicit rule recursion.
  Trying pattern rule with stem 'map_rect.hpp'.
  Trying implicit prerequisite 'src/test/test-models/good/map_rect.hpp,v'.
  Trying pattern rule with stem 'map_rect.hpp'.
  Trying implicit prerequisite 'src/test/test-models/good/RCS/map_rect.hpp,v'.
  Trying pattern rule with stem 'map_rect.hpp'.
  Trying implicit prerequisite 'src/test/test-models/good/RCS/map_rect.hpp'.
  Trying pattern rule with stem 'map_rect.hpp'.
  Trying implicit prerequisite 'src/test/test-models/good/s.map_rect.hpp'.
  Trying pattern rule with stem 'map_rect.hpp'.
  Trying implicit prerequisite 'src/test/test-models/good/SCCS/s.map_rect.hpp'.
 No implicit rule found for 'src/test/test-models/good/map_rect.hpp-test'.
 Finished prerequisites of target file 'src/test/test-models/good/map_rect.hpp-test'.
Must remake target 'src/test/test-models/good/map_rect.hpp-test'.
make: *** No rule to make target 'src/test/test-models/good/map_rect.hpp-test'.  Stop.

I can build the header with:

make test/test-models/good/map_rect.hpp-test

So it’s something to do with the different in src/test and test?

edit: and the header shows up then in test/test-models/good/map_rect.hpp

Not sure if this helps your exact case. I tried to repeat your issue and cloned a fresh develop of stan.

And I get the following error on running ./runTests.py -j8 src/test:

g++ -std=c++1y -pthread -Wno-sign-compare     -O3 -I src -I . -I lib/stan_math/ -I lib/stan_math/lib/eigen_3.3.3 -I lib/stan_math/lib/boost_1.69.0 -I lib/stan_math/lib/sundials_4.1.0/include -I lib/stan_math/lib/gtest_1.8.1/include -I lib/stan_math/lib/gtest_1.8.1 -I lib/stan_math/lib/gtest_1.8.1/include -I lib/stan_math/lib/gtest_1.8.1      -DBOOST_DISABLE_ASSERTS       -c src/test/unit/mcmc/hmc/nuts/unit_e_nuts_test.cpp -o test/unit/mcmc/hmc/nuts/unit_e_nuts_test.o
src/test/unit/mcmc/hmc/nuts/unit_e_nuts_test.cpp:1:10: fatal error: test/test-models/good/mcmc/hmc/common/gauss3D.hpp: No such file or directory
 #include <test/test-models/good/mcmc/hmc/common/gauss3D.hpp>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make/tests:13: recipe for target 'test/unit/mcmc/hmc/nuts/unit_e_nuts_test.o' failed
make: *** [test/unit/mcmc/hmc/nuts/unit_e_nuts_test.o] Error 1
make: *** Waiting for unfinished jobs....
src/test/unit/optimization/bfgs_exponential_boundary_test.cpp:3:10: fatal error: test/test-models/good/optimization/exponential_boundary.hpp: No such file or directory
 #include <test/test-models/good/optimization/exponential_boundary.hpp>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make/tests:13: recipe for target 'test/unit/optimization/bfgs_exponential_boundary_test.o' failed
make: *** [test/unit/optimization/bfgs_exponential_boundary_test.o] Error 1
src/test/unit/optimization/bfgs_test.cpp:3:10: fatal error: test/test-models/good/optimization/rosenbrock.hpp: No such file or directory
 #include <test/test-models/good/optimization/rosenbrock.hpp>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make/tests:13: recipe for target 'test/unit/optimization/bfgs_test.o' failed
make: *** [test/unit/optimization/bfgs_test.o] Error 1
src/test/unit/optimization/bfgs_minimizer_test.cpp:3:10: fatal error: test/test-models/good/optimization/rosenbrock.hpp: No such file or directory
 #include <test/test-models/good/optimization/rosenbrock.hpp>
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Then I tried using clang++ and it worked…

With g++ I ran make test/test-models/good/mcmc/hmc/common/gauss3D.hpp after I got the above error and that compiled stanc etc and it seems to be OK now. It is very weird tho.

It seems that running make test/integration/compile_models_test beforehand solves it for g++.

Thanks for looking at this, but when I run that I get:

~/stan-current$ make test/integration/compile_models
make: *** No rule to make target 'test/integration/compile_models'.  Stop.

Haven’t tried clang yet.

You forgot the _test

1 Like

Oh lol, nice. Yeah it works now! Thanks.

I’ll make an issue out of this and link this as a solution.

1 Like

Also specify -j4 or -j8 for this make call. This one takes a while.