Merge lp:~epics-core/epics-base/test-rtems-w-qemu into lp:~epics-core/epics-base/3.16

Proposed by mdavidsaver
Status: Work in progress
Proposed branch: lp:~epics-core/epics-base/test-rtems-w-qemu
Merge into: lp:~epics-core/epics-base/3.16
Diff against target: 566 lines (+337/-6)
16 files modified
configure/RULES_BUILD (+1/-1)
src/ioc/db/test/Makefile (+8/-0)
src/ioc/db/test/dbStressLock.c (+5/-0)
src/libCom/RTEMS/Makefile (+2/-0)
src/libCom/RTEMS/epicsMemFs.c (+110/-0)
src/libCom/RTEMS/epicsMemFs.h (+24/-0)
src/libCom/RTEMS/epicsRtemsInitHooks.h (+2/-0)
src/libCom/RTEMS/rtems_init.c (+30/-1)
src/libCom/misc/testMain.h (+7/-1)
src/libCom/test/Makefile (+11/-0)
src/libCom/test/rtemsTestData.c (+6/-0)
src/std/filters/test/Makefile (+9/-0)
src/std/rec/test/Makefile (+9/-0)
src/tools/Makefile (+1/-0)
src/tools/epicsMakeMemFs.pl (+83/-0)
src/tools/makeTestfile.pl (+29/-3)
To merge this branch: bzr merge lp:~epics-core/epics-base/test-rtems-w-qemu
Reviewer Review Type Date Requested Status
EPICS Core Developers Pending
Review via email: mp+286116@code.launchpad.net

Description of the change

Enable easy execution of RTEMS-pc386 test harnesses with QEMU (and windows on *nix w/ WINE).

Avoid the usual problem of NIC support (and the rtems 4.10 tftp bug) by including test data file in the test executables. Test files are encoded as C source using a script. Files are extracted into memory on boot.

For RTEMS build both the combined test harness and individual test executables.

Teach makeTestfile.pl to generate .t files which call qemu or wine based on T_A and EPICS_HOST_ARCH.

Includes some additions to rtems_init.c to allow conditional bypass of NFS mounting.

To post a comment you must log in.
Revision history for this message
mdavidsaver (mdavidsaver) wrote :

I don't consider this a priority for 3.16.0.1. I'm publishing this now because it's handy to be able to 'make runtests' for rtems and windows cross targets.

12719. By mdavidsaver

db/test: dbStressLock skip for RTEMS

This test assumes that several threads with
equal priority will all run eventually.
This isn't turn an UP target without
time sliced scheduling.

12720. By mdavidsaver

rec/test: rtems build self contained tests and run individually

12721. By mdavidsaver

rec/test: add missing TESTFILES

12722. By mdavidsaver

rec/test: asTest fixup rtems test harness

Since this test has device support it must appear in a
DLL for windows dynamic builds.
However, the rRDD function is in the executable,
and not accessible here. So use iocsh.
For rtems/vxworks the test harness clears
iocsh registrations, so iocsh can't work here.

Revision history for this message
Andrew Johnson (anj) wrote :

Uses weak symbols -- issue with uC5282 BSP target, which is 68K family.

Revision history for this message
Andrew Johnson (anj) wrote :

Cancel that, the .o files for uC5282 are ELF.

Revision history for this message
mdavidsaver (mdavidsaver) wrote :

There is additional work on https://github.com/mdavidsaver/epics-base/tree/rtemstest which still needs to migrate to LP. I also need to see how this fits with work by Heinz on more recent rtems versions.

Unmerged revisions

12722. By mdavidsaver

rec/test: asTest fixup rtems test harness

Since this test has device support it must appear in a
DLL for windows dynamic builds.
However, the rRDD function is in the executable,
and not accessible here. So use iocsh.
For rtems/vxworks the test harness clears
iocsh registrations, so iocsh can't work here.

12721. By mdavidsaver

rec/test: add missing TESTFILES

12720. By mdavidsaver

rec/test: rtems build self contained tests and run individually

12719. By mdavidsaver

db/test: dbStressLock skip for RTEMS

