[Openvas-commits] r3390 - in trunk/openvas-manager: . src/tests
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri May 15 17:24:06 CEST 2009
Author: mattm
Date: 2009-05-15 17:24:06 +0200 (Fri, 15 May 2009)
New Revision: 3390
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_delete_task_0.c
Log:
* src/tests/common.c (task_status): New function.
* src/tests/common.h (task_status): New header.
* src/tests/omp_delete_task_0.c: Add check of whether removal has been
requested.
Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog 2009-05-15 15:17:35 UTC (rev 3389)
+++ trunk/openvas-manager/ChangeLog 2009-05-15 15:24:06 UTC (rev 3390)
@@ -1,5 +1,14 @@
2009-05-15 Matthew Mundell <mmundell at intevation.de>
+ * src/tests/common.c (task_status): New function.
+
+ * src/tests/common.h (task_status): New header.
+
+ * src/tests/omp_delete_task_0.c: Add check of whether removal has been
+ requested.
+
+2009-05-15 Matthew Mundell <mmundell at intevation.de>
+
* src/omp.c (omp_xml_handle_end_element): Extend the ID version of OMP
STATUS to return more task information.
Modified: trunk/openvas-manager/src/tests/common.c
===================================================================
--- trunk/openvas-manager/src/tests/common.c 2009-05-15 15:17:35 UTC (rev 3389)
+++ trunk/openvas-manager/src/tests/common.c 2009-05-15 15:24:06 UTC (rev 3390)
@@ -788,6 +788,22 @@
/* OMP. */
/**
+ * @brief Get the task status from an OMP STATUS response.
+ *
+ * @param[in] response STATUS response.
+ *
+ * @return The entity_text of the status entity if the entity is found, else
+ * NULL.
+ */
+const char*
+task_status (entity_t response)
+{
+ entity_t status = entity_child (response, "status");
+ if (status) return entity_text (status);
+ return NULL;
+}
+
+/**
* @brief Authenticate with the manager.
*
* @param[in] session Pointer to GNUTLS session.
Modified: trunk/openvas-manager/src/tests/common.h
===================================================================
--- trunk/openvas-manager/src/tests/common.h 2009-05-15 15:17:35 UTC (rev 3389)
+++ trunk/openvas-manager/src/tests/common.h 2009-05-15 15:24:06 UTC (rev 3390)
@@ -125,6 +125,9 @@
int
id_string (int, const char **);
+const char*
+task_status (entity_t status_response);
+
int
authenticate (gnutls_session_t* session,
const char* username,
Modified: trunk/openvas-manager/src/tests/omp_delete_task_0.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_delete_task_0.c 2009-05-15 15:17:35 UTC (rev 3389)
+++ trunk/openvas-manager/src/tests/omp_delete_task_0.c 2009-05-15 15:24:06 UTC (rev 3390)
@@ -121,10 +121,23 @@
if (compare_entities (entity, expected))
{
+ const char* status = task_status (entity);
+
free_entity (expected);
- free_entity (entity);
- close_manager_connection (socket, session);
- return EXIT_FAILURE;
+
+ /* It may be that the server is still busy stopping the task. */
+ if (status && strcmp (status, "Delete requested"))
+ {
+ free_entity (entity);
+ close_manager_connection (socket, session);
+ return EXIT_SUCCESS;
+ }
+ else
+ {
+ free_entity (entity);
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
}
free_entity (expected);
More information about the Openvas-commits
mailing list