From f5a424eb33ee7d682fb0a91242103e598af2eaee Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 13 Jul 2012 13:18:39 -0500 Subject: [PATCH] Testing: Fixed filters test harness build on RTEMS Added a new Files: line to the testspec file to document which files need to be available for the tests to be run properly. This is generated from the Makefile variable TESTFILES. --- configure/RULES_BUILD | 1 + src/ioc/db/test/Makefile | 3 +++ src/ioc/db/test/rtemsTestHarness.c | 30 ------------------------- src/std/filters/test/Makefile | 4 ++++ src/std/filters/test/rtemsTestHarness.c | 14 ++++++++++++ 5 files changed, 22 insertions(+), 30 deletions(-) create mode 100644 src/std/filters/test/rtemsTestHarness.c diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index 67b2bd8f4..54abbc9a5 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -325,6 +325,7 @@ testspec: $(TESTSCRIPTS_$(BUILD_CLASS)) @echo OS-class: $(OS_CLASS) > $@ @echo Target-arch: $(T_A) >> $@ $(if $^, @echo Tests: $^ >> $@) + $(if $(TESTFILES), @echo Files: $(TESTFILES) >> $@) $(if $(TESTSPEC_$(OS_CLASS)), @echo "Harness: $(TESTSPEC_$(OS_CLASS))" >> $@) # If there's a perl test script (.plt) available, use it diff --git a/src/ioc/db/test/Makefile b/src/ioc/db/test/Makefile index a2cc93192..d02e2b89b 100644 --- a/src/ioc/db/test/Makefile +++ b/src/ioc/db/test/Makefile @@ -30,6 +30,7 @@ dbChannelTest_SRCS += dbChannelTest.c dbChannelTest_SRCS += dbChannelTest_registerRecordDeviceDriver.cpp testHarness_SRCS += dbChannelTest.c testHarness_SRCS += dbChannelTest_registerRecordDeviceDriver.cpp +TESTFILES += $(COMMON_DIR)/dbChannelTest.dbd ../xRecord.db TESTS += dbChannelTest TARGETS += $(COMMON_DIR)/chfPluginTest.dbd @@ -40,6 +41,7 @@ chfPluginTest_SRCS += chfPluginTest.c chfPluginTest_SRCS += chfPluginTest_registerRecordDeviceDriver.cpp testHarness_SRCS += chfPluginTest.c testHarness_SRCS += chfPluginTest_registerRecordDeviceDriver.cpp +TESTFILES += $(COMMON_DIR)/chfPluginTest.dbd TESTS += chfPluginTest TARGETS += $(COMMON_DIR)/arrShorthandTest.dbd @@ -50,6 +52,7 @@ arrShorthandTest_SRCS += arrShorthandTest.c arrShorthandTest_SRCS += arrShorthandTest_registerRecordDeviceDriver.cpp testHarness_SRCS += arrShorthandTest.c testHarness_SRCS += arrShorthandTest_registerRecordDeviceDriver.cpp +TESTFILES += $(COMMON_DIR)/arrShorthandTest.dbd TESTS += arrShorthandTest # The testHarness runs all the test programs in a known working order. diff --git a/src/ioc/db/test/rtemsTestHarness.c b/src/ioc/db/test/rtemsTestHarness.c index 0aacbe573..c9ab2a68c 100644 --- a/src/ioc/db/test/rtemsTestHarness.c +++ b/src/ioc/db/test/rtemsTestHarness.c @@ -5,40 +5,10 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ - -#ifdef __rtems__ - -#include -#include -#include -#include -#include - -#endif /* __rtems__ */ - extern void epicsRunDbTests(void); int main(int argc, char **argv) { -#ifdef __rtems__ - struct stat s; - printf("Try to create /tmp\n"); - umask(0); - if(mkdir("/tmp", 0777)!=0) - perror("Can't create /tmp"); - if(stat("/tmp", &s)==0) { - printf("Stat /tmp: %o %u,%u\n", s.st_mode, s.st_uid, s.st_gid); - } - epicsEnvSet("TMPDIR","/tmp"); - { - char name[40]; - if(getcwd(name,40)) - printf("Running from %s\n", name); - else - printf("Can't determine PWD"); - } -#endif - epicsRunDbTests(); /* calls epicsExit(0) */ return 0; } diff --git a/src/std/filters/test/Makefile b/src/std/filters/test/Makefile index 6907f7965..093e55772 100644 --- a/src/std/filters/test/Makefile +++ b/src/std/filters/test/Makefile @@ -20,6 +20,7 @@ tsTest_SRCS += tsTest.c tsTest_SRCS += tsTest_registerRecordDeviceDriver.cpp testHarness_SRCS += tsTest.c testHarness_SRCS += tsTest_registerRecordDeviceDriver.cpp +TESTFILES += $(COMMON_DIR)/tsTest.dbd ../xRecord.db TESTS += tsTest TARGETS += $(COMMON_DIR)/dbndTest.dbd @@ -30,6 +31,7 @@ dbndTest_SRCS += dbndTest.c dbndTest_SRCS += dbndTest_registerRecordDeviceDriver.cpp testHarness_SRCS += dbndTest.c testHarness_SRCS += dbndTest_registerRecordDeviceDriver.cpp +TESTFILES += $(COMMON_DIR)/dbndTest.dbd TESTS += dbndTest TARGETS += $(COMMON_DIR)/arrTest.dbd @@ -41,6 +43,7 @@ arrTest_SRCS += arrTest_registerRecordDeviceDriver.cpp testHarness_SRCS += arrRecord.c testHarness_SRCS += arrTest.cpp testHarness_SRCS += arrTest_registerRecordDeviceDriver.cpp +TESTFILES += $(COMMON_DIR)/arrTest.dbd TESTS += arrTest TARGETS += $(COMMON_DIR)/syncTest.dbd @@ -51,6 +54,7 @@ syncTest_SRCS += syncTest.c syncTest_SRCS += syncTest_registerRecordDeviceDriver.cpp testHarness_SRCS += syncTest.c testHarness_SRCS += syncTest_registerRecordDeviceDriver.cpp +TESTFILES += $(COMMON_DIR)/syncTest.dbd TESTS += syncTest # epicsRunFilterTests runs all the test programs in a known working order. diff --git a/src/std/filters/test/rtemsTestHarness.c b/src/std/filters/test/rtemsTestHarness.c new file mode 100644 index 000000000..5215c7775 --- /dev/null +++ b/src/std/filters/test/rtemsTestHarness.c @@ -0,0 +1,14 @@ +/*************************************************************************\ +* Copyright (c) 2012 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 epicsRunFilterTests(void); + +int main(int argc, char **argv) +{ + epicsRunFilterTests(); /* calls epicsExit(0) */ + return 0; +}