mirror of
https://github.com/espressif/openthread.git
synced 2026-10-07 16:27:35 +00:00
[posix] enhance reset implementation to support code coverage (#3071)
This commit is contained in:
@@ -37,6 +37,15 @@
|
||||
|
||||
#include "openthread-system.h"
|
||||
|
||||
#if OPENTHREAD_EXAMPLES_POSIX
|
||||
#include <setjmp.h>
|
||||
#include <unistd.h>
|
||||
|
||||
jmp_buf gResetJump;
|
||||
|
||||
void __gcov_flush();
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES
|
||||
void *otPlatCAlloc(size_t aNum, size_t aSize)
|
||||
{
|
||||
@@ -58,6 +67,17 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
otInstance *sInstance;
|
||||
|
||||
#if OPENTHREAD_EXAMPLES_POSIX
|
||||
if (setjmp(gResetJump))
|
||||
{
|
||||
alarm(0);
|
||||
#if OPENTHREAD_ENABLE_COVERAGE
|
||||
__gcov_flush();
|
||||
#endif
|
||||
execvp(argv[0], argv);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES
|
||||
size_t otInstanceBufferLength = 0;
|
||||
uint8_t *otInstanceBuffer = NULL;
|
||||
|
||||
Reference in New Issue
Block a user