25
25
26
26
#define NUM_BLOCKS 64
27
27
28
- #define DEFRAG_BLK_TEST 2222
29
-
30
28
/* size of stack area used by each thread */
31
29
#define STACKSIZE 512
32
30
33
31
K_SEM_DEFINE (ALTERNATE_SEM , 0 , 1 );
34
- K_SEM_DEFINE (DEFRAG_SEM , 0 , 1 );
35
32
K_SEM_DEFINE (REGRESS_SEM , 0 , 1 );
36
33
K_SEM_DEFINE (HELPER_SEM , 0 , 1 );
37
34
@@ -84,19 +81,6 @@ static struct TEST_CASE getwt_set[] = {
84
81
{ & block_list [4 ], & POOL_ID , 256 , TENTH_SECOND , - EAGAIN }
85
82
};
86
83
87
- static struct TEST_CASE defrag [] = {
88
- { & block_list [0 ], & POOL_ID , 64 , 0 , 0 },
89
- { & block_list [1 ], & POOL_ID , 64 , 0 , 0 },
90
- { & block_list [2 ], & POOL_ID , 64 , 0 , 0 },
91
- { & block_list [3 ], & POOL_ID , 64 , 0 , 0 },
92
- { & block_list [4 ], & POOL_ID , 256 , 0 , 0 },
93
- { & block_list [5 ], & POOL_ID , 256 , 0 , 0 },
94
- { & block_list [6 ], & POOL_ID , 256 , 0 , 0 },
95
- { & block_list [7 ], & POOL_ID , 1024 , 0 , 0 },
96
- { & block_list [8 ], & POOL_ID , 1024 , 0 , 0 },
97
- { & block_list [9 ], & POOL_ID , 1024 , 0 , 0 }
98
- };
99
-
100
84
/**
101
85
*
102
86
* @brief Compare the two blocks
@@ -357,72 +341,6 @@ int pool_block_get_wait_test(void)
357
341
return TC_PASS ;
358
342
}
359
343
360
- /**
361
- *
362
- * @brief Task responsible for defragmenting the pool POOL_ID
363
- *
364
- * @return N/A
365
- */
366
-
367
- void defrag_task (void )
368
- {
369
- k_sem_take (& DEFRAG_SEM , K_FOREVER ); /* Wait to be activated */
370
-
371
- k_mem_pool_defrag (& POOL_ID );
372
-
373
- k_sem_give (& REGRESS_SEM ); /* defrag_task is finished */
374
- }
375
-
376
- /**
377
- *
378
- * pool_defrag_test -
379
- *
380
- * @return TC_PASS on success, TC_FAIL on failure
381
- */
382
-
383
- int pool_defrag_test (void )
384
- {
385
- int rv ;
386
- struct k_mem_block new_block ;
387
-
388
- /* Get a bunch of blocks */
389
-
390
- rv = pool_block_get_work ("k_mem_pool_alloc" , pool_block_get_func ,
391
- defrag , ARRAY_SIZE (defrag ));
392
- if (rv != TC_PASS ) {
393
- return TC_FAIL ;
394
- }
395
-
396
-
397
- k_sem_give (& DEFRAG_SEM ); /* Activate defrag_task */
398
-
399
- /*
400
- * Block on getting another block from the pool.
401
- * This will allow defrag_task to execute so that we can get some
402
- * better code coverage. 500 ms is expected to more than sufficient
403
- * time for defrag_task to finish.
404
- */
405
-
406
- rv = k_mem_pool_alloc (& POOL_ID , & new_block , DEFRAG_BLK_TEST , 500 );
407
- if (rv != - EAGAIN ) {
408
- TC_ERROR ("k_mem_pool_alloc() returned %d, not %d\n" , rv ,
409
- - EAGAIN );
410
- return TC_FAIL ;
411
- }
412
-
413
- rv = k_sem_take (& REGRESS_SEM , K_NO_WAIT );
414
- if (rv != 0 ) {
415
- TC_ERROR ("defrag_task did not finish in allotted time!\n" );
416
- return TC_FAIL ;
417
- }
418
-
419
- /* Free the allocated blocks */
420
-
421
- free_blocks (defrag , ARRAY_SIZE (defrag ));
422
-
423
- return TC_PASS ;
424
- }
425
-
426
344
/**
427
345
*
428
346
* @brief Alternate task in the test suite
@@ -557,10 +475,6 @@ void test_mem_pool(void)
557
475
tc_rc = pool_block_get_wait_test ();
558
476
zassert_equal (tc_rc , TC_PASS , "pool block wait failure" );
559
477
560
- TC_PRINT ("Testing k_mem_pool_defragment() ...\n" );
561
- tc_rc = pool_defrag_test ();
562
- zassert_equal (tc_rc , TC_PASS , "pool defrag failure" );
563
-
564
478
tc_rc = pool_malloc_test ();
565
479
zassert_equal (tc_rc , TC_PASS , "pool malloc failure" );
566
480
}
@@ -569,9 +483,6 @@ void test_mem_pool(void)
569
483
K_THREAD_DEFINE (t_alternate , STACKSIZE , alternate_task , NULL , NULL , NULL ,
570
484
6 , 0 , K_NO_WAIT );
571
485
572
- K_THREAD_DEFINE (t_defrag , STACKSIZE , defrag_task , NULL , NULL , NULL ,
573
- 7 , 0 , K_NO_WAIT );
574
-
575
486
K_THREAD_DEFINE (t_helper , STACKSIZE , helper_task , NULL , NULL , NULL ,
576
487
7 , 0 , K_NO_WAIT );
577
488
0 commit comments