From 21f7947ab1d9e3d320ea25f3e4582eed1be09328 Mon Sep 17 00:00:00 2001 From: kar-rahul-aws <118818625+kar-rahul-aws@users.noreply.github.com> Date: Thu, 17 Aug 2023 16:51:18 +0530 Subject: [PATCH] Make unit tests backward compatible (#1073) Signed-off-by: Gaurav Aggarwal Co-authored-by: Gaurav Aggarwal --- FreeRTOS/Test/CMock/tasks/tasks_1_utest.c | 18 ++++++++++++++---- FreeRTOS/Test/CMock/tasks/tasks_2_utest.c | 20 ++++++++++++++++---- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/FreeRTOS/Test/CMock/tasks/tasks_1_utest.c b/FreeRTOS/Test/CMock/tasks/tasks_1_utest.c index b9ba3b1e1d..01ee57a41f 100644 --- a/FreeRTOS/Test/CMock/tasks/tasks_1_utest.c +++ b/FreeRTOS/Test/CMock/tasks/tasks_1_utest.c @@ -65,13 +65,23 @@ extern volatile TickType_t xTickCount; extern volatile UBaseType_t uxTopReadyPriority; extern volatile BaseType_t xSchedulerRunning; extern volatile TickType_t xPendedTicks; -extern volatile BaseType_t xYieldPendings[]; -#define xYieldPending xYieldPendings[ 0 ] + +#ifdef configNUMBER_OF_CORES + extern volatile BaseType_t xYieldPendings[]; + #define xYieldPending xYieldPendings[ 0 ] +#else + extern volatile BaseType_t xYieldPending; +#endif extern volatile BaseType_t xNumOfOverflows; extern UBaseType_t uxTaskNumber; extern volatile TickType_t xNextTaskUnblockTime; -extern TaskHandle_t xIdleTaskHandles[]; -#define xIdleTaskHandle xIdleTaskHandles[ 0 ] + +#ifdef configNUMBER_OF_CORES + extern TaskHandle_t xIdleTaskHandles[]; + #define xIdleTaskHandle xIdleTaskHandles[ 0 ] +#else + extern TaskHandle_t xIdleTaskHandle; +#endif extern volatile UBaseType_t uxSchedulerSuspended; /* ============================= DEFINES ================================== */ diff --git a/FreeRTOS/Test/CMock/tasks/tasks_2_utest.c b/FreeRTOS/Test/CMock/tasks/tasks_2_utest.c index 929108a776..c82b0f816f 100644 --- a/FreeRTOS/Test/CMock/tasks/tasks_2_utest.c +++ b/FreeRTOS/Test/CMock/tasks/tasks_2_utest.c @@ -64,13 +64,25 @@ extern volatile TickType_t xTickCount; extern volatile UBaseType_t uxTopReadyPriority; extern volatile BaseType_t xSchedulerRunning; extern volatile TickType_t xPendedTicks; -extern volatile BaseType_t xYieldPendings[]; -#define xYieldPending xYieldPendings[ 0 ] + +#ifdef configNUMBER_OF_CORES + extern volatile BaseType_t xYieldPendings[]; + #define xYieldPending xYieldPendings[ 0 ] +#else + extern volatile BaseType_t xYieldPending; +#endif + extern volatile BaseType_t xNumOfOverflows; extern UBaseType_t uxTaskNumber; extern volatile TickType_t xNextTaskUnblockTime; -extern TaskHandle_t xIdleTaskHandles[]; -#define xIdleTaskHandle xIdleTaskHandles[ 0 ] + +#ifdef configNUMBER_OF_CORES + extern TaskHandle_t xIdleTaskHandles[]; + #define xIdleTaskHandle xIdleTaskHandles[ 0 ] +#else + extern TaskHandle_t xIdleTaskHandle; +#endif + extern volatile UBaseType_t uxSchedulerSuspended;