-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This allows using unity fixture in Linux host tests
- Loading branch information
Showing
2 changed files
with
46 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
#include <string.h> | ||
#include <stdbool.h> | ||
#include <unistd.h> | ||
#include <stdio.h> | ||
#include <sys/time.h> | ||
#include "unity.h" | ||
#include "sdkconfig.h" | ||
|
||
|
||
static struct timeval s_test_start, s_test_stop; | ||
|
||
void unity_putc(int c) | ||
{ | ||
putc(c, stdout); | ||
} | ||
|
||
void unity_flush(void) | ||
{ | ||
fflush(stdout); | ||
fsync(fileno(stdout)); | ||
} | ||
|
||
void unity_exec_time_start(void) | ||
{ | ||
gettimeofday(&s_test_start, NULL); | ||
} | ||
|
||
void unity_exec_time_stop(void) | ||
{ | ||
gettimeofday(&s_test_stop, NULL); | ||
} | ||
|
||
uint32_t unity_exec_time_get_ms(void) | ||
{ | ||
return (uint32_t) (((s_test_stop.tv_sec * 1000000ULL + s_test_stop.tv_usec) - | ||
(s_test_start.tv_sec * 1000000ULL + s_test_start.tv_usec)) / 1000); | ||
} |