2011-08-24 Ricardo Aguirre <el.mastin@ymail.com>

PR 1903/testing
	* Makefile.am, configure.ac, psxtmtests_plan.csv: Add test for message
	queues which covers most open, close, unlink cases as well as
	send/receive which do not involve task state changes.
	* psxtmmq01/.cvsignore, psxtmmq01/Makefile.am, psxtmmq01/init.c,
	psxtmmq01/psxtmmq01.doc: New files.
This commit is contained in:
Joel Sherrill
2011-08-24 21:15:58 +00:00
parent 3143f31fe6
commit f9c2370197
8 changed files with 383 additions and 10 deletions

View File

@@ -1,3 +1,12 @@
2011-08-24 Ricardo Aguirre <el.mastin@ymail.com>
PR 1903/testing
* Makefile.am, configure.ac, psxtmtests_plan.csv: Add test for message
queues which covers most open, close, unlink cases as well as
send/receive which do not involve task state changes.
* psxtmmq01/.cvsignore, psxtmmq01/Makefile.am, psxtmmq01/init.c,
psxtmmq01/psxtmmq01.doc: New files.
2011-08-04 Joel Sherrill <joel.sherrill@oarcorp.com> 2011-08-04 Joel Sherrill <joel.sherrill@oarcorp.com>
* psxtmtests_plan.csv: update. * psxtmtests_plan.csv: update.

View File

@@ -12,6 +12,7 @@ SUBDIRS += psxtmbarrier02
SUBDIRS += psxtmbarrier03 SUBDIRS += psxtmbarrier03
SUBDIRS += psxtmkey01 SUBDIRS += psxtmkey01
SUBDIRS += psxtmkey02 SUBDIRS += psxtmkey02
SUBDIRS += psxtmmq01
SUBDIRS += psxtmmutex01 SUBDIRS += psxtmmutex01
SUBDIRS += psxtmmutex02 SUBDIRS += psxtmmutex02
SUBDIRS += psxtmmutex03 SUBDIRS += psxtmmutex03

View File

@@ -84,6 +84,7 @@ psxtmbarrier02/Makefile
psxtmbarrier03/Makefile psxtmbarrier03/Makefile
psxtmkey01/Makefile psxtmkey01/Makefile
psxtmkey02/Makefile psxtmkey02/Makefile
psxtmmq01/Makefile
psxtmmutex01/Makefile psxtmmutex01/Makefile
psxtmmutex02/Makefile psxtmmutex02/Makefile
psxtmmutex03/Makefile psxtmmutex03/Makefile

View File

@@ -0,0 +1,2 @@
Makefile
Makefile.in

View File

@@ -0,0 +1,31 @@
##
## $Id$
##
MANAGERS = all
rtems_tests_PROGRAMS = psxtmmq01
psxtmmq01_SOURCES = init.c
psxtmmq01_SOURCES += ../../tmtests/include/timesys.h
psxtmmq01_SOURCES += ../../support/src/tmtests_empty_function.c
psxtmmq01_SOURCES += ../../support/src/tmtests_support.c
dist_rtems_tests_DATA = psxtmmq01.doc
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
OPERATION_COUNT = @OPERATION_COUNT@
AM_CPPFLAGS += -I$(top_srcdir)/../tmtests/include
AM_CPPFLAGS += -DOPERATION_COUNT=$(OPERATION_COUNT)
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
LINK_OBJS = $(psxtmmq01_OBJECTS) $(psxtmmq01_LDADD)
LINK_LIBS = $(psxtmmq01_LDLIBS)
psxtmmq01$(EXEEXT): $(psxtmmq01_OBJECTS) $(psxtmmq01_DEPENDENCIES)
@rm -f psxtmmq01$(EXEEXT)
$(make-exe)
include $(top_srcdir)/../automake/local.am

View File

