From: Michal Sojka Date: Tue, 15 Feb 2011 13:40:05 +0000 (+0100) Subject: forb: Added shared library for testing of forbrun-based server execution X-Git-Url: https://rtime.felk.cvut.cz/gitweb/frescor/forb.git/commitdiff_plain/2e9fa8d4d50ee8cae2353e4a8672d476fdde76c4 forb: Added shared library for testing of forbrun-based server execution --- diff --git a/src/tests/sharead_lib/Makefile b/src/tests/sharead_lib/Makefile new file mode 100644 index 0000000..d538d21 --- /dev/null +++ b/src/tests/sharead_lib/Makefile @@ -0,0 +1,14 @@ +# Generic directory or leaf node makefile for OCERA make framework + +ifndef MAKERULES_DIR +MAKERULES_DIR := $(shell ( old_pwd="" ; while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" = `pwd` ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) ) +endif + +ifeq ($(MAKERULES_DIR),) +all : default +.DEFAULT:: + @echo -e "\nThe Makefile.rules has not been found in this or partent directory: `pwd`\n" +else +include $(MAKERULES_DIR)/Makefile.rules +endif + diff --git a/src/tests/sharead_lib/Makefile.omk b/src/tests/sharead_lib/Makefile.omk new file mode 100644 index 0000000..908480f --- /dev/null +++ b/src/tests/sharead_lib/Makefile.omk @@ -0,0 +1,7 @@ +shared_LIBRARIES = forb_shlib_test +forb_shlib_test_SOURCES = forb_shlib.c +forb_shlib_test_SERVER_IDL = test_obj.idl + +INCLUDES += -I. + +lib_LOADLIBES = forb ulut fosa rt wvtest diff --git a/src/tests/sharead_lib/forb_shlib.c b/src/tests/sharead_lib/forb_shlib.c new file mode 100644 index 0000000..7ecb0dc --- /dev/null +++ b/src/tests/sharead_lib/forb_shlib.c @@ -0,0 +1,42 @@ +#include +#include "test_obj.h" +#define WVTEST_CONFIGURED +#include +#include +#include +#include + +static CORBA_long add(test_obj obj, CORBA_long val, CORBA_Environment *ev) +{ + int to_add = (intptr_t)forb_object_instance_data(obj); + return val + to_add; +} + +static CORBA_long add_indirect(test_obj obj, test_obj indirect_obj, CORBA_long val, CORBA_Environment *ev) +{ + return test_obj_add(indirect_obj, val, ev); +} + +static const struct forb_test_obj_impl test_obj_impl = { + .add = add, + .add_indirect = add_indirect, +}; + + +void *executor_thread(void *arg) +{ + forb_executor_t *executor = arg; + forb_executor_run(executor); + return NULL; +} + +int forb_main(forb_orb orb, int argc, char *argv[]) +{ + test_obj testobj; + + testobj = forb_test_obj_new(orb, &test_obj_impl, (void*)1); + if (!testobj) + return -1; + forb_execute_object(testobj); + return 0; +} diff --git a/src/tests/sharead_lib/test_obj.idl b/src/tests/sharead_lib/test_obj.idl new file mode 100644 index 0000000..0edea5d --- /dev/null +++ b/src/tests/sharead_lib/test_obj.idl @@ -0,0 +1,6 @@ +interface test_obj { + // Adds some number the value @a val + long add(in long val); + // Adds some number the value @a val by calling @a add method of indirect_obj + long add_indirect(in test_obj indirect_obj, in long val); +};