mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-03-20 11:11:08 +01:00
Add smoke test for gettimeofday()
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
@@ -10,3 +10,7 @@ clock_gettime_available:CLOCK_REALTIME
|
||||
# CLOCK_BOOTTIME is available.
|
||||
clock_gettime(CLOCK_MONOTONIC) smoke test
|
||||
clock_gettime_available:CLOCK_MONOTONIC
|
||||
|
||||
# Used in library/timing.c and programs/test/benchmark.c
|
||||
gettimeofday() smoke test
|
||||
gettimeofday_available:
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#else /* defined(MBEDTLS_PLATFORM_IS_UNIXLIKE) */
|
||||
|
||||
@@ -54,3 +55,14 @@ void clock_gettime_available(int clockid)
|
||||
TEST_LE_S(1, ts.tv_sec);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_PLATFORM_IS_UNIXLIKE */
|
||||
void gettimeofday_available()
|
||||
{
|
||||
struct timeval tv = { 0, 0 };
|
||||
memset(&tv, 0, sizeof(tv));
|
||||
int ret = gettimeofday(&tv, NULL);
|
||||
TEST_ASSERT_ERRNO(ret == 0);
|
||||
TEST_LE_S(1, tv.tv_sec);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
Reference in New Issue
Block a user