question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Load tests from ctest

See original GitHub issue

Describe the solution you’d like

I’d like to be able to identify test executables via ctest, CMake’s test registry and test runner. We already have test configurations in CMakeLists.txt which I would like to use instead of defining testMate.cpp.test.advancedExecutables.

A command like ctest --show-only=json-v1 causes ctest to print all the tests it knows about. A relevant section is

{
  "tests" : 
  [
    {
      "command" : 
      [
        "crun",
        "c/build/catchtests",
        "Hello world"
      ],
      "name" : "catchtests-Hello world",
      "properties" : 
      [
        {
          "name" : "WORKING_DIRECTORY",
          "value" : "/home/lordmauve/myproj/"
        }
      ]
    }
}

where

  • crun is a launcher defined with CROSSCOMPILING_EMULATOR - equivalent to TestMate’s executionWrapper
  • c/build/catchtests is the test binary
  • "Hello world" is the name of the test to run. That’s being populated by the Catch2 CMake integration - each test case is registered as a separate CTest item.

This seems like a significant mismatch for the model of testMate.cpp.test.advancedExecutables - because TestMate wants a list of executables that to can query for tests - and yet it seems like JetBrains was able to overcome this because this exact feature is available in CLion.

Describe alternatives you’ve considered

I have separately configured testMate.cpp.test.advancedExecutables and CTest and used them independently. However, this is hard to keep in sync across our user base. Some of our developers use CLion where the IDE integration with CTest is a supported feature; those developers can rely on adding tests in CMakeLists.txt without having to reconfigure their IDE. This means that CLion users can break VS Code users by adding tests that TestMate will not see.

Additional context

This is a related to https://github.com/matepek/vscode-catch2-test-adapter/issues/150

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
matepekcommented, Mar 8, 2022

Probably because of the same reason this extension wouldn’t be able to.

0reactions
matepekcommented, Apr 26, 2022

No activity on this. I will close, but feel free to comment or add any new ideas.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ctest(1) — CMake 3.25.1 Documentation
The ctest executable is the CMake test driver program. CMake-generated build trees created for projects that use the enable_testing() and add_test() commands ...
Read more >
ctest --test-load is broken in CMake 3.11.2 (#18338) · Issues
"ctest --test-load X" no longer waits for the load average to fall below X before starting a new test. Instead it gives up...
Read more >
Running the Unit Tests - Developer Documentation
We use CTest for building and running our unit tests. ... (matches the string as with the -R option) - useful for those...
Read more >
Ubuntu Manpage: ctest - CTest Command-Line Reference
Record the build output log and detect warnings and errors. See the CTest Build Step section below. Test Test the software by loading...
Read more >
CMake & CTest : make test doesn't build tests - Stack Overflow
Then you can run make check and it will compile and run the test. If you have several tests, then you would have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found