bneumann / CppUTest-Test-Adapter

A test adapter for Visual Studio Code for the C/C++ Unit Test framework CppUTest.
MIT License
16 stars 7 forks source link

Get Test Locations from cpputest directly #24

Closed lokimon closed 2 years ago

lokimon commented 2 years ago

I have almost completed a pull request for cpputest to have it output the Test Locations directly with a command line option.

Currently it is

$ my_tests/example -lt
TEST_GROUP_1.TEST_23#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#141
TEST_GROUP_1.TEST_22#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#135
TEST_GROUP_1.TEST_21#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#129
TEST_GROUP_1.TEST_20#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#123
TEST_GROUP_1.TEST_19#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#117
TEST_GROUP_1.TEST_18#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#111
TEST_GROUP_1.TEST_17#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#105
TEST_GROUP_1.TEST_16#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#99
TEST_GROUP_1.TEST_15#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#93
TEST_GROUP_1.TEST_14#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#87
TEST_GROUP_1.TEST_13#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#81
TEST_GROUP_1.TEST_12#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#75
TEST_GROUP_1.TEST_11#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#69
TEST_GROUP_1.TEST_10#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#63
TEST_GROUP_1.TEST_9#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#57
TEST_GROUP_1.TEST_8#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#51
TEST_GROUP_1.TEST_7#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#45
TEST_GROUP_1.TEST_6#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#39
TEST_GROUP_1.TEST_5#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#33
TEST_GROUP_1.TEST_4#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#27
TEST_GROUP_1.TEST_3#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#21
TEST_GROUP_1.TEST_2#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#15
TEST_GROUP_1.TEST_1#/home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp#9

Just wondering if you thought this was parsable, or if it should be changed to something else.

lokimon commented 2 years ago

I am about to create a pull request for this in the cpputest repo

https://github.com/lokimon/cpputest/commit/76956b6f32f913fdb0d70516c6b7eaa3e7a5eadb

Output is as follows $ ./my_tests/example -ll TEST_GROUP_1.TEST_23./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.141 TEST_GROUP_1.TEST_22./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.135 TEST_GROUP_1.TEST_21./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.129 TEST_GROUP_1.TEST_20./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.123 TEST_GROUP_1.TEST_19./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.117 TEST_GROUP_1.TEST_18./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.111 TEST_GROUP_1.TEST_17./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.105 TEST_GROUP_1.TEST_16./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.99 TEST_GROUP_1.TEST_15./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.93 TEST_GROUP_1.TEST_14./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.87 TEST_GROUP_1.TEST_13./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.81 TEST_GROUP_1.TEST_12./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.75 TEST_GROUP_1.TEST_11./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.69 TEST_GROUP_1.TEST_10./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.63 TEST_GROUP_1.TEST_9./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.57 TEST_GROUP_1.TEST_8./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.51 TEST_GROUP_1.TEST_7./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.45 TEST_GROUP_1.TEST_6./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.39 TEST_GROUP_1.TEST_5./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.33 TEST_GROUP_1.TEST_4./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.27 TEST_GROUP_1.TEST_3./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.21 TEST_GROUP_1.TEST_2./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.15 TEST_GROUP_1.TEST_1./home/lokimon/source/repos/playground/cpptest_simple/my_tests/test.cpp.9

Then we can pull out the TestGroup.TestName.FileLocation.LineNumber with a regex of (.?).(.?).(.).(.)

Then we get instant file locations rather than having to have objdump do it's thing for a minute. Thoughts?

lokimon commented 2 years ago

The pull request was approved.

https://github.com/cpputest/cpputest

If you build the master branch and call the test executable with -ll, you will get the location of tests.

bneumann commented 2 years ago

Oh man this is also open quite some time now. I hope I can find some time to add this the next weeks. Should be fairly easy though. @lokimon Thanks for the CppUTest enhancement by the way!

bneumann commented 2 years ago

Should be included in the latest release 1.0.8