@@ -417,13 +417,32 @@ static void tmbox(struct k_mbox *pmbox)
417
417
k_thread_abort (receiver_tid );
418
418
}
419
419
420
- /*test cases*/
420
+ /**
421
+ * @addtogroup kernel_mbox_api
422
+ * @{
423
+ */
424
+
425
+
426
+ /**
427
+ * @brief Test mailbox initialization
428
+ */
421
429
ZTEST (mbox_api , test_mbox_kinit )
422
430
{
423
431
/**TESTPOINT: init via k_mbox_init*/
424
432
k_mbox_init (& mbox );
425
433
}
426
434
435
+ /**
436
+ * @brief Test mailbox definition
437
+ *
438
+ * @details
439
+ * - Define a mailbox and verify the mailbox whether as expected
440
+ * - Verify the mailbox can be used
441
+ *
442
+ * @ingroup kernel_mbox_api
443
+ *
444
+ * @see k_mbox_init() k_mbox_put() k_mbox_get()
445
+ */
427
446
ZTEST (mbox_api , test_mbox_kdefine )
428
447
{
429
448
info_type = PUT_GET_NULL ;
@@ -434,7 +453,7 @@ static ZTEST_BMEM char __aligned(4) buffer[8];
434
453
435
454
/**
436
455
*
437
- * @brief Test mailbox enhance capabilities
456
+ * @brief Test mailbox enhanced capabilities
438
457
*
439
458
* @details
440
459
* - Define and initialized a message queue and a mailbox
@@ -445,7 +464,7 @@ static ZTEST_BMEM char __aligned(4) buffer[8];
445
464
*
446
465
* @see k_msgq_init() k_msgq_put() k_mbox_async_put() k_mbox_get()
447
466
*/
448
- ZTEST (mbox_api , test_enhance_capability )
467
+ ZTEST (mbox_api , test_mbox_enhanced_capabilities )
449
468
{
450
469
info_type = ASYNC_PUT_GET_BUFFER ;
451
470
struct k_msgq msgq ;
@@ -460,15 +479,13 @@ ZTEST(mbox_api, test_enhance_capability)
460
479
tmbox (& mbox );
461
480
}
462
481
463
- /*
464
- *
465
- * @brife Test any number of mailbox can be defined
482
+ /**
483
+ * @brief Test that multiple mailboxs can be defined
466
484
*
467
485
* @details
468
- * - Define multi mailbox and verify the mailbox whether as
486
+ * - Define multiple mailbox and verify the mailbox whether as
469
487
* expected
470
488
* - Verify the mailbox can be used
471
- *
472
489
*/
473
490
ZTEST (mbox_api , test_define_multi_mbox )
474
491
{
@@ -486,84 +503,129 @@ ZTEST(mbox_api, test_define_multi_mbox)
486
503
tmbox (& mbox3 );
487
504
}
488
505
506
+ /**
507
+ * @brief Test case for mailbox put and get operations with null data.
508
+ */
489
509
ZTEST (mbox_api , test_mbox_put_get_null )
490
510
{
491
511
info_type = PUT_GET_NULL ;
492
512
tmbox (& mbox );
493
513
}
494
514
515
+ /**
516
+ * @brief Test case for mailbox put and get operations with buffer.
517
+ *
518
+ */
495
519
ZTEST (mbox_api , test_mbox_put_get_buffer )
496
520
{
497
521
info_type = PUT_GET_BUFFER ;
498
522
tmbox (& mbox );
499
523
}
500
524
525
+ /**
526
+ * @brief Test case for mailbox asynchronous put and get operations with buffer.
527
+ *
528
+ */
501
529
ZTEST (mbox_api , test_mbox_async_put_get_buffer )
502
530
{
503
531
info_type = ASYNC_PUT_GET_BUFFER ;
504
532
tmbox (& mbox );
505
533
}
506
534
535
+ /**
536
+ * @brief Test case for mailbox asynchronous put and get operations with block.
537
+ *
538
+ */
507
539
ZTEST (mbox_api , test_mbox_async_put_get_block )
508
540
{
509
541
info_type = ASYNC_PUT_GET_BLOCK ;
510
542
tmbox (& mbox );
511
543
}
512
544
545
+ /**
546
+ * @brief Test case for mailbox target/source thread buffer operations.
547
+ */
513
548
ZTEST (mbox_api , test_mbox_target_source_thread_buffer )
514
549
{
515
550
info_type = TARGET_SOURCE_THREAD_BUFFER ;
516
551
tmbox (& mbox );
517
552
}
518
553
554
+ /**
555
+ * @brief Test case for mailbox incorrect receiver thread ID.
556
+ */
519
557
ZTEST (mbox_api , test_mbox_incorrect_receiver_tid )
520
558
{
521
559
info_type = INCORRECT_RECEIVER_TID ;
522
560
tmbox (& mbox );
523
561
}
524
562
563
+ /**
564
+ * @brief Test case for mailbox incorrect transmit thread ID.
565
+ */
525
566
ZTEST (mbox_api , test_mbox_incorrect_transmit_tid )
526
567
{
527
568
info_type = INCORRECT_TRANSMIT_TID ;
528
569
tmbox (& mbox );
529
570
}
530
571
572
+ /**
573
+ * @brief Test case for mailbox timed out get operation.
574
+ */
531
575
ZTEST (mbox_api , test_mbox_timed_out_mbox_get )
532
576
{
533
577
info_type = TIMED_OUT_MBOX_GET ;
534
578
tmbox (& mbox );
535
579
}
536
580
581
+ /**
582
+ * @brief Test case for mailbox message thread ID mismatch.
583
+ */
537
584
ZTEST (mbox_api , test_mbox_msg_tid_mismatch )
538
585
{
539
586
info_type = MSG_TID_MISMATCH ;
540
587
tmbox (& mbox );
541
588
}
542
589
590
+ /**
591
+ * @brief Test case for mailbox dispose size 0 message.
592
+ */
543
593
ZTEST (mbox_api , test_mbox_dispose_size_0_msg )
544
594
{
545
595
info_type = DISPOSE_SIZE_0_MSG ;
546
596
tmbox (& mbox );
547
597
}
548
598
599
+ /**
600
+ * @brief Test case for mailbox asynchronous put to waiting get operation.
601
+ */
549
602
ZTEST (mbox_api , test_mbox_async_put_to_waiting_get )
550
603
{
551
604
info_type = ASYNC_PUT_TO_WAITING_GET ;
552
605
tmbox (& mbox );
553
606
}
554
607
608
+ /**
609
+ * @brief Test case for mailbox get waiting put with incorrect thread ID.
610
+ */
555
611
ZTEST (mbox_api , test_mbox_get_waiting_put_incorrect_tid )
556
612
{
557
613
info_type = GET_WAITING_PUT_INCORRECT_TID ;
558
614
tmbox (& mbox );
559
615
}
560
616
617
+ /**
618
+ * @brief Test case for mailbox asynchronous multiple put operation.
619
+ */
561
620
ZTEST (mbox_api , test_mbox_async_multiple_put )
562
621
{
563
622
info_type = ASYNC_MULTIPLE_PUT ;
564
623
tmbox (& mbox );
565
624
}
566
625
626
+ /**
627
+ * @brief Test case for mailbox multiple waiting get operation.
628
+ */
567
629
ZTEST (mbox_api , test_mbox_multiple_waiting_get )
568
630
{
569
631
info_type = MULTIPLE_WAITING_GET ;
@@ -584,4 +646,8 @@ void *setup_mbox_api(void)
584
646
return NULL ;
585
647
}
586
648
649
+ /**
650
+ * @}
651
+ */
652
+
587
653
ZTEST_SUITE (mbox_api , NULL , setup_mbox_api , NULL , NULL , NULL );
0 commit comments