mirror of
https://github.com/espressif/esp-idf
synced 2025-04-13 02:00:09 -04:00
Disabled test cases are tracked in: IDF-4465, IDF-5045, IDF-5057, IDF-5058, IDF-5059, IDF-5060, IDF-5061, IDF-5131 - test_fatfs: IDF-5136 - test_pm: IDF-5053 - test_cache_mmu: IDF-5138 - test_partitions: IDF-5137 - test_vfs: IDF-5139 - test_freertos: IDF-5140 - test_wpa_supplicant: IDF-5046 - test_mbedtls: IDF-5141 - test_pthread: IDF-5142 - test_protocomm: IDF-5143 - test_lightsleep: IDF-5053 - test_taskwdt: IDF-5055 - test_tcp_transport: IDF-5144 - test_app_update: IDF-5145 - test_timer: IDF-5052 - test_spi: IDF-5146 - test_rtc_clk: IDF-5060 - test_heap: IDF-5167 ci: fixed issues for tests of libgcc, ets_timer, newlib test_pm: support on C2
64 lines
1.6 KiB
C
64 lines
1.6 KiB
C
/*
|
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/*
|
|
Test for multicore FreeRTOS. This test spins up threads, fiddles with queues etc.
|
|
*/
|
|
|
|
#include <esp_types.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/task.h"
|
|
#include "freertos/semphr.h"
|
|
#include "freertos/queue.h"
|
|
#include "unity.h"
|
|
#include "test_utils.h"
|
|
|
|
volatile static int done;
|
|
volatile static int error;
|
|
|
|
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2)
|
|
//IDF-5140
|
|
static void tskTestRand(void *pvParameters)
|
|
{
|
|
int l;
|
|
srand(0x1234);
|
|
vTaskDelay((int)pvParameters / portTICK_PERIOD_MS);
|
|
l = rand();
|
|
printf("Rand1: %d\n", l);
|
|
if (l != 869320854) {
|
|
error++;
|
|
}
|
|
vTaskDelay((int)pvParameters / portTICK_PERIOD_MS);
|
|
l = rand();
|
|
printf("Rand2: %d\n", l);
|
|
if (l != 1148737841) {
|
|
error++;
|
|
}
|
|
done++;
|
|
vTaskDelete(NULL);
|
|
}
|
|
|
|
|
|
|
|
// TODO: split this thing into separate orthogonal tests
|
|
TEST_CASE("Test for per-task non-reentrant tasks", "[freertos]")
|
|
{
|
|
done = 0;
|
|
error = 0;
|
|
xTaskCreatePinnedToCore(tskTestRand, "tsk1", 2048, (void *)100, 3, NULL, 0);
|
|
xTaskCreatePinnedToCore(tskTestRand, "tsk2", 2048, (void *)200, 3, NULL, 0);
|
|
xTaskCreatePinnedToCore(tskTestRand, "tsk3", 2048, (void *)300, 3, NULL, portNUM_PROCESSORS - 1);
|
|
xTaskCreatePinnedToCore(tskTestRand, "tsk4", 2048, (void *)400, 3, NULL, 0);
|
|
while (done != 4) {
|
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
|
}
|
|
TEST_ASSERT(error == 0);
|
|
}
|
|
#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2)
|