This test assumes that several threads with
equal priority will all run eventually.
This isn't turn an UP target without
time sliced scheduling.

12718. By mdavidsaver

libCom/test: only run epicsUnitTest for host arch

custom .plt won't use WINE or QEMU when necessary.

12717. By mdavidsaver

build/run RTEMS-pc386 tests individually

Build and run individual test executable in addition
to the test harness.
Individual tests run with 'make runtests'.

omit epicsUnitTestTest as it has a custom .plt

12716. By mdavidsaver

RTEMS: build self contained test harness

Test data stub as a separate file to allow
linking into test harness and individual tests.

12715. By mdavidsaver

RTEMS: Add epicsMemFs and hook for app specific FS setup

Default falls back to network FS.

Compile in a set of files as a epicsMemFS structure.
epicsMemFsLoad() creates a set of files based on this.

12714. By mdavidsaver

src/tools: teach makeTestfile about WINE and QEMU

Teach makeTestfile host to run test for some cross built
targets.

12713. By mdavidsaver

libCom/misc: testMain for RTEMS give weak alias for main()

Allows tests to be linked separately or in a common test harness

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'configure/RULES_BUILD'
--- configure/RULES_BUILD 2016-02-27 00:16:26 +0000
+++ configure/RULES_BUILD 2016-03-01 02:02:15 +0000
@@ -344,7 +344,7 @@
344# Generate a perl program to exec the real test binary.344# Generate a perl program to exec the real test binary.
345%.t: %$(EXE) $(TOOLS)/makeTestfile.pl345%.t: %$(EXE) $(TOOLS)/makeTestfile.pl
346 @$(RM) $@346 @$(RM) $@
347 $(PERL) $(TOOLS)/makeTestfile.pl $@ $<347 $(PERL) $(TOOLS)/makeTestfile.pl "$(T_A)" $(EPICS_HOST_ARCH) $@ $<
348348
349#---------------------------------------------------------------349#---------------------------------------------------------------
350# Generate header with version number from VCS350# Generate header with version number from VCS
351351
=== modified file 'src/ioc/db/test/Makefile'
--- src/ioc/db/test/Makefile 2016-02-29 19:48:18 +0000
+++ src/ioc/db/test/Makefile 2016-03-01 02:02:15 +0000
@@ -157,6 +157,8 @@
157dbTestHarness_SRCS += $(testHarness_SRCS)157dbTestHarness_SRCS += $(testHarness_SRCS)
158dbTestHarness_SRCS_RTEMS += rtemsTestHarness.c158dbTestHarness_SRCS_RTEMS += rtemsTestHarness.c
159159
160PROD_SRCS_RTEMS += rtemsTestData.c
161
160PROD_vxWorks = dbTestHarness162PROD_vxWorks = dbTestHarness
161PROD_RTEMS = dbTestHarness163PROD_RTEMS = dbTestHarness
162164
@@ -164,6 +166,10 @@
164TESTSPEC_RTEMS = dbTestHarness.boot; epicsRunDbTests166TESTSPEC_RTEMS = dbTestHarness.boot; epicsRunDbTests
165167
166TESTSCRIPTS_HOST += $(TESTS:%=%.t)168TESTSCRIPTS_HOST += $(TESTS:%=%.t)
169ifeq ($(T_A),RTEMS-pc386)
170TESTPROD_RTEMS = $(TESTPROD_HOST)
171TESTSCRIPTS_RTEMS += $(TESTS:%=%.t)
172endif
167173
168include $(TOP)/configure/RULES174include $(TOP)/configure/RULES
169175
@@ -175,3 +181,5 @@
175scanIoTest$(DEP): $(COMMON_DIR)/xRecord.h181scanIoTest$(DEP): $(COMMON_DIR)/xRecord.h
176xRecord$(DEP): $(COMMON_DIR)/xRecord.h182xRecord$(DEP): $(COMMON_DIR)/xRecord.h
177183
184rtemsTestData.c : $(TESTFILES) $(TOOLS)/epicsMakeMemFs.pl
185 $(PERL) $(TOOLS)/epicsMakeMemFs.pl $@ epicsRtemsFSImage $(TESTFILES)
178186
=== modified file 'src/ioc/db/test/dbStressLock.c'
--- src/ioc/db/test/dbStressLock.c 2015-09-08 13:52:52 +0000
+++ src/ioc/db/test/dbStressLock.c 2016-03-01 02:02:15 +0000
@@ -230,6 +230,11 @@
230230
231 testPlan(80+nworkers*3);231 testPlan(80+nworkers*3);
232232
233#if defined(__rtems__)
234 testSkip(80+nworkers*3, "Test assumes time sliced preempting scheduling");
235 return testDone();
236#endif
237
233 priv = callocMustSucceed(nworkers, sizeof(*priv), "no memory");238 priv = callocMustSucceed(nworkers, sizeof(*priv), "no memory");
234239
235 testDiag("lock set stress test");240 testDiag("lock set stress test");
236241
=== modified file 'src/libCom/RTEMS/Makefile'
--- src/libCom/RTEMS/Makefile 2011-11-14 23:42:50 +0000
+++ src/libCom/RTEMS/Makefile 2016-03-01 02:02:15 +0000
@@ -10,6 +10,7 @@
10include $(TOP)/configure/CONFIG10include $(TOP)/configure/CONFIG
1111
12INC += epicsRtemsInitHooks.h12INC += epicsRtemsInitHooks.h
13INC += epicsMemFs.h
1314
14rtemsCom_SRCS += rtems_init.c15rtemsCom_SRCS += rtems_init.c
15rtemsCom_SRCS += rtems_config.c16rtemsCom_SRCS += rtems_config.c
@@ -18,6 +19,7 @@
18rtemsCom_SRCS += setBootConfigFromNVRAM.c19rtemsCom_SRCS += setBootConfigFromNVRAM.c
19rtemsCom_SRCS += epicsRtemsInitHookPre.c20rtemsCom_SRCS += epicsRtemsInitHookPre.c
20rtemsCom_SRCS += epicsRtemsInitHookPost.c21rtemsCom_SRCS += epicsRtemsInitHookPost.c
22rtemsCom_SRCS += epicsMemFs.c
2123
22LIBRARY_RTEMS = rtemsCom24LIBRARY_RTEMS = rtemsCom
2325
2426
=== added file 'src/libCom/RTEMS/epicsMemFs.c'
--- src/libCom/RTEMS/epicsMemFs.c 1970-01-01 00:00:00 +0000
+++ src/libCom/RTEMS/epicsMemFs.c 2016-03-01 02:02:15 +0000
@@ -0,0 +1,110 @@
1/*************************************************************************\
2* Copyright (c) 2014 Brookhaven National Laboratory.
3* EPICS BASE is distributed subject to a Software License Agreement found
4* in file LICENSE that is included with this distribution.
5\*************************************************************************/
6
7#include <stdlib.h>
8#include <stdio.h>
9#include <errno.h>
10
11#include <unistd.h>
12#include <sys/stat.h>
13#include <sys/types.h>
14#include <fcntl.h>
15
16#include "epicsMemFs.h"
17
18#ifndef PATH_MAX
19# define PATH_MAX 100
20#endif
21
22int epicsMemFsLoad(const epicsMemFS *fs)
23{
24 char initdir[PATH_MAX];
25 const epicsMemFile * const *fileptr = fs->files;
26
27 if(getcwd(initdir, sizeof(initdir)-1)==NULL) {
28 perror("getcwd");
29 return errno;
30 }
31 initdir[sizeof(initdir)-1] = '\0';
32
33 for(;*fileptr; fileptr++) {
34 const epicsMemFile *curfile = *fileptr;
35 int fd;
36 ssize_t ret;
37 size_t sofar;
38 const char * const *dir = curfile->directory;
39 /* jump back to the root each time,
40 * slow but simple.
41 */
42 if(chdir(initdir)) {
43 perror("chdir");
44 return errno;
45 }
46
47 printf("-> /");
48
49 /* traverse directory tree, creating as necessary */
50 for(;*dir; dir++) {
51 int ret;
52 if(**dir=='.') continue; /* ignore '.' and '..' */
53 printf("%s/", *dir);
54 ret = chdir(*dir);
55 if(ret==-1 && errno==ENOENT) {
56 /* this directory doesn't exist */
57 if(mkdir(*dir,0744)==-1) {
58 printf("\n");
59 perror("mkdir");
60 return errno;
61 }
62 if(chdir(*dir)==-1) {
63 printf("\n");
64 perror("chdir2");
65 return errno;
66 }
67 } else if(ret==-1) {
68 printf("\n");
69 perror("chdir1");
70 return errno;
71 }
72 }
73
74 /* no file name creates an empty directory */
75 if(!curfile->name) {
76 printf("\n");
77 continue;
78 }
79 printf("%s", curfile->name);
80
81 /* create or overwrite */
82 fd = open(curfile->name, O_WRONLY|O_CREAT|O_TRUNC, 0644);
83
84 if(fd==-1) {
85 printf("\n");
86 perror("open");
87 return errno;
88 }
89
90 sofar = 0;
91
92 while(sofar<curfile->size) {
93 ret = write(fd, curfile->data+sofar, curfile->size-sofar);
94 if(ret<=0) {
95 printf("\n");
96 perror("write");
97 return errno;
98 }
99 sofar += ret;
100 }
101
102 close(fd);
103 printf(" - ok\n");
104 }
105
106 if(chdir(initdir))
107 perror("chdir");
108
109 return 0;
110}
0111
=== added file 'src/libCom/RTEMS/epicsMemFs.h'
--- src/libCom/RTEMS/epicsMemFs.h 1970-01-01 00:00:00 +0000
+++ src/libCom/RTEMS/epicsMemFs.h 2016-03-01 02:02:15 +0000
@@ -0,0 +1,24 @@
1/*************************************************************************\
2* Copyright (c) 2014 Brookhaven National Laboratory.
3* EPICS BASE is distributed subject to a Software License Agreement found
4* in file LICENSE that is included with this distribution.
5\*************************************************************************/
6#ifndef EPICSMEMFS_H
7#define EPICSMEMFS_H
8
9#include <stdlib.h>
10
11typedef struct {
12 const char * const *directory; /* NULL terminated list of directories */
13 const char *name; /* file name */
14 const char *data; /* file contents */
15 size_t size; /* size of file contents in bytes */
16} epicsMemFile;
17
18typedef struct {
19 const epicsMemFile * const *files;
20} epicsMemFS;
21
22int epicsMemFsLoad(const epicsMemFS *fs);
23
24#endif // EPICSMEMFS_H
025
=== modified file 'src/libCom/RTEMS/epicsRtemsInitHooks.h'
--- src/libCom/RTEMS/epicsRtemsInitHooks.h 2010-11-17 22:55:22 +0000
+++ src/libCom/RTEMS/epicsRtemsInitHooks.h 2016-03-01 02:02:15 +0000
@@ -22,3 +22,5 @@
22 */22 */
23int epicsRtemsInitPreSetBootConfigFromNVRAM(struct rtems_bsdnet_config *config);23int epicsRtemsInitPreSetBootConfigFromNVRAM(struct rtems_bsdnet_config *config);
24int epicsRtemsInitPostSetBootConfigFromNVRAM(struct rtems_bsdnet_config *config);24int epicsRtemsInitPostSetBootConfigFromNVRAM(struct rtems_bsdnet_config *config);
25/* Return 0 if local file system was setup, or non-zero (will fall back to network */
26int epicsRtemsMountLocalFilesystem(char **argv);
2527
=== modified file 'src/libCom/RTEMS/rtems_init.c'
--- src/libCom/RTEMS/rtems_init.c 2016-02-15 17:29:22 +0000
+++ src/libCom/RTEMS/rtems_init.c 2016-03-01 02:02:15 +0000
@@ -43,6 +43,7 @@
43#include "osiUnistd.h"43#include "osiUnistd.h"
44#include "iocsh.h"44#include "iocsh.h"
45#include "osdTime.h"45#include "osdTime.h"
46#include "epicsMemFs.h"
4647
47#include "epicsRtemsInitHooks.h"48#include "epicsRtemsInitHooks.h"
4849
@@ -139,6 +140,31 @@
139# include <rtems/tftp.h>140# include <rtems/tftp.h>
140#endif141#endif
141142
143const epicsMemFS *epicsRtemsFSImage __attribute__((weak));
144const epicsMemFS *epicsRtemsFSImage = (void*)&epicsRtemsFSImage;
145
146/* hook to allow app specific FS setup */
147int
148epicsRtemsMountLocalFilesystem(char **argv) __attribute__((weak));
149int
150epicsRtemsMountLocalFilesystem(char **argv)
151{
152 if(epicsRtemsFSImage==(void*)&epicsRtemsFSImage)
153 return -1; /* no FS image provided. */
154 else if(epicsRtemsFSImage==NULL)
155 return 0; /* no FS image provided, but none is needed. */
156 else {
157 printf("***** Using compiled in file data *****\n");
158 if (epicsMemFsLoad(epicsRtemsFSImage) != 0) {
159 printf("Can't unpack tar filesystem\n");
160 return -1;
161 } else {
162 argv[1] = "/";
163 return 0;
164 }
165 }
166}
167
142static int168static int
143initialize_local_filesystem(char **argv)169initialize_local_filesystem(char **argv)
144{170{
@@ -147,7 +173,9 @@
147 extern char _FlashSize[] __attribute__((weak));173 extern char _FlashSize[] __attribute__((weak));
148174
149 argv[0] = rtems_bsdnet_bootp_boot_file_name;175 argv[0] = rtems_bsdnet_bootp_boot_file_name;
150 if (_FlashSize && (_DownloadLocation || _FlashBase)) {176 if (epicsRtemsMountLocalFilesystem(argv)==0) {
177 return 1; /* FS setup successful */
178 } else if (_FlashSize && (_DownloadLocation || _FlashBase)) {
151 extern char _edata[];179 extern char _edata[];
152 size_t flashIndex = _edata - _DownloadLocation;180 size_t flashIndex = _edata - _DownloadLocation;
153 char *header = _FlashBase + flashIndex;181 char *header = _FlashBase + flashIndex;
@@ -591,6 +619,7 @@
591 }619 }
592 printf("\n***** Initializing network *****\n");620 printf("\n***** Initializing network *****\n");
593 rtems_bsdnet_initialize_network();621 rtems_bsdnet_initialize_network();
622 printf("\n***** Setting up file system *****\n");
594 initialize_remote_filesystem(argv, initialize_local_filesystem(argv));623 initialize_remote_filesystem(argv, initialize_local_filesystem(argv));
595 fixup_hosts();624 fixup_hosts();
596625
597626
=== modified file 'src/libCom/misc/testMain.h'
--- src/libCom/misc/testMain.h 2010-10-05 19:27:37 +0000
+++ src/libCom/misc/testMain.h 2016-03-01 02:02:15 +0000
@@ -28,7 +28,13 @@
28 * }28 * }
29 */29 */
3030
31#if defined(vxWorks) || defined(__rtems__)31#if defined(__rtems__)
32 #ifdef __cplusplus
33 #define MAIN(prog) extern "C" int prog(void); extern "C" int main() __attribute__((weak, alias(#prog))); extern "C" int prog(void)
34 #else
35 #define MAIN(prog) int prog(); int main() __attribute__((weak, alias(#prog))); int prog()
36 #endif
37#elif defined(vxWorks)
32 #ifdef __cplusplus38 #ifdef __cplusplus
33 #define MAIN(prog) extern "C" int prog(void)39 #define MAIN(prog) extern "C" int prog(void)
34 #else40 #else
3541
=== modified file 'src/libCom/test/Makefile'
--- src/libCom/test/Makefile 2016-02-25 20:13:40 +0000
+++ src/libCom/test/Makefile 2016-03-01 02:02:15 +0000
@@ -12,11 +12,18 @@
1212
13PROD_LIBS += Com13PROD_LIBS += Com
1414
15PROD_SRCS_RTEMS += rtemsTestData.c
16
17ifeq ($(EPICS_HOST_ARCH),$(T_A))
18# skip except for host arch due to custom .plt
19
15TESTPROD_HOST += epicsUnitTestTest20TESTPROD_HOST += epicsUnitTestTest
16epicsUnitTestTest_SRCS += epicsUnitTestTest.c21epicsUnitTestTest_SRCS += epicsUnitTestTest.c
17# Not much point running this on vxWorks or RTEMS...22# Not much point running this on vxWorks or RTEMS...
18TESTS += epicsUnitTestTest23TESTS += epicsUnitTestTest
1924
25endif
26
20TESTPROD_HOST += epicsTypesTest27TESTPROD_HOST += epicsTypesTest
21epicsTypesTest_SRCS += epicsTypesTest.cpp28epicsTypesTest_SRCS += epicsTypesTest.cpp
22testHarness_SRCS += epicsTypesTest.cpp29testHarness_SRCS += epicsTypesTest.cpp
@@ -222,6 +229,10 @@
222TESTSPEC_RTEMS = libComTestHarness.boot; epicsRunLibComTests229TESTSPEC_RTEMS = libComTestHarness.boot; epicsRunLibComTests
223230
224TESTSCRIPTS_HOST += $(TESTS:%=%.t)231TESTSCRIPTS_HOST += $(TESTS:%=%.t)
232ifeq ($(T_A),RTEMS-pc386)
233TESTPROD_RTEMS = $(TESTPROD_HOST)
234TESTSCRIPTS_RTEMS += $(filter-out epicsUnitTestTest.t, $(TESTS:%=%.t))
235endif
225236
226237
227# The following are not test programs, they measure performance.238# The following are not test programs, they measure performance.
228239
=== added file 'src/libCom/test/rtemsTestData.c'
--- src/libCom/test/rtemsTestData.c 1970-01-01 00:00:00 +0000
+++ src/libCom/test/rtemsTestData.c 2016-03-01 02:02:15 +0000
@@ -0,0 +1,6 @@
1#include "epicsMemFs.h"
2
3/* no local files needed for these tests,
4 * so skip local FS setup
5 */
6const epicsMemFS *epicsRtemsFSImage = NULL;
07
=== modified file 'src/std/filters/test/Makefile'
--- src/std/filters/test/Makefile 2012-07-23 03:40:43 +0000
+++ src/std/filters/test/Makefile 2016-03-01 02:02:15 +0000
@@ -64,6 +64,8 @@
64filterTestHarness_SRCS += $(testHarness_SRCS)64filterTestHarness_SRCS += $(testHarness_SRCS)
65filterTestHarness_SRCS_RTEMS += rtemsTestHarness.c65filterTestHarness_SRCS_RTEMS += rtemsTestHarness.c
6666
67PROD_SRCS_RTEMS += rtemsTestData.c
68
67PROD_vxWorks = filterTestHarness69PROD_vxWorks = filterTestHarness
68PROD_RTEMS = filterTestHarness70PROD_RTEMS = filterTestHarness
6971
@@ -71,6 +73,10 @@
71TESTSPEC_RTEMS = filterTestHarness.boot; epicsRunFilterTests73TESTSPEC_RTEMS = filterTestHarness.boot; epicsRunFilterTests
7274
73TESTSCRIPTS_HOST += $(TESTS:%=%.t)75TESTSCRIPTS_HOST += $(TESTS:%=%.t)
76ifeq ($(T_A),RTEMS-pc386)
77TESTPROD_RTEMS = $(TESTPROD_HOST)
78TESTSCRIPTS_RTEMS += $(TESTS:%=%.t)
79endif
7480
75include $(TOP)/configure/RULES81include $(TOP)/configure/RULES
7682
@@ -80,3 +86,6 @@
80syncTest$(DEP): $(COMMON_DIR)/xRecord.h86syncTest$(DEP): $(COMMON_DIR)/xRecord.h
81arrRecord$(DEP): $(COMMON_DIR)/arrRecord.h87arrRecord$(DEP): $(COMMON_DIR)/arrRecord.h
82arrTest$(DEP): $(COMMON_DIR)/arrRecord.h88arrTest$(DEP): $(COMMON_DIR)/arrRecord.h
89
90rtemsTestData.c : $(TESTFILES) $(TOOLS)/epicsMakeMemFs.pl
91 $(PERL) $(TOOLS)/epicsMakeMemFs.pl $@ epicsRtemsFSImage $(TESTFILES)
8392
=== modified file 'src/std/rec/test/Makefile'
--- src/std/rec/test/Makefile 2016-03-01 01:37:25 +0000
+++ src/std/rec/test/Makefile 2016-03-01 02:02:15 +0000
@@ -71,6 +71,8 @@
71recordTestHarness_SRCS += $(testHarness_SRCS)71recordTestHarness_SRCS += $(testHarness_SRCS)
72recordTestHarness_SRCS_RTEMS += rtemsTestHarness.c72recordTestHarness_SRCS_RTEMS += rtemsTestHarness.c
7373
74PROD_SRCS_RTEMS += rtemsTestData.c
75
74PROD_vxWorks = recordTestHarness76PROD_vxWorks = recordTestHarness
75PROD_RTEMS = recordTestHarness77PROD_RTEMS = recordTestHarness
7678
@@ -78,5 +80,12 @@
78TESTSPEC_RTEMS = recordTestHarness.boot; epicsRunRecordTests80TESTSPEC_RTEMS = recordTestHarness.boot; epicsRunRecordTests
7981
80TESTSCRIPTS_HOST += $(TESTS:%=%.t)82TESTSCRIPTS_HOST += $(TESTS:%=%.t)
83ifeq ($(T_A),RTEMS-pc386)
84TESTPROD_RTEMS = $(TESTPROD_HOST)
85TESTSCRIPTS_RTEMS += $(TESTS:%=%.t)
86endif
8187
82include $(TOP)/configure/RULES88include $(TOP)/configure/RULES
89
90rtemsTestData.c : $(TESTFILES) $(TOOLS)/epicsMakeMemFs.pl
91 $(PERL) $(TOOLS)/epicsMakeMemFs.pl $@ epicsRtemsFSImage $(TESTFILES)
8392
=== modified file 'src/tools/Makefile'
--- src/tools/Makefile 2016-02-27 00:16:26 +0000
+++ src/tools/Makefile 2016-03-01 02:02:15 +0000
@@ -46,6 +46,7 @@
46PERL_SCRIPTS += mkmf.pl46PERL_SCRIPTS += mkmf.pl
47PERL_SCRIPTS += munch.pl47PERL_SCRIPTS += munch.pl
48PERL_SCRIPTS += replaceVAR.pl48PERL_SCRIPTS += replaceVAR.pl
49PERL_SCRIPTS += epicsMakeMemFs.pl
49PERL_SCRIPTS += useManifestTool.pl50PERL_SCRIPTS += useManifestTool.pl
50PERL_SCRIPTS += genVersionHeader.pl51PERL_SCRIPTS += genVersionHeader.pl
5152
5253
=== added file 'src/tools/epicsMakeMemFs.pl'
--- src/tools/epicsMakeMemFs.pl 1970-01-01 00:00:00 +0000
+++ src/tools/epicsMakeMemFs.pl 2016-03-01 02:02:15 +0000
@@ -0,0 +1,83 @@
1#!/usr/bin/env perl
2#
3
4use File::Basename;
5
6use strict;
7
8my $outfile = shift;
9my $varname = shift;
10
11open(my $DST, '>', $outfile) or die "Failed to open $outfile";
12
13print $DST <<EOF;
14#include <epicsMemFs.h>
15EOF
16
17my $N = 0;
18
19for my $fname (@ARGV) {
20 print "<- $fname\n";
21 my $realfname = $fname;
22
23 # strip leading "../" "./" or "/"
24 while ($fname =~ /^\.*\/(.*)$/) { $fname = $1; }
25
26 my $file = basename($fname);
27 my @dirs = split('/', dirname($fname));
28
29 print $DST "/* begin $realfname */\nstatic const char * const file_${N}_dir[] = {";
30 for my $dpart (@dirs) {
31 print $DST "\"$dpart\", ";
32 }
33 print $DST "NULL};\nstatic const char file_${N}_data[] = {\n ";
34
35 open(my $SRC, '<', $realfname) or die "Failed to open $realfname";
36 binmode($SRC);
37
38 my $buf;
39 my $total = 0;
40 while (my $num = read($SRC, $buf, 32)) {
41 if($total != 0) {
42 print $DST ",\n ";
43 }
44 $total += $num;
45 my $out = join(",",map(ord,split(//,$buf)));
46 print $DST "$out";
47 }
48
49 close($SRC);
50
51 print $DST <<EOF;
52
53};
54static const epicsMemFile file_${N} = {
55 file_${N}_dir,
56 \"$file\",
57 file_${N}_data,
58 $total
59};
60/* end $realfname */
61EOF
62 $N = $N + 1;
63}
64
65print $DST <<EOF;
66static const epicsMemFile* files[] = {
67EOF
68
69$N = $N - 1;
70
71for my $i (0..${N}) {
72 print $DST " &file_${i},";
73}
74
75print $DST <<EOF;
76 NULL
77};
78static
79const epicsMemFS ${varname}_image = {&files[0]};
80const epicsMemFS * $varname = &${varname}_image;
81EOF
82
83close($DST);
084
=== modified file 'src/tools/makeTestfile.pl'
--- src/tools/makeTestfile.pl 2015-03-11 21:26:15 +0000
+++ src/tools/makeTestfile.pl 2016-03-01 02:02:15 +0000
@@ -15,17 +15,43 @@
15# If the script is given an argument -tap it sets HARNESS_ACTIVE in the15# If the script is given an argument -tap it sets HARNESS_ACTIVE in the
16# environment to make the epicsUnitTest code generate strict TAP output.16# environment to make the epicsUnitTest code generate strict TAP output.
1717
18# Usage: makeTestfile.pl target.t executable18# Usage: makeTestfile.pl <target-arch> <host-arch> target.t executable
19# target-arch and host-arch are EPICS build target names (eg. linux-x86)
19# target.t is the name of the Perl script to generate20# target.t is the name of the Perl script to generate
20# executable is the name of the file the script runs21# executable is the name of the file the script runs
2122
22use strict;23use strict;
2324
24my ($target, $exe) = @ARGV;25my ($TA, $HA, $target, $exe) = @ARGV;
26my $exec;
27
28# Use WINE to run windows target executables on non-windows host
29if( $TA =~ /^win32-x86/ && $HA !~ /^win/ ) {
30 $exec = "wine32 $exe";
31} elsif( $TA =~ /^windows-x64/ && $HA !~ /^win/ ) {
32 $exec = "wine64 $exe";
33
34# Run pc386 test harness w/ QEMU
35} elsif( $TA =~ /^RTEMS-pc386$/ ) {
36 $exec = "qemu-system-i386 -m 64 -no-reboot -serial stdio -display none -kernel $exe";
37
38# Explicitly fail for other RTEMS targets
39} elsif( $TA =~ /^RTEMS-/ ) {
40 die "I don't know how to run tests for $TA on $HA";
41
42} else {
43 $exec = "./$exe";
44}
2545
26# Use system on Windows, exec doesn't work the same there and46# Use system on Windows, exec doesn't work the same there and
27# GNUmake thinks the test has finished as soon as Perl exits.47# GNUmake thinks the test has finished as soon as Perl exits.
28my $exec = $^O eq 'MSWin32' ? "system('./$exe') == 0" : "exec './$exe'";48if( $HA =~ /^win/ ) {
49 $exec = "system('$exec') == 0";
50
51# default to exec()
52} else {
53 $exec = "exec '$exec'";
54}
2955
30open(my $OUT, '>', $target) or die "Can't create $target: $!\n";56open(my $OUT, '>', $target) or die "Can't create $target: $!\n";
3157

Subscribers

People subscribed via source and target branches