refactor(tests): Remove last usage of realSleep

This commit is contained in:
Julius Pfrommer
2025-10-28 16:06:32 +01:00
committed by Julius Pfrommer
parent 424e400755
commit b3fb44ff5b
4 changed files with 0 additions and 23 deletions
-1
View File
@@ -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));
-2
View File
@@ -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 */
-17
View File
@@ -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;
}
-3
View File
@@ -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);