![]() |
SuperTinyKernel™ RTOS 1.05.3
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
|
#include <stk_config.h>#include <stk.h>#include <memory/stk_memory_blockpool.h>#include <assert.h>#include <string.h>#include "stktest_context.h"Go to the source code of this file.
Classes | |
| class | stk::test::blockpool::TryAllocFreeTask< _AccessMode > |
| Verifies TryAlloc returns a valid block, Free recycles it, and pool accounting stays consistent throughout. More... | |
| class | stk::test::blockpool::ExhaustPoolTask< _AccessMode > |
| Drains the entire pool via TryAlloc, verifies IsFull() and that a further TryAlloc returns nullptr, then frees every block. More... | |
| class | stk::test::blockpool::BlockingAllocTask< _AccessMode > |
| Task 0 holds all blocks; Task 1 blocks in Alloc(); Task 0 frees one block and verifies Task 1 unblocks and completes successfully. More... | |
| class | stk::test::blockpool::TimedAllocTimeoutTask< _AccessMode > |
| Task 0 holds all blocks; Task 1 calls TimedAlloc with a short timeout that must expire, returning nullptr within the expected window. More... | |
| class | stk::test::blockpool::TimedAllocSuccessTask< _AccessMode > |
| Task 0 holds all blocks; Task 1 calls TimedAlloc with a generous timeout; Task 0 frees a block before the timeout so Task 1 succeeds. More... | |
| class | stk::test::blockpool::ConcurrentAllocFreeTask< _AccessMode > |
| All tasks race to alloc a block, increment a shared counter inside the block, copy it out and free; total counter must equal iterations * tasks. More... | |
| struct | stk::test::blockpool::TestRecord |
| class | stk::test::blockpool::TypedAllocTask< _AccessMode > |
| Verifies that the typed wrappers AllocT<T>(), TryAllocT<T>(), and TimedAllocT<T>() return correctly typed pointers and that written fields are preserved until Free(). More... | |
| class | stk::test::blockpool::FreeNullTask< _AccessMode > |
| Ensures Free(nullptr) returns false and does not corrupt the pool. More... | |
| class | stk::test::blockpool::AlignBlockSizeTask< _AccessMode > |
| Verifies AlignBlockSize() rounds up to BLOCK_ALIGN multiples and never returns a value smaller than BLOCK_ALIGN. More... | |
| class | stk::test::blockpool::StorageModeTask< _AccessMode > |
| Creates a second pool using heap storage and verifies accessors report correct values for both storage modes. More... | |
| class | stk::test::blockpool::StressTask< _AccessMode > |
| All tasks hammer the pool with a mix of TryAlloc, blocking Alloc, and TimedAlloc operations; verifies the pool never leaks or deadlocks. More... | |
Namespaces | |
| namespace | stk |
| Namespace of STK package. | |
| namespace | stk::test |
| Namespace of the test inventory. | |
| namespace | stk::test::blockpool |
| Namespace of BlockMemoryPool test. | |
Macros | |
| #define | _STK_POOL_TEST_TASKS_MAX 5 |
| #define | _STK_POOL_TEST_TIMEOUT 1000 |
| #define | _STK_POOL_TEST_SHORT_SLEEP 10 |
| #define | _STK_POOL_TEST_LONG_SLEEP 100 |
| #define | _STK_POOL_BLOCK_SIZE 32U |
| #define | _STK_POOL_CAPACITY 8U |
| #define | _STK_POOL_STACK_SIZE 256 |
| #define | STK_TASK static |
| #define | RUN(TestClass, name, param) |
Functions | |
| void | STK_ASSERT_HANDLER (const char *message, const char *file, int32_t line) |
| static void | stk::test::blockpool::ResetTestState () |
| static bool | NeedsTwoTasks (const char *test_name) |
| static bool | NeedsAllTasks (const char *test_name) |
| template<class TaskType> | |
| static int32_t | RunTest (const char *test_name, int32_t param=0) |
| int | main (int argc, char **argv) |
Variables | |
| static volatile int32_t | stk::test::blockpool::g_TestResult = 0 |
| static volatile int32_t | stk::test::blockpool::g_InstancesDone = 0 |
| static volatile int32_t | stk::test::blockpool::g_SharedCounter = 0 |
| static Kernel< KERNEL_DYNAMIC|KERNEL_SYNC|(STK_TICKLESS_IDLE ? KERNEL_TICKLESS :0), 5, SwitchStrategyRR, PlatformDefault > | stk::test::blockpool::g_Kernel |
| static uint8_t | stk::test::blockpool::g_PoolStorage [8U *stk::memory::BlockMemoryPool::AlignBlockSize(32U)] |
| static stk::memory::BlockMemoryPool * | stk::test::blockpool::g_Pool = nullptr |
| #define _STK_POOL_BLOCK_SIZE 32U |
Definition at line 27 of file test_blockpool.cpp.
Referenced by stk::test::blockpool::AlignBlockSizeTask< _AccessMode >::Run(), stk::test::blockpool::StressTask< _AccessMode >::Run(), stk::test::blockpool::TryAllocFreeTask< _AccessMode >::Run(), and RunTest().
| #define _STK_POOL_CAPACITY 8U |
Definition at line 28 of file test_blockpool.cpp.
Referenced by stk::test::blockpool::BlockingAllocTask< _AccessMode >::Run(), stk::test::blockpool::ExhaustPoolTask< _AccessMode >::Run(), stk::test::blockpool::StorageModeTask< _AccessMode >::Run(), stk::test::blockpool::TimedAllocSuccessTask< _AccessMode >::Run(), stk::test::blockpool::TimedAllocTimeoutTask< _AccessMode >::Run(), stk::test::blockpool::TryAllocFreeTask< _AccessMode >::Run(), and RunTest().
| #define _STK_POOL_STACK_SIZE 256 |
Definition at line 33 of file test_blockpool.cpp.
| #define _STK_POOL_TEST_LONG_SLEEP 100 |
Definition at line 26 of file test_blockpool.cpp.
Referenced by stk::test::blockpool::TimedAllocSuccessTask< _AccessMode >::Run().
| #define _STK_POOL_TEST_SHORT_SLEEP 10 |
Definition at line 25 of file test_blockpool.cpp.
Referenced by stk::test::blockpool::BlockingAllocTask< _AccessMode >::Run(), stk::test::blockpool::ConcurrentAllocFreeTask< _AccessMode >::Run(), stk::test::blockpool::StressTask< _AccessMode >::Run(), stk::test::blockpool::TimedAllocSuccessTask< _AccessMode >::Run(), and stk::test::blockpool::TimedAllocTimeoutTask< _AccessMode >::Run().
| #define _STK_POOL_TEST_TASKS_MAX 5 |
Definition at line 23 of file test_blockpool.cpp.
Referenced by stk::test::blockpool::ConcurrentAllocFreeTask< _AccessMode >::Run(), and stk::test::blockpool::StressTask< _AccessMode >::Run().
| #define _STK_POOL_TEST_TIMEOUT 1000 |
Definition at line 24 of file test_blockpool.cpp.
| #define RUN | ( | TestClass, | |
| name, | |||
| param ) |
Referenced by main().
| #define STK_TASK static |
| int main | ( | int | argc, |
| char ** | argv ) |
Definition at line 811 of file test_blockpool.cpp.
References stk::test::TestContext::DEFAULT_FAILURE_EXIT_CODE, stk::test::blockpool::g_Kernel, RUN, stk::test::TestContext::ShowTestSuiteEpilogue(), stk::test::TestContext::ShowTestSuitePrologue(), and stk::test::TestContext::SUCCESS_EXIT_CODE.
|
static |
Definition at line 740 of file test_blockpool.cpp.
Referenced by RunTest().
|
static |
Definition at line 726 of file test_blockpool.cpp.
Referenced by RunTest().
|
static |
Definition at line 754 of file test_blockpool.cpp.
References _STK_POOL_BLOCK_SIZE, _STK_POOL_CAPACITY, stk::memory::BlockMemoryPool(), stk::test::TestContext::DEFAULT_FAILURE_EXIT_CODE, stk::test::blockpool::g_Kernel, stk::test::blockpool::g_Pool, stk::test::blockpool::g_PoolStorage, stk::test::blockpool::g_TestResult, NeedsAllTasks(), NeedsTwoTasks(), stk::test::blockpool::ResetTestState(), STK_TASK, and stk::test::TestContext::SUCCESS_EXIT_CODE.
Referenced by main().
|
extern |
Definition at line 21 of file test_blockpool.cpp.
References STK_TEST_DECL_ASSERT.