Add test harness for RTEMS.

This commit is contained in:
W. Eric Norum
2006-10-27 15:36:26 +00:00
parent 6c10ea0ad4
commit 8f5c1bb7a3
3 changed files with 249 additions and 1 deletions

View File

@@ -120,8 +120,28 @@ blockingSockTestHost_SYS_LIBS_solaris = socket
#fdmgrTest_SRCS += fdmgrTest.c
#PROD_HOST += fdmgrTest
PROD_RTEMS += rtemsTestHarness
rtemsTestHarness_SRCS += rtemsTestHarness.c
rtemsTestHarness_SRCS += epicsRunLibComTests.c
rtemsTestHarness_SRCS += blockingSockTest.cpp
rtemsTestHarness_SRCS += epicsAlgorithmTest.cpp
rtemsTestHarness_SRCS += epicsCalcTest.cpp
rtemsTestHarness_SRCS += epicsEventTest.cpp
rtemsTestHarness_SRCS += epicsExceptionTest.cpp
rtemsTestHarness_SRCS += epicsMathTest.c
rtemsTestHarness_SRCS += epicsMessageQueueTest.cpp
rtemsTestHarness_SRCS += epicsMutexTest.cpp
rtemsTestHarness_SRCS += epicsOkToBlockTest.cpp
rtemsTestHarness_SRCS += epicsStdioTest.c
rtemsTestHarness_SRCS += epicsStringTest.c
rtemsTestHarness_SRCS += epicsThreadPriorityTest.cpp
rtemsTestHarness_SRCS += epicsThreadPrivateTest.cpp
rtemsTestHarness_SRCS += epicsThreadTest.cpp
rtemsTestHarness_SRCS += epicsTimeTest.cpp
rtemsTestHarness_SRCS += epicsTimerTest.cpp
rtemsTestHarness_SRCS += macEnvExpandTest.c
rtemsTestHarness_SRCS += ringPointerTest.c
OBJS_IOC_RTEMS += $(OBJS_IOC_vxWorks)
TEST_SCRIPTS += $(TESTS:%=%.t)

View File

@@ -0,0 +1,119 @@
/*************************************************************************\
* Copyright (c) 2006 UChicago Argonne LLC, as Operator of Argonne
* National Laboratory.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* Run tests as a batch
*
* This is part of the work being done to provide a unified set of automated
* tests for EPICS. Many more changes will be forthcoming.
*/
#include <stdio.h>
#include <epicsThread.h>
void threadTest(int ntasks,int verbose);
void epicsTimerTest();
int epicsAlgorithm(int /*argc*/, char* /*argv[]*/);
int epicsCalcTest(int /*argc*/, char* /*argv[]*/);
void epicsEventTest(int nthreads,int verbose);
int epicsExceptionTest();
int epicsMathTest();
void epicsMessageQueueTest(void *parm);
void epicsMutexTest(int nthreads,int verbose);
void epicsOkToBlockTest(void);
int epicsStdioTest (const char *report);
int epicsStringTest();
void epicsThreadPriorityTest(void *);
void epicsThreadPrivateTest();
int epicsTimeTest(void);
int macEnvExpandTest(void);
void ringPointerTest();
void blockingSockTest (void);
void
epicsRunLibComTests(void)
{
/*
* Thread startup sets some internal variables so do it first
*/
printf("\n****** Thread Test *****\n");
threadTest (2, 0);
epicsThreadSleep (1.0);
/*
* Timer tests get confused if run after some of the other tests
*/
printf("\n****** Timer Test *****\n");
epicsTimerTest ();
epicsThreadSleep (1.0);
printf("\n****** Algorithm Test *****\n");
epicsAlgorithm (0, NULL);
epicsThreadSleep (1.0);
printf("\n****** Calculation Test *****\n");
epicsCalcTest(0, NULL);
epicsThreadSleep (1.0);
printf("\n****** Event Test *****\n");
epicsEventTest (2,0);
epicsThreadSleep (1.0);
printf("\n****** Exception Test *****\n");
epicsExceptionTest ();
epicsThreadSleep (1.0);
printf("\n****** Math Test *****\n");
epicsMathTest ();
epicsThreadSleep (1.0);
printf("\n****** Message Queue Test *****\n");
epicsMessageQueueTest (NULL);
epicsThreadSleep (1.0);
printf("\n****** Mutex Test *****\n");
epicsMutexTest (2, 0);
epicsThreadSleep (1.0);
printf("\n****** OK to Block Test *****\n");
epicsOkToBlockTest ();
epicsThreadSleep (1.0);
printf("\n****** Stdio Test *****\n");
epicsStdioTest ("report");
epicsThreadSleep (1.0);
printf("\n****** String Test *****\n");
epicsStringTest ();
epicsThreadSleep (1.0);
printf("\n****** Thread Priority Test *****\n");
epicsThreadPriorityTest (NULL);
epicsThreadSleep (1.0);
printf("\n****** Thread Private Test *****\n");
epicsThreadPrivateTest (NULL);
epicsThreadSleep (1.0);
printf("\n****** Time Test *****\n");
epicsTimeTest ();
epicsThreadSleep (1.0);
printf("\n****** Macro Environment Variable Expansion Test *****\n");
macEnvExpandTest ();
epicsThreadSleep (1.0);
printf("\n****** Ring Pointer Test *****\n");
ringPointerTest ();
epicsThreadSleep (1.0);
printf("\n****** Check socket behaviour *****\n");
blockingSockTest();
epicsThreadSleep (1.0);
printf("\n****** Tests Completed *****\n");
epicsThreadSleep (1.0);
}

