oaf patch...
- From: Michael Meeks <michael helixcode com>
- To: Maciej Stachowiak <mjs eazel com>,Elliot Lee <sopwith redhat com>
- Cc: gnome-components-list gnome org
- Subject: oaf patch...
- Date: Tue, 30 May 2000 10:09:39 -0400 (EDT)
Hi,
This expands the tests and adds a catch for circular activation
loops, similar to that in GOAD but with a TTL of 256 instead of 64.
Regards,
Michael.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/oaf/ChangeLog,v
retrieving revision 1.18
diff -u -r1.18 ChangeLog
--- ChangeLog 2000/05/29 13:07:26 1.18
+++ ChangeLog 2000/05/30 14:07:00
@@ -1,3 +1,14 @@
+2000-05-30 Michael Meeks <michael@helixcode.com>
+
+ * test/broken.oafinfo: add circular and broken exe tests.
+
+ * oafd/ac-corba.c (ac_do_activation): add bound on number of layers,
+ and exception for activation loops.
+
+ * test/oaf-test-client.c (main): Add broken exe and circular
+ factory loop tests. Add loads of redundant braces to make Maciej
+ a happy chappy. Print out exception text to verify they are correct.
+
2000-05-29 Michael Meeks <michael@helixcode.com>
* test/Makefile.am: install both files.
Index: oafd/ac-corba.c
===================================================================
RCS file: /cvs/gnome/oaf/oafd/ac-corba.c,v
retrieving revision 1.20
diff -u -r1.20 ac-corba.c
--- oafd/ac-corba.c 2000/05/29 13:07:27 1.20
+++ oafd/ac-corba.c 2000/05/30 14:07:00
@@ -6,6 +6,8 @@
#include "liboaf/liboaf.h"
#include "ac-query-expr.h"
+#define OAF_LINK_TIME_TO_LIVE 256
+
static void
OAF_ServerInfo__copy (OAF_ServerInfo * new, const OAF_ServerInfo * old)
{
@@ -420,8 +422,8 @@
}
for (num_layers = 0, activatable = server;
- activatable && !strcmp (activatable->server_type, "factory");
- num_layers++) {
+ activatable && !strcmp (activatable->server_type, "factory") &&
+ num_layers < OAF_LINK_TIME_TO_LIVE; num_layers++) {
activatable =
g_hash_table_lookup (child->by_iid,
activatable->location_info);
@@ -434,7 +436,14 @@
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_OAF_GeneralError, errval);
return;
- }
+ } else if (num_layers == servant->total_servers) {
+ OAF_GeneralError *errval = OAF_GeneralError__alloc ();
+ errval->description =
+ CORBA_string_dup ("Location loop");
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_OAF_GeneralError, errval);
+ return;
+ }
/* A shared library must be on the same host as the activator in
* order for loading to work properly (no, we're not going to
Index: test/broken.oafinfo
===================================================================
RCS file: /cvs/gnome/oaf/test/broken.oafinfo,v
retrieving revision 1.1
diff -u -r1.1 broken.oafinfo
--- test/broken.oafinfo 2000/05/29 13:07:28 1.1
+++ test/broken.oafinfo 2000/05/30 14:07:00
@@ -3,4 +3,10 @@
<oaf_server iid="OAFIID:Bogus:20000526" type="factory" location="OAFIID:Empty:19991025-Deliberate-Typo">
</oaf_server>
+<oaf_server iid="OAFIID:Broken:20000530" type="exe" location="this-executable-doesnt-exist">
+</oaf_server>
+
+<oaf_server iid="OAFIID:Circular:20000530" type="factory" location="OAFIID:Circular:20000530">
+</oaf_server>
+
</oaf_info>
Index: test/oaf-test-client.c
===================================================================
RCS file: /cvs/gnome/oaf/test/oaf-test-client.c,v
retrieving revision 1.6
diff -u -r1.6 oaf-test-client.c
--- test/oaf-test-client.c 2000/05/29 13:07:28 1.6
+++ test/oaf-test-client.c 2000/05/30 14:07:00
@@ -13,14 +13,17 @@
if (!strcmp (ev->_repo_id, "IDL:OAF/GeneralError:1.0")) {
OAF_GeneralError *err = ev->_params;
- if (!err || !err->description)
+ if (!err || !err->description) {
return "No general exception error message";
- else
+ } else {
return err->description;
- } else
+ }
+ } else {
return ev->_repo_id;
- } else
+ }
+ } else {
return CORBA_exception_id (ev);
+ }
}
gboolean
@@ -55,11 +58,13 @@
} else if (ev->_major != CORBA_NO_EXCEPTION) {
g_warning ("Activation %s failed: %s\n", type,
oaf_exception_id (ev));
- } else
+ } else {
return TRUE;
+ }
- if (!test_oafd (ev, type))
+ if (!test_oafd (ev, type)) {
return FALSE;
+ }
return FALSE;
}
@@ -69,11 +74,12 @@
{
Empty_doNothing (obj, ev);
- if (ev->_major != CORBA_NO_EXCEPTION)
+ if (ev->_major != CORBA_NO_EXCEPTION) {
g_warning ("Call failed: %s\n",
oaf_exception_id (ev));
- else
+ } else {
fprintf (stderr, "Test %s succeeded\n", type);
+ }
}
int
@@ -89,33 +95,70 @@
obj = oaf_activate ("repo_ids.has('IDL:Empty:1.0')", NULL, 0, NULL,
&ev);
- if (test_object (obj, &ev, "by query"))
+ if (test_object (obj, &ev, "by query")) {
test_empty (obj, &ev, "by query");
+ }
obj = oaf_activate_from_id ("OAFIID:Empty:19991025", 0, NULL, &ev);
- if (test_object (obj, &ev, "from id"))
+ if (test_object (obj, &ev, "from id")) {
test_empty (obj, &ev, "from id");
+ }
obj = oaf_activate_from_id ("OAFAID:[OAFIID:Empty:19991025]", 0, NULL, &ev);
- if (test_object (obj, &ev, "from aid"))
+ if (test_object (obj, &ev, "from aid")) {
test_empty (obj, &ev, "from aid");
+ }
fprintf (stderr, "Broken link test ");
obj = oaf_activate_from_id ("OAFIID:Bogus:20000526", 0, NULL, &ev);
+ if (obj || ev._major == CORBA_NO_EXCEPTION) {
+ fprintf (stderr, "failed 1");
+ } else {
+ fprintf (stderr, "passed 1 ('%s')", oaf_exception_id (&ev));
+ CORBA_exception_free (&ev);
+ }
+ if (test_oafd (&ev, "with broken factory link")) {
+ fprintf (stderr, ", passed 2");
+ } else {
+ fprintf (stderr, ", failed 2");
+ }
+ fprintf (stderr, "\n");
+
+
+ fprintf (stderr, "Broken exe test ");
+ obj = oaf_activate_from_id ("OAFIID:Broken:20000530", 0, NULL, &ev);
+ if (obj || ev._major == CORBA_NO_EXCEPTION) {
+ fprintf (stderr, "failed 1");
+ } else {
+ fprintf (stderr, "passed 1 ('%s')", oaf_exception_id (&ev));
+ CORBA_exception_free (&ev);
+ }
+ if (test_oafd (&ev, "with broken factory link")) {
+ fprintf (stderr, ", passed 2");
+ } else {
+ fprintf (stderr, ", failed 2");
+ }
+ fprintf (stderr, "\n");
+
+
+ fprintf (stderr, "Circular link test ");
+ obj = oaf_activate_from_id ("OAFIID:Circular:20000530", 0, NULL, &ev);
if (obj || ev._major == CORBA_NO_EXCEPTION)
fprintf (stderr, "failed 1");
else {
- fprintf (stderr, "passed 1");
+ fprintf (stderr, "passed 1 ('%s')", oaf_exception_id (&ev));
CORBA_exception_free (&ev);
}
- if (test_oafd (&ev, "with broken factory link"))
+ if (test_oafd (&ev, "with broken factory link")) {
fprintf (stderr, ", passed 2");
- else
+ } else {
fprintf (stderr, ", failed 2");
+ }
fprintf (stderr, "\n");
+
CORBA_exception_free (&ev);
--
mmeeks@gnu.org <><, Pseudo Engineer, itinerant idiot
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]