TPF_TC_TIMEOUT: Set a timeout value for the test case
This C/C++ macro sets a timeout value in seconds for the test case.
Last updated
Added for PUT15.
Format
maketpf_env += idevops
#include <tpf/c_devops.h>
void TPF_TC_TIMEOUT(unsigned long timeOut);
- timeOut
- An unsigned long value in seconds that represents the timeout value. The default timeout value is 10 seconds from when the test case starts.
Normal return
None.
Error return
If a test case handle is not set, the DE1045 system error is issued, and the ECB that issues this macro exits.
Programming considerations
- Do not use this macro in production applications.
- This macro sets the timeout value based on the current time. For example, if you issue this macro with a timeout value of 10 seconds, the test case times out in 10 seconds from the time the TPF_TC_TIMEOUT macro is issued.
Examples
The following example resets the timeout value to 15 seconds from the current time.
// set new timeout since test will take more than
// 10 seconds
time_t begin, end;
begin = time(NULL);
TPF_TC_TIMEOUT(15);
sleep(12);
end= time(NULL);
If (end-begin < 12) {
TPF_TC_ERROR("sleep only slept %d seconds", end-begin);
} else if (end-begin > 14) {
TPF_TC_ERROR("sleep slept %d seconds", end-begin);
}