Welcome Guest ( Log In | Register )

Reply to this topicStart new topic
> Need timeout == pass, Infinite loop timeout
post May 4 2010, 05:38 AM
Post #1


Group: Members
Posts: 3
Joined: 20-January 10
From: St. Louis, MO. USA
Member No.: 30602

I want C++Test to report a success if timeout is triggered.
I have an infinitely looping task. I expect a timeout. I don't want the timeout reported as an error.

Here is the basic setup of the function (which I am not free to change) ...

void MyInfiniteTask(void)
while (TRUE) { do_some_junk_repeatedly }


David Harding
Go to the top of the page
+Quote Post
post May 17 2010, 08:40 AM
Post #2


Group: Staff
Posts: 4
Joined: 14-October 09
Member No.: 29198

Hi David,

What you're looking for is the use of the built-in C++test testing macros.
If you open up your C++Test userguide you should see a section at the very bottom that's labeled "C++test API Documentation". If you click on it you should see a section titled "Test Suite/Test Case Registration" where you can read about the various macros that you can use with your test cases. I'm assuming you've already generated unit tests and test suites for your test cases. By default you should see CPPTEST_TEST(testCaseName) for each of your test cases. What you can do is change that to CPPTEST_TEST_ERROR(testCaseName, CPPTEST_TIMEOUT), since you said you were expecting a timeout from the test case. This should make it so that C++Test expects a timeout from this test case and it should not be marked as a failure anymore. You can find more information about this particular macro in the section of the userguide I mentioned earlier.

Let me know if you have any other issues.

Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:


RSS Lo-Fi Version Time is now: 5th December 2016 - 09:56 PM