View File

@@ -0,0 +1,109 @@
/*************************************************************************\
* Copyright (c) 2006 UChicago Argonne LLC, as Operator of Argonne
* National Laboratory.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* RTEMS initialization for EPICS tests
*
* This is part of the work being done to provide a unified set of automated
* tests for EPICS. Many more changes will be forthcoming.
*/
*/
#include <bsp.h>
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_EXECUTIVE_RAM_SIZE (1000*1024)
#define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited(30)
#define CONFIGURE_MAXIMUM_SEMAPHORES rtems_resource_unlimited(200)
#define CONFIGURE_MAXIMUM_TIMERS rtems_resource_unlimited(20)
#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES rtems_resource_unlimited(5)
#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
#define CONFIGURE_MICROSECONDS_PER_TICK 10000
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 30
#define CONFIGURE_INIT_TASK_STACK_SIZE (10*1024)
#define CONFIGURE_INIT_TASK_PRIORITY 100
#define CONFIGURE_INIT_TASK_INITIAL_MODES (RTEMS_PREEMPT | \
RTEMS_NO_TIMESLICE | \
RTEMS_NO_ASR | \
RTEMS_INTERRUPT_LEVEL(0))
#define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_LOCAL | RTEMS_FLOATING_POINT)
#define CONFIGURE_INIT
rtems_task Init (rtems_task_argument argument);
#include <rtems/confdefs.h>
/*
* Dummy network configuration
*/
#include <rtems/rtems_bsdnet.h>
extern void rtems_bsdnet_loopattach();
static struct rtems_bsdnet_ifconfig loopback_config = {
"lo0", /* name */
(int (*)(struct rtems_bsdnet_ifconfig *, int))rtems_bsdnet_loopattach, /* attach function */
NULL, /* link to next interface */
"127.0.0.1", /* IP address */
"255.0.0.0", /* IP net mask */
};
struct rtems_bsdnet_config rtems_bsdnet_config = {
&loopback_config, /* Link to next interface */
NULL, /* No BOOTP to get network configuration */
0, /* If 0 then the network daemons will run at a */
/* priority just less than the lowest-priority */
/* EPICS scan thread. */
/* If non-zero then the network daemons will run */
/* at this *RTEMS* priority */
80*1024, /* MBUF space */
150*1024, /* MBUF cluster space */
};
#include <stdio.h>
#include <rtems/error.h>
#include <epicsExit.h>
rtems_task
Init (rtems_task_argument ignored)
{
extern void epicsRunLibComTests(void);
rtems_time_of_day now;
rtems_status_code sc;
/*
* Set time so that interval calculations work
*/
if (rtems_clock_get (RTEMS_CLOCK_GET_TOD, &now) != RTEMS_SUCCESSFUL) {
printf("***** Time/Date unknown -- set to arbitrary value.\n");
now.year = 2001;
now.month = 1;
now.day = 1;
now.hour = 0;
now.minute = 0;
now.second = 0;
now.ticks = 0;
if ((sc = rtems_clock_set (&now)) != RTEMS_SUCCESSFUL)
printf ("***** Can't set time: %s\n", rtems_status_text (sc));
}
/*
* Some tests need a 'network'
*/
rtems_bsdnet_initialize_network();
/*
* Run the tests
*/
epicsRunLibComTests();
epicsExit (0);
}