Skip to content

after ccmake the executable is not found if ... #600

Closed

Description

@gmaurel

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:

  • make a soft link under src
  • modify the test script.

Activity

  1. added
    Engineering
    and removed on Jul 30, 2016
  2. jibsen commented on Aug 3, 2016

    @jibsen
    Contributor

    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:

    ctest -V -C Debug
  3. gmaurel commented on Aug 3, 2016

    @gmaurel
    CollaboratorAuthor

    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)?

  4. mihaipopescu commented on Aug 4, 2016

    @mihaipopescu
    Collaborator

    @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.

    Running tests as @jibsen suggested totally works:

    cd build; ctest -V -C Debug

  5. jibsen commented on Aug 4, 2016

    @jibsen
    Contributor

    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.

    But that is probably a discussion for #604.

    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.

  6. mihaipopescu commented on Aug 4, 2016

    @mihaipopescu
    Collaborator

    But what about each build system places the executable into a known location, overwriting it every time ?

  7. gmaurel commented on Aug 6, 2016

    @gmaurel
    CollaboratorAuthor

    It works pretty well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Engineering

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions