Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Cannot get CheckersTestCase stable

Some thoughts I had about this issue. The Codan Checker will only work on a proper CDT project (C/C++ project). Does the temporary junit test project comply to a proper CDT project? Does the CheckerTestCase see to that? Or do I need to do some initialisation? I saw that all examples in org.eclipse.cdt.codan.core.test are executed in a junit test suit. Do my testcases also have to be executed in a test suit?
I hope to get some answers soon,

Dennis


Van: Dennis Gallas <dennis.gallas@xxxxxxxx>
Aan: <cdt-dev@xxxxxxxxxxx>
Verzonden: 11-12-2015 18:12
Onderwerp: Cannot get CheckersTestCase stable

I posted this issue also in "Eclipse Community Forum". We have several issues concerning CDT plugin development, after reading numerous articles on the internet for a week now, I hope to get my answer via the CDT-DEV mainling list. Like I said, we have several issues and I will ask them in different posts.

I am in a project which develops plugins for extending the codan checker. For unit testing, we decided to use CheckerTestCase, because of its ease of use and it is a test framework dedicated for CDT.
The problem is, that the test results from our test cases are not stable. When running the test cases, they sometimes pass, and sometimes fail. As if the markers are not yet set the moment checkErrorLine is called.

Question(s): What is the proper way to use CheckerTestCase? Do you need to initialise the enviroment (load checker plugin), and check if the system is ready to act upon the code snippet?
Could you give a step-by-step approach, of even better, point me to an example where CheckerTestCase is properly implemented.

- We are running the junit in headless mode.
- Our test case have the following form:
-----
import org.eclipse.cdt.codan.core.test.CheckerTestCase;

public class MsgPointerInCapsuleOperationTest extends CheckerTestCase {

@Override
public boolean isCpp() {
return true;
}

// class RTMessage
// {
// public:
// char* signal;
// char* rtdata;
// char* getSignal(void);
// char* getData(void);
// };
//
// void f_CapsuleFunction()
// {
// RTMessage* l_Msg = new RTMessage();
// char* l_Signal = l_Msg->getSignal(); //assert Rule 31: Do not use msg pointer in a capsule operation
// l_Signal = l_Msg->getSignal(); //assert Rule 31: Do not use msg pointer in a capsule operation
// delete l_Msg;
// }
public void test_r31_2() {
loadCodeAndRun(getAboveComment());
checkErrorLines(13,14);
}
...
--------


Dennis



Back to the top