mirror of
https://github.com/open62541/open62541.git
synced 2026-10-17 04:42:09 +08:00
refactor(tests): Remove last usage of realSleep
This commit is contained in:
committed by
Julius Pfrommer
parent
424e400755
commit
b3fb44ff5b
@@ -31,7 +31,6 @@ int main(int argc, char *argv[]) {
|
||||
do {
|
||||
printf("Try to connect ...\n");
|
||||
retval = UA_Client_connect(client, "opc.tcp://localhost:4840");
|
||||
UA_realSleep(100);
|
||||
iteration++;
|
||||
} while ((retval != UA_STATUSCODE_GOOD) && (iteration < cNoOfReconnectTries));
|
||||
|
||||
|
||||
@@ -508,8 +508,6 @@ START_TEST(requestPastKey) {
|
||||
END_TEST
|
||||
|
||||
START_TEST(requestUnknownStartingTokenId){
|
||||
UA_fakeSleep(1000);
|
||||
UA_realSleep(4000);
|
||||
UA_Client *sksClient = UA_Client_newForUnitTest();
|
||||
encyrptedclientconnect(sksClient);
|
||||
/* Secure client connect */
|
||||
|
||||
@@ -14,23 +14,6 @@ UA_fakeSleep(UA_UInt32 duration) {
|
||||
testingClock += duration * UA_DATETIME_MSEC;
|
||||
}
|
||||
|
||||
/* 1 millisecond = 1,000,000 Nanoseconds */
|
||||
#define NANO_SECOND_MULTIPLIER 1000000
|
||||
|
||||
void
|
||||
UA_realSleep(UA_UInt32 duration) {
|
||||
#ifdef UA_ARCHITECTURE_WIN32
|
||||
Sleep(duration);
|
||||
#else
|
||||
UA_UInt32 sec = duration / 1000;
|
||||
UA_UInt32 ns = (duration % 1000) * NANO_SECOND_MULTIPLIER;
|
||||
struct timespec sleepValue;
|
||||
sleepValue.tv_sec = (int)sec;
|
||||
sleepValue.tv_nsec = (int)ns;
|
||||
nanosleep(&sleepValue, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
UA_DateTime UA_DateTime_now_fake(UA_EventLoop *el) {
|
||||
return testingClock;
|
||||
}
|
||||
|
||||
@@ -18,9 +18,6 @@
|
||||
/* Forwards the testing clock by the given duration in ms */
|
||||
void UA_fakeSleep(UA_UInt32 duration);
|
||||
|
||||
/* Sleep for the duration in milliseconds. Used to wait for workers to complete. */
|
||||
void UA_realSleep(UA_UInt32 duration);
|
||||
|
||||
/* To be hooked into the EventLoop for unit tests that need deterministic timings */
|
||||
UA_DateTime UA_DateTime_now_fake(UA_EventLoop *el);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user