diff --git a/.travis.yml b/.travis.yml index a05347e..535ec23 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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) @@ -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 diff --git a/exampleApp/test/Makefile b/exampleApp/test/Makefile index 06bb494..cdfc92a 100644 --- a/exampleApp/test/Makefile +++ b/exampleApp/test/Makefile @@ -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 @@ -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) diff --git a/exampleApp/test/epicsRunExampleTests.c b/exampleApp/test/epicsRunExampleTests.c new file mode 100644 index 0000000..288fd9a --- /dev/null +++ b/exampleApp/test/epicsRunExampleTests.c @@ -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 */ +} diff --git a/exampleApp/test/exampleTest.c b/exampleApp/test/exampleTest.c index c4fa6ee..424f18e 100644 --- a/exampleApp/test/exampleTest.c +++ b/exampleApp/test/exampleTest.c @@ -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"); diff --git a/exampleApp/test/rtemsTestHarness.c b/exampleApp/test/rtemsTestHarness.c new file mode 100644 index 0000000..2eb59e6 --- /dev/null +++ b/exampleApp/test/rtemsTestHarness.c @@ -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; +}