Skip to content

Commit

Permalink
example: add testing on RTEMS
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphlange committed Mar 31, 2020
1 parent 1d430e1 commit 47d3f0c
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ jobs:
# Cross-compilation to RTEMS
# (needs EPICS Base >= 3.16.2)

- env: SET=test01 RTEMS=4.10 TEST=NO
- env: SET=test01 RTEMS=4.10

- env: SET=test01 RTEMS=4.9 TEST=NO
- env: SET=test01 RTEMS=4.9

# Other gcc versions (adding as an extra package)

Expand Down Expand Up @@ -150,10 +150,10 @@ jobs:
# Cross-compilation to RTEMS
# (needs EPICS Base >= 3.16.2)

- env: BASE=R3.16.2 SET=test01 RTEMS=4.10 TEST=NO
- env: BASE=R3.16.2 SET=test01 RTEMS=4.10
dist: trusty

- env: BASE=R3.16.2 SET=test01 RTEMS=4.9 TEST=NO
- env: BASE=R3.16.2 SET=test01 RTEMS=4.9
dist: trusty

# SNCSEQ 2.2.7 fails to build on MacOS; currently needs master
Expand Down
30 changes: 29 additions & 1 deletion exampleApp/test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ include $(TOP)/configure/CONFIG
# use the new RSET definition
USR_CPPFLAGS += -DUSE_TYPED_RSET

DBD = exampleTest.dbd
TARGETS += $(COMMON_DIR)/exampleTest.dbd
DBDDEPENDS_FILES += exampleTest.dbd$(DEP)
exampleTest_DBD += example.dbd

TESTFILES += $(COMMON_DIR)/exampleTest.dbd

testHarness_SRCS += exampleTest_registerRecordDeviceDriver.cpp

PROD_LIBS += exampleSupport
ifneq ($(SNCSEQ),)
PROD_LIBS += seq pv
Expand All @@ -23,8 +28,31 @@ PROD_LIBS += $(EPICS_BASE_IOC_LIBS)
TESTPROD_HOST += exampleTest
exampleTest_SRCS += exampleTest.c
exampleTest_SRCS += exampleTest_registerRecordDeviceDriver.cpp
testHarness_SRCS += exampleTest.c
TESTFILES += ../../../db/dbExample1.db
TESTS += exampleTest

# This runs all the test programs in a known working order:
testHarness_SRCS += epicsRunExampleTests.c

exampleTestHarness_SRCS += $(testHarness_SRCS)
exampleTestHarness_SRCS_RTEMS += rtemsTestHarness.c

PROD_SRCS_RTEMS += rtemsTestData.c

PROD_vxWorks = exampleTestHarness
PROD_RTEMS = exampleTestHarness

TESTSPEC_vxWorks = exampleTestHarness.munch; epicsRunExampleTests
TESTSPEC_RTEMS = exampleTestHarness.boot; epicsRunExampleTests

TESTSCRIPTS_HOST += $(TESTS:%=%.t)
ifneq ($(filter $(T_A),$(CROSS_COMPILER_RUNTEST_ARCHS)),)
TESTPROD_RTEMS = $(TESTPROD_HOST)
TESTSCRIPTS_RTEMS += $(TESTS:%=%.t)
endif

include $(TOP)/configure/RULES

rtemsTestData.c : $(TESTFILES) $(TOOLS)/epicsMakeMemFs.pl
$(PERL) $(TOOLS)/epicsMakeMemFs.pl $@ epicsRtemsFSImage $(TESTFILES)
28 changes: 28 additions & 0 deletions exampleApp/test/epicsRunExampleTests.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*************************************************************************\
* Copyright (c) 2011 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 Example tests as a batch.
*
*/

#include "epicsUnitTest.h"
#include "epicsExit.h"
#include "dbmf.h"

int exampleTest(void);

void epicsRunExampleTests(void)
{
testHarness();

runTest(exampleTest);

dbmfFreeChunks();

epicsExit(0); /* Trigger test harness */
}
2 changes: 1 addition & 1 deletion exampleApp/test/exampleTest.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static void testOnce(void)
{
testDiag("check that tests work");

dbReadDatabase(&pdbbase, "example.dbd", "../../../dbd", NULL);
dbReadDatabase(&pdbbase, "exampleTest.dbd", "../O.Common", NULL);
exampleTest_registerRecordDeviceDriver(pdbbase);
dbReadDatabase(&pdbbase, "dbExample1.db", "../../../db", "user=test");

Expand Down
14 changes: 14 additions & 0 deletions exampleApp/test/rtemsTestHarness.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*************************************************************************\
* Copyright (c) 2011 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.
\*************************************************************************/

extern void epicsRunExampleTests(void);

int main(int argc, char **argv)
{
epicsRunExampleTests(); /* calls epicsExit(0) */
return 0;
}

0 comments on commit 47d3f0c

Please sign in to comment.