Tests: Update tests to support concurrently loaded slaves
authorvwan@ti.com <vwan@ti.com>
Mon, 17 Jun 2013 05:00:59 +0000 (22:00 -0700)
committerChris Ring <cring@ti.com>
Mon, 17 Jun 2013 05:00:59 +0000 (22:00 -0700)
Update the tests so that each core registers a different
endpoint name.  In this way multiple images can be loaded
at the same time and these tests can be run for each core
without having to unload and reload another image.

linux/src/tests/Makefile.am
linux/src/tests/Makefile.in
packages/ti/ipc/tests/Mx.c
packages/ti/ipc/tests/Mx.h
packages/ti/ipc/tests/mmrpc_test.c
packages/ti/ipc/tests/rpc_task.c
qnx/src/ipc3x_dev/ti/syslink/samples/hlos/rpmsg-rpc-stress/usr/tests_rpc_stress.c
qnx/src/tests/mmrpc_test/arm/o.g.le.v7/Makefile
qnx/src/tests/mmrpc_test/arm/o.le.v7/Makefile
qnx/src/tests/mmrpc_test/common.mk

index d9cae5a24272caadc0e1738d5de642ce8282d4e7..d3edfae5f1220ce6097ce7cc98d4db5bb51bd4ea 100644 (file)
@@ -122,7 +122,8 @@ common_libraries = -lpthread $(top_builddir)/linux/src/api/libtiipc.la \
 ping_rpmsg_LDADD = -lrt
 
 # the additional libraries to link mmrpc_test
-mmrpc_test_LDADD = $(top_builddir)/linux/src/mm/libmmrpc.la
+mmrpc_test_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/mm/libmmrpc.la
 
 # the additional libraries needed to link MessageQApp
 MessageQApp_LDADD = $(common_libraries) \
index 576596eaad94d9f8e1cb84b89c1260d4a0d1d317..ecdb8070aecfabe14c55e6bde3ec91d40589c875 100644 (file)
@@ -92,7 +92,8 @@ NameServerApp_DEPENDENCIES = $(am__DEPENDENCIES_1) \
        $(am__DEPENDENCIES_2)
 am_mmrpc_test_OBJECTS = Mx.$(OBJEXT) mmrpc_test.$(OBJEXT)
 mmrpc_test_OBJECTS = $(am_mmrpc_test_OBJECTS)
-mmrpc_test_DEPENDENCIES = $(top_builddir)/linux/src/mm/libmmrpc.la
+mmrpc_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(top_builddir)/linux/src/mm/libmmrpc.la
 am_nano_test_OBJECTS = $(am__objects_1) nano_test.$(OBJEXT)
 nano_test_OBJECTS = $(am_nano_test_OBJECTS)
 nano_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \
@@ -286,7 +287,9 @@ common_libraries = -lpthread $(top_builddir)/linux/src/api/libtiipc.la \
 ping_rpmsg_LDADD = -lrt
 
 # the additional libraries to link mmrpc_test
-mmrpc_test_LDADD = $(top_builddir)/linux/src/mm/libmmrpc.la
+mmrpc_test_LDADD = $(common_libraries) \
+                $(top_builddir)/linux/src/mm/libmmrpc.la
+
 
 # the additional libraries needed to link MessageQApp
 MessageQApp_LDADD = $(common_libraries) \
index ace838de17db88d5677966369c965f8b5a2a8520..a0095ce8b0c350751c594680fbae52505f8a8639 100644 (file)
  *  ======== Mx.c ========
  */
 #include <stdio.h>
+#include <ti/ipc/Std.h>
 
 #include <ti/ipc/mm/MmRpc.h>
+#include <ti/ipc/MultiProc.h>
 
 #if defined(SYSLINK_BUILDOS_QNX)
 #include <ti/shmemallocator/SharedMemoryAllocatorUsr.h>
@@ -53,21 +55,27 @@ static MmRpc_Handle Mx_rpcIpu = NULL;
 
 #define Mx_OFFSET(base, member) ((uint_t)(member) - (uint_t)(base))
 
+#define SERVICE_NAME    "rpc_example"
+
 /*
  *  ======== Mx_initialize ========
  */
