Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Timeout is normal

Options
LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in C/C++test
I have a piece of code that should wait on a semaphore for forever if everything is working OK.

/*Setup threads and wait*/
sem_wait(&semaphore); //Wait for forever unless program termination is required.
/*Case for exit conditions*/

and should only fail if one of the child threads releases the semaphore, meaning some unrecoverable error has occurred and the function must terminate.
C++Test times out after 5 seconds, and that is just fine, but how to I register this a a normal condition?

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Options
    Hello galto

    > CI have a piece of code that should wait on a semaphore for forever if everything is working OK.

    > /*Setup threads and wait*/
    > sem_wait(&semaphore); //Wait for forever unless program termination is required.
    > /*Case for exit conditions*/

    > and should only fail if one of the child threads releases the semaphore, meaning some unrecoverable error has occurred and >the function must terminate.
    >C++Test times out after 5 seconds, and that is just fine, but how to I register this a a normal condition?


    Without a small example it is hard to give you concrete solution. However I would suggest creating a user defined stub that has a condition statement that will call either CppTest_Assert, or CppTest_Break(), whenever semi_wait function is called.