From 9cbab40ddab3ddf4d93f8b86c194ec19f1a0c01e Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Sun, 20 Feb 2011 09:56:06 +0100 Subject: [PATCH] forb: Regref test converted to wvtest style Propagation of references from one orb to another is currently broken and the test for that is commented out. --- src/forb/src/tests/Makefile.omk | 4 +- src/forb/src/tests/regobjref.c | 68 ++++++++++++++++----------------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/forb/src/tests/Makefile.omk b/src/forb/src/tests/Makefile.omk index d05eadc5..19794279 100644 --- a/src/forb/src/tests/Makefile.omk +++ b/src/forb/src/tests/Makefile.omk @@ -1,8 +1,8 @@ SUBDIRS = $(ALL_OMK_SUBDIRS) -wvtest_PROGRAMS += hello_inproc test_proto_inet discovery syncobj +wvtest_PROGRAMS += hello_inproc test_proto_inet discovery syncobj regobjref -test_PROGRAMS += hello_remote regobjref executor_id #executor_calls +test_PROGRAMS += hello_remote executor_id #executor_calls ifeq ($(CONFIG_FORB_PROTO_UNIX),y) wvtest_PROGRAMS += test_proto_unix endif diff --git a/src/forb/src/tests/regobjref.c b/src/forb/src/tests/regobjref.c index 814d1ae3..89ca8a64 100644 --- a/src/forb/src/tests/regobjref.c +++ b/src/forb/src/tests/regobjref.c @@ -64,9 +64,8 @@ #include #include #include - -int argc_g; -char **argv_g; +#include +#include void *server_thread(void *arg) { @@ -76,10 +75,10 @@ void *server_thread(void *arg) return NULL; } -void start_server() +forb_orb start_server() { forb_orb orb; - hello hobj; + hello hobj, hobj2; int ret; fosa_thread_id_t tid; @@ -87,49 +86,50 @@ void start_server() .orb_id = "hello_remote_server" }; - orb = forb_init(&argc_g, &argv_g, &attr); - hobj = hello_impl_initialize(orb); + WVPASS(orb = forb_init(0, NULL, &attr)); + WVPASS(hobj = hello_impl_initialize(orb)); fosa_thread_create(&tid, NULL, server_thread, hobj); - ret = forb_register_reference(hobj, "hello"); + WVPASSEQ(ret = forb_register_reference(hobj, "hello"), 0); if (ret != 0) { error(1, errno, "Cannot register reference to hello"); } + WVPASS(hobj2 = forb_resolve_reference(orb, "hello")); + WVPASS(forb_object_is_local(hobj2)); + return orb; } void client(void) { - forb_orb orb; - hello hobj; - struct forb_env env; - struct forb_init_attr attr = { - .orb_id = "hello_remote_client" - }; +/* forb_orb orb; */ +/* hello hobj; */ +/* struct forb_env env; */ +/* struct forb_init_attr attr = { */ +/* .orb_id = "hello_remote_client" */ +/* }; */ - orb = forb_init(&argc_g, &argv_g, &attr); - - hobj = forb_resolve_reference(orb, "hello"); - if (!hobj) { - error(1, errno, "Cannot resolve reference to hello server)"); - } - - hello_message(hobj, "Hello world!", &env); - if (forb_exception_occurred(&env)) { - error(1, 0, "FORB exception %d", env.major); - } +/* WVPASS(orb = forb_init(0, NULL, &attr)); */ + + /* The following is currently broken */ + +/* hobj = forb_resolve_reference(orb, "hello"); */ +/* if (!hobj) { */ +/* error(1, errno, "Cannot resolve reference to hello server)"); */ +/* } */ + +/* hello_message(hobj, "Hello world!", &env); */ +/* if (forb_exception_occurred(&env)) { */ +/* error(1, 0, "FORB exception %d", env.major); */ +/* } */ } -int main(int argc, char *argv[]) +WVTEST_MAIN("Registering of references") { - - argc_g = argc; - argv_g = argv; - - start_server(); - + forb_orb orb; + orb = start_server(); client(); - - return 0; + forb_destroy(orb); + } -- 2.39.2