@@ -0,0 +1,306 @@
/*
* COPYRIGHT (c) 1989-2011.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <fcntl.h>
#include <timesys.h>
#include <errno.h>
#include <rtems/timerdrv.h>
#include "test_support.h"
#include <tmacros.h>
#include <mqueue.h>
#include <signal.h> /* signal facilities */
#define MQ_MAXMSG 1
#define MQ_MSGSIZE sizeof(int)
mqd_t queue;
mqd_t queue2;
const char *q_name;
void benchmark_mq_open(int printable)
{
long end_time;
struct mq_attr attr;
attr.mq_maxmsg = MQ_MAXMSG;
attr.mq_msgsize = MQ_MSGSIZE;
q_name= "queue";
benchmark_timer_initialize();
queue = mq_open( q_name, O_CREAT | O_RDWR , 0x777, &attr );
end_time = benchmark_timer_read();
rtems_test_assert( queue != (-1) );
if (printable == 1)
put_time(
"mq_open (first open)",
end_time,
1, /* Only executed once */
0,
0
);
}
void benchmark_mq_open_second(int printable)
{
long end_time;
struct mq_attr attr;
attr.mq_maxmsg = MQ_MAXMSG;
attr.mq_msgsize = MQ_MSGSIZE;
benchmark_timer_initialize();
queue2 =mq_open( q_name, O_RDONLY | O_CREAT , 0x777, &attr);
end_time = benchmark_timer_read();
rtems_test_assert( queue2 != (-1) );
if (printable == 1)
put_time(
"mq_open (second open)",
end_time,
1, /* Only executed once */
0,
0
);
}
void benchmark_mq_close(int printable)
{
long end_time;
int status;
benchmark_timer_initialize();
status = mq_close(queue);
end_time = benchmark_timer_read();
rtems_test_assert( status == 0 );
if (printable == 1)
put_time(
"mq_close (close of first)",
end_time,
1, /* Only executed once */
0,
0
);
}
void benchmark_mq_close_second(int printable)
{
long end_time;
int status;
benchmark_timer_initialize();
status = mq_close(queue2);
end_time = benchmark_timer_read();
rtems_test_assert( status == 0 );
if (printable == 1)
put_time(
"mq_close (close of second)",
end_time,
1, /* Only executed once */
0,
0
);
}
void benchmark_mq_unlink(void)
{
long end_time;
int status;
benchmark_timer_initialize();
status = mq_unlink(q_name);
end_time = benchmark_timer_read();
rtems_test_assert( status == 0 );
put_time(
"mq_unlink",
end_time,
1, /* Only executed once */
0,
0
);
}
void benchmark_mq_notify(void)
{
long end_time;
int status;
struct sigevent event;
event.sigev_notify = SIGEV_SIGNAL;
event.sigev_signo = SIGUSR1;
benchmark_timer_initialize();
status = mq_notify( queue2, &event );
end_time = benchmark_timer_read();
rtems_test_assert( status == 0 );
put_time(
"mq_notify",
end_time,
1, /* Only executed once */
0,
0
);
}
void benchmark_mq_send(void)
{
long end_time;
int status;
status = 9;
benchmark_timer_initialize();
status = mq_send( queue, (const char *)&status, MQ_MSGSIZE, 1 );
end_time = benchmark_timer_read();
rtems_test_assert( status != (-1) );
put_time(
"mq_send - no threads waiting",
end_time,
1, /* Only executed once */
0,
0
);
}
void benchmark_mq_receive(void)
{
long end_time;
int status;
unsigned int priority;
int message[MQ_MAXMSG];
priority = 1; /*priority low*/
benchmark_timer_initialize();
status = mq_receive( queue2, ( char *)message, MQ_MSGSIZE, &priority );
end_time = benchmark_timer_read();
rtems_test_assert( status != (-1) );
put_time(
"mq_receive - available",
end_time,
1, /* Only executed once */
0,
0
);
}
void benchmark_mq_timedsend(void)
{
long end_time;
int status;
struct timespec timeout;
status = 5;
timeout.tv_sec = 0;
timeout.tv_nsec = 1;
benchmark_timer_initialize();
status = mq_timedsend(
queue, (const char *)&status, MQ_MSGSIZE, 1, &timeout);
end_time = benchmark_timer_read();
rtems_test_assert( status != (-1) );
put_time(
"mq_timedsend - no threads waiting",
end_time,
1, /* Only executed once */
0,
0
);
}
void benchmark_mq_timedreceive(void)
{
long end_time;
int status;
unsigned int priority;
struct timespec timeout;
int message[MQ_MAXMSG];
priority = 1; /*priority low*/
timeout.tv_sec = 0;
timeout.tv_nsec = 0;
benchmark_timer_initialize();
status = mq_timedreceive(
queue2, ( char *)message, MQ_MSGSIZE, &priority, &timeout);
end_time = benchmark_timer_read();
rtems_test_assert( status != (-1) );
put_time(
"mq_timedreceive - available",
end_time,
1, /* Only executed once */
0,
0
);
}
void *POSIX_Init(
void *argument
)
{
puts( "\n\n*** POSIX TIME TEST PSXTMMQ01 ***" );
/* create the first message queue READWRITE */
benchmark_mq_open(1);
/* send message using first queue */
benchmark_mq_send();
/* open a second message queue READ ONLY */
benchmark_mq_open_second(1);
/* receiving message using the seconde queue */
benchmark_mq_receive();
/* closing the second message queue */
benchmark_mq_close_second(0);
/* unlinking the first queue */
benchmark_mq_unlink();
/* closing the first queue */
benchmark_mq_close(0);
/* now repeat basically the same, but for the timed-send/recive */
/* open the first queue */
benchmark_mq_open(0);
/* send message using the first queue */
benchmark_mq_timedsend();
/* open a second message queue READ ONLY */
benchmark_mq_open_second(0);
/* receiving message using the seconde queue */
benchmark_mq_timedreceive();
/* calling notify */
benchmark_mq_notify();
/* closing the second message queue */
benchmark_mq_close_second(1);
/* closing the first queue */
benchmark_mq_close(1);
puts( "*** END OF POSIX TIME TEST PSXTMMQ01 ***" );
rtems_test_exit(0);
}
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 2
#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS 2
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
/* end of file */

