change(esp_libc): rename newlib component to esp_libc

This commit is contained in:
Alexey Lapshin
2025-08-28 11:56:31 +07:00
committed by BOT
parent aae5071dff
commit 9281e78381
149 changed files with 127 additions and 122 deletions

View File

@@ -0,0 +1,40 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
#include <setjmp.h>
#include <stdio.h>
#include <inttypes.h>
#include "unity.h"
#include "esp_system.h"
typedef struct {
jmp_buf jmp_env;
uint32_t retval;
volatile bool inner_called;
} setjmp_test_ctx_t;
static __attribute__((noreturn)) void inner(setjmp_test_ctx_t *ctx)
{
printf("inner, retval=0x%" PRIx32 "\n", ctx->retval);
ctx->inner_called = true;
longjmp(ctx->jmp_env, ctx->retval);
TEST_FAIL_MESSAGE("Should not reach here");
}
TEST_CASE("setjmp and longjmp", "[newlib]")
{
const uint32_t expected = 0x12345678;
setjmp_test_ctx_t ctx = {
.retval = expected
};
uint32_t ret = setjmp(ctx.jmp_env);
if (!ctx.inner_called) {
TEST_ASSERT_EQUAL(0, ret);
inner(&ctx);
} else {
TEST_ASSERT_EQUAL(expected, ret);
}
TEST_ASSERT(ctx.inner_called);
}