spmsgq_err[12]: Add message sizes to configuration

The test had hard-coded numbers for maximum messages and message sizes.
As a result, it did not configure the memory required for message
storage.
This commit is contained in:
Joel Sherrill
2021-11-01 13:11:36 -05:00
parent 6dee307542
commit f075fa55cd
4 changed files with 29 additions and 11 deletions

View File

@@ -32,8 +32,6 @@
#define CONFIGURE_INIT
#include "system.h"
#define MESSAGE_SIZE (sizeof(long) * 4)
const char rtems_test_name[] = "SP MESSAGE QUEUE ERROR 1";
rtems_task Init(
@@ -44,6 +42,8 @@ rtems_task Init(
uint32_t count;
size_t size;
rtems_status_code status;
rtems_test_assert( MAX_MESSAGES == 2 );
TEST_BEGIN();
Queue_name[ 1 ] = rtems_build_name( 'M', 'Q', '1', ' ' );
@@ -60,7 +60,7 @@ rtems_task Init(
/* null ID parameter */
status = rtems_message_queue_create(
Queue_name[ 1 ],
3,
MAX_MESSAGES,
MESSAGE_SIZE,
RTEMS_DEFAULT_ATTRIBUTES,
NULL
@@ -90,7 +90,7 @@ rtems_task Init(
/* max size == 0 */
status = rtems_message_queue_create(
Queue_name[ 1 ],
3,
MAX_MESSAGES,
0,
RTEMS_DEFAULT_ATTRIBUTES,
&Junk_id
@@ -105,7 +105,7 @@ rtems_task Init(
/* bad name parameter */
status = rtems_message_queue_create(
0,
3,
MAX_MESSAGES,
MESSAGE_SIZE,
RTEMS_DEFAULT_ATTRIBUTES,
&Junk_id
@@ -149,7 +149,7 @@ rtems_task Init(
status = rtems_message_queue_create(
Queue_name[ 1 ],
2,
MAX_MESSAGES,
MESSAGE_SIZE,
RTEMS_DEFAULT_ATTRIBUTES,
&Queue_id[ 1 ]
@@ -159,7 +159,7 @@ rtems_task Init(
status = rtems_message_queue_create(
Queue_name[ 2 ],
1,
MAX_MESSAGES,
MESSAGE_SIZE,
RTEMS_DEFAULT_ATTRIBUTES,
&Junk_id

View File

@@ -33,6 +33,12 @@
#include <tmacros.h>
/*
* Message buffer information
*/
#define MAX_MESSAGES 2
#define MESSAGE_SIZE (sizeof(long) * 4)
/* functions */
rtems_task Init(
@@ -52,6 +58,9 @@ rtems_task Init(
#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0
#define CONFIGURE_TICKS_PER_TIMESLICE 100
#define CONFIGURE_MESSAGE_BUFFER_MEMORY \
CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(MAX_MESSAGES, MESSAGE_SIZE)
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_EXTRA_TASK_STACKS (20 * RTEMS_MINIMUM_STACK_SIZE)

View File

@@ -33,8 +33,6 @@
#define CONFIGURE_INIT
#include "system.h"
#define MESSAGE_SIZE (sizeof(long) * 4)
const char rtems_test_name[] = "SP MESSAGE QUEUE ERROR 2";
rtems_task Init(
@@ -43,6 +41,8 @@ rtems_task Init(
{
long buffer[ 4 ];
rtems_status_code status;
rtems_test_assert( MAX_MESSAGES == 2 );
TEST_BEGIN();
Queue_name[ 1 ] = rtems_build_name( 'M', 'Q', '1', ' ' );
@@ -61,7 +61,7 @@ rtems_task Init(
status = rtems_message_queue_create(
Queue_name[ 1 ],
2,
MAX_MESSAGES,
MESSAGE_SIZE,
RTEMS_DEFAULT_ATTRIBUTES,
&Queue_id[ 1 ]
@@ -75,7 +75,7 @@ rtems_task Init(
status = rtems_message_queue_create(
Queue_name[ 1 ],
2,
MAX_MESSAGES,
MESSAGE_SIZE,
RTEMS_DEFAULT_ATTRIBUTES,
&Queue_id[ 1 ]

View File

@@ -33,6 +33,12 @@
#include <tmacros.h>
/*
* Message buffer information
*/
#define MAX_MESSAGES 2
#define MESSAGE_SIZE (sizeof(long) * 4)
/* functions */
rtems_task Init(
@@ -56,6 +62,9 @@ rtems_task Task_3(
#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0
#define CONFIGURE_TICKS_PER_TIMESLICE 100
#define CONFIGURE_MESSAGE_BUFFER_MEMORY \
CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(MAX_MESSAGES, MESSAGE_SIZE)
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_EXTRA_TASK_STACKS (20 * RTEMS_MINIMUM_STACK_SIZE)