[Openvas-commits] r3405 - in trunk/openvas-manager: . src/tests

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon May 18 12:59:24 CEST 2009


Author: mattm
Date: 2009-05-18 12:59:24 +0200 (Mon, 18 May 2009)
New Revision: 3405

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/src/tests/common.c
   trunk/openvas-manager/src/tests/common.h
   trunk/openvas-manager/src/tests/omp_modify_task_1.c
Log:
	* src/tests/common.h (DO_CHILDREN, id_string): Move back to common.c.

	* src/tests/common.c (DO_CHILDREN, id_string): Move back from common.h.

	* src/tests/omp_modify_task_1.c: Use new ID STATUS return instead of
	searching in STATUS return.

	* ChangeLog: Log last commit.


Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2009-05-18 09:39:59 UTC (rev 3404)
+++ trunk/openvas-manager/ChangeLog	2009-05-18 10:59:24 UTC (rev 3405)
@@ -1,3 +1,19 @@
+2009-05-18  Matthew Mundell <mmundell at intevation.de>
+
+	* src/tests/common.h (DO_CHILDREN, id_string): Move back to common.c.
+
+	* src/tests/common.c (DO_CHILDREN, id_string): Move back from common.h.
+
+	* src/tests/omp_modify_task_1.c: Use new ID STATUS return instead of
+	searching in STATUS return.
+
+	* ChangeLog: Log last commit.
+
+2009-05-18  Matthew Mundell <mmundell at intevation.de>
+
+	* doc/Doxyfile (EXTRACT_ALL): Turn off, to enable warnings about
+	missing function docs.
+
 2009-05-15  Matthew Mundell <mmundell at intevation.de>
 
 	* src/logf.h (LOG_FILE): Change extension to comm, as this file is only

Modified: trunk/openvas-manager/src/tests/common.c
===================================================================
--- trunk/openvas-manager/src/tests/common.c	2009-05-18 09:39:59 UTC (rev 3404)
+++ trunk/openvas-manager/src/tests/common.c	2009-05-18 10:59:24 UTC (rev 3405)
@@ -784,6 +784,41 @@
   return 1;
 }
 
+/**
+ * @brief Do something for each child of an entity.
+ *
+ * Calling "break" during body exits the loop.
+ *
+ * @param[in]  entity  The entity.
+ * @param[in]  child   Name to use for child variable.
+ * @param[in]  temp    Name to use for internal variable.
+ * @param[in]  body    The code to run for each child.
+ */
+#define DO_CHILDREN(entity, child, temp, body)      \
+  do                                                \
+    {                                               \
+      GSList* temp = entity->entities;              \
+      while (temp)                                  \
+        {                                           \
+          entity_t child = temp->data;              \
+          {                                         \
+            body;                                   \
+          }                                         \
+          temp = g_slist_next (temp);               \
+        }                                           \
+    }                                               \
+  while (0)
+
+#if 0
+/* Lisp version of DO_CHILDREN. */
+(defmacro do-children ((entity child) &body body)
+  "Do something for each child of an entity."
+  (let ((temp (gensym)))
+    `(while ((,temp (entity-entities ,entity) (rest ,temp)))
+            (,temp)
+       , at body)))
+#endif
+
 
 /* OMP. */
 

Modified: trunk/openvas-manager/src/tests/common.h
===================================================================
--- trunk/openvas-manager/src/tests/common.h	2009-05-18 09:39:59 UTC (rev 3404)
+++ trunk/openvas-manager/src/tests/common.h	2009-05-18 10:59:24 UTC (rev 3405)
@@ -85,46 +85,6 @@
 
 /* OMP. */
 
-// FIX temp export
-/**
- * @brief Do something for each child of an entity.
- *
- * Calling "break" during body exits the loop.
- *
- * @param[in]  entity  The entity.
- * @param[in]  child   Name to use for child variable.
- * @param[in]  temp    Name to use for internal variable.
- * @param[in]  body    The code to run for each child.
- */
-#define DO_CHILDREN(entity, child, temp, body)      \
-  do                                                \
-    {                                               \
-      GSList* temp = entity->entities;              \
-      while (temp)                                  \
-        {                                           \
-          entity_t child = temp->data;              \
-          {                                         \
-            body;                                   \
-          }                                         \
-          temp = g_slist_next (temp);               \
-        }                                           \
-    }                                               \
-  while (0)
-
-#if 0
-/* Lisp version of DO_CHILDREN. */
-(defmacro do-children ((entity child) &body body)
-  "Do something for each child of an entity."
-  (let ((temp (gensym)))
-    `(while ((,temp (entity-entities ,entity) (rest ,temp)))
-            (,temp)
-       , at body)))
-#endif
-
-// FIX temp export
-int
-id_string (int, const char **);
-
 const char*
 task_status (entity_t status_response);
 

Modified: trunk/openvas-manager/src/tests/omp_modify_task_1.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_modify_task_1.c	2009-05-18 09:39:59 UTC (rev 3404)
+++ trunk/openvas-manager/src/tests/omp_modify_task_1.c	2009-05-18 10:59:24 UTC (rev 3405)
@@ -40,7 +40,6 @@
   gnutls_session_t session1;
   gnutls_session_t session2;
   unsigned int id;
-  const char* id_str = NULL;
 
   socket1 = connect_to_manager (&session1);
   if (socket1 == -1) return EXIT_FAILURE;
@@ -66,12 +65,6 @@
       return EXIT_FAILURE;
     }
 
-  if (id_string (id, &id_str))
-    {
-      close_manager_connection (socket1, session1);
-      return EXIT_FAILURE;
-    }
-
   /* Modify the task name in process 2. */
 
   socket2 = connect_to_manager (&session2);
@@ -127,7 +120,10 @@
   /* Check that process 1 registered the change. */
 
   if (sendf_to_manager (&session1,
-                        "<status/>")
+                        "<status>"
+                        "<task_id>%u</task_id>"
+                        "</status>",
+                        id)
       == -1)
     {
       delete_task (&session1, id);
@@ -144,30 +140,11 @@
       return EXIT_FAILURE;
     }
 
-  ret = EXIT_FAILURE;
-  DO_CHILDREN (entity, child, temp,
-               if (strcasecmp (entity_name (child), "task") == 0)
-                 {
-                   entity_t task_id = entity_child (child, "task_id");
-                   if (task_id == NULL) break;
-                   if (strcasecmp (entity_text (task_id), id_str) == 0)
-                     {
-                       entity_t task_name = entity_child (child, "identifier");
-                       if (task_name)
-                         {
-                           if (strcmp (entity_text (task_name),
-                                      "Modified name"))
-                             {
-                               fprintf (stderr,
-                                        "Name comparison failed: %s\n",
-                                        entity_text (task_name));
-                             }
-                           else
-                             ret = EXIT_SUCCESS;
-                         }
-                       break;
-                     }
-                 });
+  name = entity_child (response, "name");
+  if (name && strcmp (entity_text (name), "Modified name") == 0)
+    ret = EXIT_SUCCESS;
+  else
+    ret = EXIT_FAILURE;
 
   /* Cleanup. */
 



More information about the Openvas-commits mailing list