You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
after ccmake the executable is not found if ... #600
I like to use an extra directory <where_is_software>/build to build a project.
Doing that with our project, the executable is not found by running the tests.
Two solutions:
The problem really is that the executable might end up in different folders depending on how it is built. For instance if you are building with Visual Studio it will be in a Debug or Release folder depending on the build type.
The CMake script should set up a test target that passes the correct path to run_tests.py, so if you are building using CMake generated makefiles, then make test should work. Otherwise you can run the tests through CTest:
@gmaurel not necessarily. Maybe it could be a post-build event that copies where run_tests.py expects but it can totally be specified with the --exe command line argument.
Basically if we have another way of running tests, through ctest we don't need to make run_tests.py find the executable itself as it would create as well a dependency on the build system.
Using CTest works at the moment for running all the tests, but I don't know if there is a way to supply command-line options to the test.
One possibility would be to add separate tests for each language to the CMake script, so you could run them individually (first test runs run_tests.py c-sharp, second test runs run_tests.py c, etc..). You could then specify which tests to run when calling ctest.
The problem with finding the executable is that build is just a suggested name. In my uncrustify folder I have build, build2, and buildvs (which contain builds with gcc, with an older cmake, and with Visual Studio respectively), so if I go into the tests folder and run run_tests.py, which uncrustify should it use?
If I instead go into the build2 folder and do make test, the correct uncrustify is automatically passed to the script.
But I think it might be a good idea to have the script look for uncrustify in a few more default places (build, build/Relese, build/Debug), and if it does not find it, print an error message asking the user to pass it with the --exe switch.
Activity
jibsen commentedon Aug 3, 2016
The problem really is that the executable might end up in different folders depending on how it is built. For instance if you are building with Visual Studio it will be in a Debug or Release folder depending on the build type.
The CMake script should set up a
testtarget that passes the correct path torun_tests.py, so if you are building using CMake generated makefiles, thenmake testshould work. Otherwise you can run the tests through CTest:gmaurel commentedon Aug 3, 2016
mmmh!
The script tests/run_tests.py should found the executable itself.
May be some changes in the script or in the CMakeLists.txt
Any proposal(s)?
mihaipopescu commentedon Aug 4, 2016
@gmaurel not necessarily. Maybe it could be a post-build event that copies where
run_tests.pyexpects but it can totally be specified with the--execommand line argument.Basically if we have another way of running tests, through
ctestwe don't need to makerun_tests.pyfind the executable itself as it would create as well a dependency on the build system.Running tests as @jibsen suggested totally works:
cd build; ctest -V -C Debugjibsen commentedon Aug 4, 2016
Using CTest works at the moment for running all the tests, but I don't know if there is a way to supply command-line options to the test.
One possibility would be to add separate tests for each language to the CMake script, so you could run them individually (first test runs
run_tests.py c-sharp, second test runsrun_tests.py c, etc..). You could then specify which tests to run when callingctest.But that is probably a discussion for #604.
The problem with finding the executable is that
buildis just a suggested name. In my uncrustify folder I havebuild,build2, andbuildvs(which contain builds with gcc, with an older cmake, and with Visual Studio respectively), so if I go into thetestsfolder and runrun_tests.py, which uncrustify should it use?If I instead go into the
build2folder and domake test, the correct uncrustify is automatically passed to the script.But I think it might be a good idea to have the script look for uncrustify in a few more default places (
build,build/Relese,build/Debug), and if it does not find it, print an error message asking the user to pass it with the--exeswitch.mihaipopescu commentedon Aug 4, 2016
But what about each build system places the executable into a known location, overwriting it every time ?
gmaurel commentedon Aug 6, 2016
It works pretty well