Merge pull request #7555 from yuhaoth/pr/remove-delay-milliseconds-test

Remove delay milliseconds test to workaround randome platform-suite fail.
This commit is contained in:
Gilles Peskine 2023-05-07 20:34:44 +02:00 committed by GitHub
commit fca2d2b78c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View file

@ -4,6 +4,3 @@ time_get_milliseconds:
Time: get seconds
time_get_seconds:
Time: delay milliseconds
time_delay_milliseconds:1000

View file

@ -10,7 +10,8 @@
#if defined(MBEDTLS_HAVE_TIME)
#include "mbedtls/platform_time.h"
#ifdef WIN32
#if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || \
defined(__MINGW32__) || defined(_WIN64)
#include <windows.h>
#elif _POSIX_C_SOURCE >= 199309L
#include <time.h>
@ -19,7 +20,8 @@
#endif
void sleep_ms(int milliseconds)
{
#ifdef WIN32
#if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || \
defined(__MINGW32__) || defined(_WIN64)
Sleep(milliseconds);
#elif _POSIX_C_SOURCE >= 199309L
struct timespec ts;
@ -64,6 +66,13 @@ void time_delay_milliseconds(int delay_ms)
mbedtls_ms_time_t current = mbedtls_ms_time();
mbedtls_ms_time_t elapsed_ms;
/*
* WARNING: DO NOT ENABLE THIS TEST. We keep the code here to document the
* reason.
*
* Windows CI reports random test fail on platform-suite. It might
* be caused by this case.
*/
sleep_ms(delay_ms);
elapsed_ms = mbedtls_ms_time() - current;