View File

@@ -0,0 +1,23 @@
#
# $Id$
#
# COPYRIGHT (c) 1989-2011.
# On-Line Applications Research Corporation (OAR).
#
# The license and distribution terms for this file may be
# found in the file LICENSE in this distribution or at
# http://www.rtems.com/license/LICENSE.
#
This test benchmarks the following operations:
+ mq_close (close of first)
+ mq_close (close of second)
+ mq_notify
+ mq_open (first open)
+ mq_open (second open)
+ mq_receive - available
+ mq_send - no threads waiting
+ mq_timedreceive - available
+ mq_timedsend - no threads waiting
+ mq_unlink

View File

@@ -83,22 +83,22 @@
"pthread_rwlock_timedwrlock - available","psxtmrwlock01","psxtmtest_single","Yes" "pthread_rwlock_timedwrlock - available","psxtmrwlock01","psxtmtest_single","Yes"
"pthread_rwlock_timedwrlock - not available, blocks","psxtmrwlock05","psxtmtest_blocking","Yes" "pthread_rwlock_timedwrlock - not available, blocks","psxtmrwlock05","psxtmtest_blocking","Yes"
,,, ,,,
"mq_open (first open)","psxtmmq01","psxtmtest_init_destroy", "mq_open (first open)","psxtmmq01","psxtmtest_init_destroy","Yes"
"mq_close (close of first)","psxtmmq01","psxtmtest_init_destroy", "mq_close (close of first)","psxtmmq01","psxtmtest_init_destroy","Yes"
"mq_open (second open)","psxtmmq01","psxtmtest_init_destroy", "mq_open (second open)","psxtmmq01","psxtmtest_init_destroy","Yes"
"mq_close (close of second)","psxtmmq01","psxtmtest_init_destroy", "mq_close (close of second)","psxtmmq01","psxtmtest_init_destroy","Yes"
"mq_unlink","psxtmmq01","psxtmtest_init_destroy", "mq_unlink","psxtmmq01","psxtmtest_init_destroy","Yes"
"mq_receive - available",,"psxtmtest_single", "mq_receive - available",,"psxtmtest_single","Yes"
"mq_receive - not available, block",,"psxtmtest_blocking", "mq_receive - not available, block",,"psxtmtest_blocking",
"mq_timedreceive - available",,"psxtmtest_single", "mq_timedreceive - available",,"psxtmtest_single","Yes"
"mq_timedreceive - not available, blocks",,"psxtmtest_single", "mq_timedreceive - not available, blocks",,"psxtmtest_single",
"mq_send - no threads waiting",,"psxtmtest_single", "mq_send - no threads waiting",,"psxtmtest_single","Yes"
"mq_send - thread waiting, no preempt",,"psxtmtest_unblocking_nopreempt", "mq_send - thread waiting, no preempt",,"psxtmtest_unblocking_nopreempt",
"mq_send - thread waiting, preempt",,"psxtmtest_unblocking_preempt", "mq_send - thread waiting, preempt",,"psxtmtest_unblocking_preempt",
"mq_timedsend - no threads waiting",,"psxtmtest_single", "mq_timedsend - no threads waiting",,"psxtmtest_single","Yes"
"mq_timedsend - thread waiting, no preempt",,"psxtmtest_unblocking_nopreempt", "mq_timedsend - thread waiting, no preempt",,"psxtmtest_unblocking_nopreempt",
"mq_timedsend - thread waiting, preemption",,"psxtmtest_unblocking_preempt", "mq_timedsend - thread waiting, preemption",,"psxtmtest_unblocking_preempt",
"mq_notify ",,"psxtmtest_single", "mq_notify ",,"psxtmtest_single","Yes"
,,, ,,,
"sem_init","psxtmsem01","psxtmtest_single","Yes" "sem_init","psxtmsem01","psxtmtest_single","Yes"
"sem_destroy","psxtmsem01","psxtmtest_single","Yes" "sem_destroy","psxtmsem01","psxtmtest_single","Yes"
1 Test Case Test Template Implemented
83 pthread_rwlock_timedwrlock - available psxtmrwlock01 psxtmtest_single Yes
84 pthread_rwlock_timedwrlock - not available, blocks psxtmrwlock05 psxtmtest_blocking Yes
85
86 mq_open (first open) psxtmmq01 psxtmtest_init_destroy Yes
87 mq_close (close of first) psxtmmq01 psxtmtest_init_destroy Yes
88 mq_open (second open) psxtmmq01 psxtmtest_init_destroy Yes
89 mq_close (close of second) psxtmmq01 psxtmtest_init_destroy Yes
90 mq_unlink psxtmmq01 psxtmtest_init_destroy Yes
91 mq_receive - available psxtmtest_single Yes
92 mq_receive - not available, block psxtmtest_blocking
93 mq_timedreceive - available psxtmtest_single Yes
94 mq_timedreceive - not available, blocks psxtmtest_single
95 mq_send - no threads waiting psxtmtest_single Yes
96 mq_send - thread waiting, no preempt psxtmtest_unblocking_nopreempt
97 mq_send - thread waiting, preempt psxtmtest_unblocking_preempt
98 mq_timedsend - no threads waiting psxtmtest_single Yes
99 mq_timedsend - thread waiting, no preempt psxtmtest_unblocking_nopreempt
100 mq_timedsend - thread waiting, preemption psxtmtest_unblocking_preempt
101 mq_notify psxtmtest_single Yes
102
103 sem_init psxtmsem01 psxtmtest_single Yes
104 sem_destroy psxtmsem01 psxtmtest_single Yes