Eclipse reports "Test function is not registered" on registered functions when the test is a functor

Added by Lukasz Walewski over 1 year ago

Hi,

Eclipse Codan is known to produce false positives in many situations but this one should be possible to get fixed within CUTE Plugin.

When starting my project I created all the tests as free functions that I registered with CUTE using cute::suite.push_back() and everything worked like a charm. Recently I decided to switch to the functor-type design, as described in the User Guide. The suite runs fine, i.e. the old tests pass as before, new tests fail on not-yet-implemented functionality, etc, which makes me happy.

The tiny, yet pretty annoying issue is that the code analysis feature of Eclipse gets the test functions wrong. It reports each member function of my testing functor (except for the constructor and the () operator), as being "not registered" and underlines the whole body (!) of every such function in yellow. This is obviously wrong, since all these member functions get called in the operator() - yes, I am sure I am calling them there - and need not be registered explicitly, as it is the case for free test functions described here.

When I go for the quick fix suggesting to "Add test to suite" it creates a new make_suite() function in my implementation file, which adds the test function in question to a cute::suite variable that is local to this new make_suite() function. Of course it never gets called anyway.

Best regards,
Lukasz


Replies (10)

RE: Eclipse reports "Test function is not registered" on registered functions when the test is a functor - Added by Thomas Corbat over 1 year ago

Dear Lukasz

Thanks for the report! This is clearly an issue of the CUTE plug-in. We'll look into it.

Best Regards
Thomas

RE: Eclipse reports "Test function is not registered" on registered functions when the test is a functor - Added by Lukasz Walewski over 1 year ago

Hi Thomas,

An observation that might help you pinpointing the problem: I hit the issue when running Eclipse Neon + CUTE Plugin installed from /updatesite/neon. I checked the same project with an older version of Eclipse + CUTE Plugin from /updatesite today and it does not show up. I can't tell the Eclipse version for sure at the moment (office PC), but it comes with ARM DS-5 5.24.1, I believe its Luna.

Best regards,
Lukasz

RE: Eclipse reports "Test function is not registered" on registered functions when the test is a functor - Added by Thomas Corbat over 1 year ago

Hi Lukasz

That's an interesting observation. I possibly CDT changed the way something is parsed or represented in their data structure, which we missed so far.
I could reproduce the problem and I think I'll find a solution soon. Probably I can build a fixed version of CUTE tomorrow.

Thanks for the details!
Thomas

RE: Eclipse reports "Test function is not registered" on registered functions when the test is a functor - Added by Thomas Corbat over 1 year ago

I've fixed the issue I reproduced. The new version of the plug-in (available for Neon) is available on the updatesites /updatesite, /updatesite/neon and /updatesite/developement. It would be great to know whether this fixes your problem as well, which I hope! :)

RE: Eclipse reports "Test function is not registered" on registered functions when the test is a functor - Added by Lukasz Walewski about 1 year ago

Dear Thomas,

Maybe I am doing something wrong, but the updated version (5.0.0.201608180833) did not fix my problem in Eclipse Neon.

To be on the safe side I:
- deleted the project from Eclipse
- moved .project, .cproject and .settings out of the way
- created the CUTE Library Test Project anew
- registered my existing test functors in Test.cpp

However, all my test member functions (they are all private void) get marked as "not registered" upon opening the *.cpp files in Eclipse editor. Running "Index > Rebuild" etc does not help. The constructors and () operators are not affected. In summary, the old behavior described above did not change with the new plugin version.

I am sorry not to have any better news this time. If you had any suggestions what I could be doing wrong or how can I help locating the problem, please give me a note.

Best regards,
Lukasz

RE: Eclipse reports "Test function is not registered" on registered functions when the test is a functor - Added by Lukasz Walewski about 1 year ago

One more detail, to make the discussion more concrete: I observed the original issue using Eclipse Version: Neon Release (4.6.0), Build id: 20160613-1800 and CDT version 9.0.0.201606062011. Today I upgraded CDT to version 9.0.1.201607151550 but the problem remains the same.

RE: Eclipse reports "Test function is not registered" on registered functions when the test is a functor - Added by Mario Meili about 1 year ago

Dear Lukasz

I was able to reproduce your issue and already discussed it with Thomas. I will start working on a fix immediately and will inform you about our progress.

Best regards,
Mario

RE: Eclipse reports "Test function is not registered" on registered functions when the test is a functor - Added by Lukasz Walewski about 1 year ago

Hi Mario,

Thanks for the follow-up! I did not look in here for a while, but its reassuring to hear that you were able to reproduce the issue, and - even more so - that you are on track to fix it!

Thanks again for your efforts and all the best!
Lukasz

RE: Eclipse reports "Test function is not registered" on registered functions when the test is a functor - Added by Mario Meili about 1 year ago

Hi Lukasz

It took me some time but I was able to fix the issue. You can find the fixed version of cute on the development update site (/updatesite/developement).

The upcoming Cevelop release will also include the fixed version of cute.

Best regards,
Mario

RE: Eclipse reports "Test function is not registered" on registered functions when the test is a functor - Added by Lukasz Walewski about 1 year ago

Dear Mario,

Thank you very much for your efforts. I am sorry to say, that the fixed version did not solve my problem yet. I do not know what's going on, could be that my Neon installation is somehow broken. For the time being I reverted back to the stock version of Eclipse (3.8.1) coming with my distribution (Linux Mint 17.3), which is a bit outdated but at least the corresponding version of CUTE (4.5.0) works fine. I think I can live with that for now.

Once again, thanks for CUTE being a perfect piece of software - and for your support!

Best regards,
Lukasz

(1-10/10)