Skip to content

Commit c3f5b64

Browse files
committed
Remove double free RTOS tests
Remove the double free RTOS tests since this was never defined behavior of CMSIS-RTOS. This allows testing to pass. The RTX commit which caused this test to start failing is: c3b123ef4256f65537e2597af475fc20ec9a383e RTX5: updated MemoryPoolFree (removed count check) [SDCMSIS-801] Note - Double freeing an element from a memory pool was never safe. The error return value when double freeing was misleading since memory corruption may still be occurring in that case. For more information on this see SDCMSIS-801.
1 parent 308dfe3 commit c3f5b64

File tree

2 files changed

+0
-56
lines changed

2 files changed

+0
-56
lines changed

TESTS/mbedmicro-rtos-mbed/MemoryPool/main.cpp

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -450,38 +450,6 @@ void test_mem_pool_free_realloc_first_complex(AllocType atype)
450450
}
451451
}
452452

453-
/* Robustness checks for free() function.
454-
*
455-
* Given block from the MemoryPool has been successfully deallocated.
456-
* When free operation is executed on this block again.
457-
* Then operation fails with osErrorResource status.
458-
*
459-
* */
460-
void test_mem_pool_free_on_freed_block()
461-
{
462-
MemoryPool<int, 1> mem_pool;
463-
int *p_block;
464-
osStatus status;
465-
466-
/* Allocate memory block. */
467-
p_block = mem_pool.alloc();
468-
469-
/* Show that memory pool block has been allocated. */
470-
TEST_ASSERT_NOT_NULL(p_block);
471-
472-
/* Free memory block. */
473-
status = mem_pool.free(p_block);
474-
475-
/* Check operation status. */
476-
TEST_ASSERT_EQUAL(osOK, status);
477-
478-
/* Free memory block again. */
479-
status = mem_pool.free(p_block);
480-
481-
/* Check operation status. */
482-
TEST_ASSERT_EQUAL(osErrorResource, status);
483-
}
484-
485453
/* Robustness checks for free() function.
486454
* Function under test is called with invalid parameters.
487455
*
@@ -601,7 +569,6 @@ Case cases[] = {
601569

602570
Case("Test: fail (out of free blocks).", test_mem_pool_alloc_fail_wrapper<int, 3>),
603571

604-
Case("Test: free() - robust (free block twice).", test_mem_pool_free_on_freed_block),
605572
Case("Test: free() - robust (free called with invalid param - NULL).", free_block_invalid_parameter_null),
606573
Case("Test: free() - robust (free called with invalid param).", free_block_invalid_parameter)
607574
};

TESTS/mbedmicro-rtos-mbed/mail/main.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -265,28 +265,6 @@ void test_free_null()
265265
TEST_ASSERT_EQUAL(osErrorParameter, status);
266266
}
267267

268-
/** Test same message memory deallocation twice
269-
270-
Given an empty mailbox
271-
Then allocate message memory
272-
When try to free it second time
273-
Then it return appropriate error code
274-
*/
275-
void test_free_twice()
276-
{
277-
osStatus status;
278-
Mail<uint32_t, 4> mail_box;
279-
280-
uint32_t *mail = mail_box.alloc();
281-
TEST_ASSERT_NOT_EQUAL(NULL, mail);
282-
283-
status = mail_box.free(mail);
284-
TEST_ASSERT_EQUAL(osOK, status);
285-
286-
status = mail_box.free(mail);
287-
TEST_ASSERT_EQUAL(osErrorResource, status);
288-
}
289-
290268
/** Test get from empty mailbox with timeout set
291269
292270
Given an empty mailbox
@@ -515,7 +493,6 @@ Case cases[] = {
515493
Case("Test message send order", test_order),
516494
Case("Test get with timeout on empty mailbox", test_get_empty_timeout),
517495
Case("Test get without timeout on empty mailbox", test_get_empty_no_timeout),
518-
Case("Test message free twice", test_free_twice),
519496
Case("Test null message free", test_free_null),
520497
Case("Test invalid message free", test_free_wrong),
521498
Case("Test message send/receive single thread and order", test_single_thread_order),

0 commit comments

Comments
 (0)