-int Mx_initialize(void)
+int Mx_initialize(UInt16 procId)
 {
     int status;
     MmRpc_Params args;
+    Char mmServerName[20];
 
-    /* create remote server insance */
+    /* create remote server instance */
     MmRpc_Params_init(&args);
 
-    status = MmRpc_create("rpc_example_1", &args, &Mx_rpcIpu);
+    /* Construct an MmRpc server name adorned with core name: */
+    sprintf(mmServerName, "%s_%d", SERVICE_NAME, procId);
+
+    status = MmRpc_create(mmServerName, &args, &Mx_rpcIpu);
 
     if (status < 0) {
-        printf("mmrpc_test: Error: MmRpc_create failed\n");
+        printf("mmrpc_test: Error: MmRpc_create of %s failed\n", mmServerName);
         status = -1;
     }
     else {
index 85c055020bbab3cd71658ff5ce106cd245e7dd8c..e14048772c8762509a4596d8b2bbd46b069ba70d 100644 (file)
@@ -73,7 +73,7 @@ typedef struct {
 /*!
  *  @brief      Initialize the module, must be called first
  */
-int Mx_initialize(void);
+int Mx_initialize(UInt16 procId);
 
 /*!
  *  @brief      Finalize the module, must be called last
index 6cd7c4a53fcd99a2a3aea107a62f10946bf03092..b22135c4c0e9c186769030cab028746d74d606ad 100644 (file)
  *  ======== mmrpc_test.c ========
  */
 #include <stdio.h>
+#include <stdlib.h>
+
+/* IPC Headers */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
 
 #if defined(SYSLINK_BUILDOS_QNX)
 #include <ti/shmemallocator/SharedMemoryAllocatorUsr.h>
@@ -41,6 +46,8 @@
 
 #include "Mx.h"
 
+#define PROC_ID_DFLT 1
+
 /*
  *  ======== main ========
  */
@@ -50,6 +57,7 @@ int main(int argc, char **argv)
     int i;
     int32_t ret;
     uint32_t val;
+    UInt16 procId = PROC_ID_DFLT;
     Mx_Compute *compute;
 #if defined(SYSLINK_BUILDOS_QNX)
     shm_buf shmCompute, shmInBuf, shmOutBuf;
@@ -57,8 +65,29 @@ int main(int argc, char **argv)
 
     printf("mmrpc_test: --> main\n");
 
+    /* Parse Args: */
+    switch (argc) {
+        case 1:
+           /* use defaults */
+           break;
+        case 2:
+           procId   = atoi(argv[1]);
+           break;
+        default:
+           printf("Usage: %s [<ProcId>]\n", argv[0]);
+           printf("\tDefaults: ProcId: %d\n", PROC_ID_DFLT);
+           exit(0);
+    }
+
+    /* Need to start IPC for MultiProc */
+    status = Ipc_start();
+    if (status < 0) {
+        printf("Ipc_start failed: status = %d\n", status);
+        return (0);
+    }
+
     /* initialize Mx module (setup rpc connection) */
-    status = Mx_initialize();
+    status = Mx_initialize(procId);
 
     if (status < 0) {
         goto leave;
@@ -198,6 +227,8 @@ leave:
     /* finalize Mx module (destroy rpc connection) */
     Mx_finalize();
 
+    Ipc_stop();
+
     if (status < 0) {
         printf("mmrpc_test: FAILED\n");
     }
index 753e88bbcd57a06d86d30c6a72f9196eb6f4a6cf..c06cf0a168cc105fe62008a76c149951f28a0734 100644 (file)
@@ -44,6 +44,7 @@
 #include <ti/ipc/mm/MmType.h>
 #include <ti/ipc/mm/MmServiceMgr.h>
 #include <ti/sysbios/hal/Cache.h>
+#include <ti/ipc/MultiProc.h>
 
 #include "MxServer.h"
 
index 7b0e5108193114619cc07aec2a8f6f8a0d233ec9..02d2ff3e34282dbc7150e158b8a96c86ac037553 100644 (file)
@@ -941,15 +941,20 @@ int test_errors(int core_id, int num_comps, int sub_test)
     int fd;
     struct rppc_create_instance connreq;
     test_exec_args args;
+    char serviceMgrName[20];
+    char serviceMgrPath[20];
+
+    snprintf (serviceMgrName, _POSIX_PATH_MAX, "rpc_example_%d", core_id);
+    snprintf (serviceMgrPath, _POSIX_PATH_MAX, "/dev/%s", serviceMgrName);
 
     /* Connect to the rpc_example ServiceMgr on the specified core: */
-    fd = open("/dev/rpc_example", O_RDWR);
+    fd = open(serviceMgrPath, O_RDWR);
     if (fd < 0) {
         perror("Can't open rpc_example device");
         ret = -1;
         return -1;
     }
-    strcpy(connreq.name, "rpc_example");
+    strcpy(connreq.name, serviceMgrName);
 
     /* Create an rpc_example server instance, and rebind its address to this
     * file descriptor.
index f25c646a19479027c400c5a0eb4172fe53e874d4..d0d2dda913519329c3771c8de8d58c16be2a291a 100644 (file)
@@ -33,17 +33,32 @@ include ../../common.mk
 
 $(PROJECT_ROOT)/arm/o.g.le.v7/mmrpc_test_g: $(IPC_REPO)/qnx/src/mm/arm/a.g.le.v7/libmmrpc_g.a
 $(PROJECT_ROOT)/arm/o.g.le.v7/mmrpc_test_g: $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/so.le.v7/libsharedmemallocatorS.a
+$(PROJECT_ROOT)/arm/o.g.le.v7/mmrpc_test_g: $(IPC_REPO)/qnx/src/api/arm/a.g.le.v7/libipc_g.a
+$(PROJECT_ROOT)/arm/o.g.le.v7/mmrpc_test_g: $(IPC_REPO)/qnx/src/utils/arm/a.g.le.v7/libutils_g.a
+$(PROJECT_ROOT)/arm/o.g.le.v7/mmrpc_test_g: $(IPC_REPO)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7/libipc_clientS.a
 
 # link with syslink static library, dynamic for others
 LIBPREF_mmrpc_g = -Bstatic
 LIBPOST_mmrpc_g = -Bdynamic
 LIBPREF_sharedmemallocatorS = -Bstatic
 LIBPOST_sharedmemallocatorS = -Bdynamic
+LIBPREF_ipc_g = -Bstatic
+LIBPOST_ipc_g = -Bdynamic
+LIBPREF_utils_g = -Bstatic
+LIBPOST_utils_g = -Bdynamic
+LIBPREF_ipc_client = -Bstatic
+LIBPOST_ipc_client = -Bdynamic
 
 # add libpath and libs
 EXTRA_LIBVPATH += \
+        $(IPC_REPO)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7 \
+        $(IPC_REPO)/qnx/src/api/arm/a.g.le.v7 \
+        $(IPC_REPO)/qnx/src/utils/arm/a.g.le.v7 \
         $(IPC_REPO)/qnx/src/mm/arm/a.g.le.v7 \
         $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/so.le.v7
 
 LIBS += mmrpc_g
 LIBS += sharedmemallocatorS
+LIBS += ipc_g
+LIBS += utils_g
+LIBS += ipc_clientS
index 793a437c29d57d6e121fefa73734f00ad4243457..827fecadf380824c24a0d3981bd5096171a969b0 100644 (file)
@@ -34,18 +34,33 @@ include ../../common.mk
 CCFLAGS += -O3
 
 $(PROJECT_ROOT)/arm/o.le.v7/mmrpc_test: $(IPC_REPO)/qnx/src/mm/arm/a.le.v7/libmmrpc.a
-$(PROJECT_ROOT)/arm/o.g.le.v7/mmrpc_test_g: $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/so.le.v7/libsharedmemallocatorS.a
+$(PROJECT_ROOT)/arm/o.le.v7/mmrpc_test: $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/so.le.v7/libsharedmemallocatorS.a
+$(PROJECT_ROOT)/arm/o.le.v7/mmrpc_test: $(IPC_REPO)/qnx/src/api/arm/a.le.v7/libipc.a
+$(PROJECT_ROOT)/arm/o.le.v7/mmrpc_test: $(IPC_REPO)/qnx/src/utils/arm/a.le.v7/libutils.a
+$(PROJECT_ROOT)/arm/o.le.v7/mmrpc_test: $(IPC_REPO)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7/libipc_clientS.a
 
 # link with syslink static library, dynamic for others
 LIBPREF_mmrpc = -Bstatic
 LIBPOST_mmrpc = -Bdynamic
 LIBPREF_sharedmemallocatorS = -Bstatic
 LIBPOST_sharedmemallocatorS = -Bdynamic
+LIBPREF_ipc = -Bstatic
+LIBPOST_ipc = -Bdynamic
+LIBPREF_utils = -Bstatic
+LIBPOST_utils = -Bdynamic
+LIBPREF_ipc_client = -Bstatic
+LIBPOST_ipc_client = -Bdynamic
 
 # add libpath and libs
 EXTRA_LIBVPATH += \
+        $(IPC_REPO)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7 \
+        $(IPC_REPO)/qnx/src/api/arm/a.le.v7 \
+        $(IPC_REPO)/qnx/src/utils/arm/a.le.v7 \
         $(IPC_REPO)/qnx/src/mm/arm/a.le.v7 \
         $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/so.le.v7
 
 LIBS += mmrpc
 LIBS += sharedmemallocatorS
+LIBS += ipc
+LIBS += utils
+LIBS += ipc_clientS
index 200ae8937cbed41205cac412838164414cdb1d1c..a77185f051820c6d044efe1876d667a35636a161 100644 (file)
@@ -52,6 +52,7 @@ EXCLUDE_OBJS =
 
 # include path
 EXTRA_INCVPATH += \
+        $(IPC_REPO)/qnx/include \
         $(IPC_REPO)/packages \
         $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/public \
         $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/resmgr/public