vTaskDelete(NULL);
}
-TEST_CASE("flash write and erase work both on PRO CPU and on APP CPU", "[spi_flash]")
+TEST_CASE("flash write and erase work both on PRO CPU and on APP CPU", "[spi_flash][ignore]")
{
- TaskHandle_t procpu_task;
- TaskHandle_t appcpu_task;
- struct flash_test_ctx ctx;
+ SemaphoreHandle_t done = xSemaphoreCreateCounting(4, 0);
+ struct flash_test_ctx ctx[4] = {
+ { .offset = 0x100 + 6, .done = done },
+ { .offset = 0x100 + 7, .done = done },
+ { .offset = 0x100 + 8, .done = done },
+ { .offset = 0x100 + 9, .done = done }
+ };
- ctx.offset[0] = 6;
- ctx.offset[1] = 7;
- ctx.fail[0] = 0;
- ctx.fail[1] = 0;
- ctx.done = xSemaphoreCreateBinary();
+ xTaskCreatePinnedToCore(flash_test_task, "1", 2048, &ctx[0], 3, NULL, 0);
+ xTaskCreatePinnedToCore(flash_test_task, "2", 2048, &ctx[1], 3, NULL, 1);
+ xTaskCreatePinnedToCore(flash_test_task, "3", 2048, &ctx[2], 3, NULL, tskNO_AFFINITY);
+ xTaskCreatePinnedToCore(flash_test_task, "4", 2048, &ctx[3], 3, NULL, tskNO_AFFINITY);
- xTaskCreatePinnedToCore(flash_test_task, "1", 2048, &ctx, 3, &procpu_task, 0);
- if (portNUM_PROCESSORS == 2) {
- xTaskCreatePinnedToCore(flash_test_task, "2", 2048, &ctx, 3, &appcpu_task, 1);
- }
-
- xSemaphoreTake(ctx.done, portMAX_DELAY);
- if (portNUM_PROCESSORS == 2) {
- xSemaphoreTake(ctx.done, portMAX_DELAY);
- }
-
- TEST_ASSERT_EQUAL(false, ctx.fail[0]);
- if (portNUM_PROCESSORS == 2) {
- TEST_ASSERT_EQUAL(false, ctx.fail[1]);
+ for (int i = 0; i < 4; ++i) {
+ xSemaphoreTake(done, portMAX_DELAY);
+ TEST_ASSERT_FALSE(ctx[i].fail);
}
+ vSemaphoreDelete(done);
}