[Openvas-commits] r2962 - in trunk/openvas-manager: . src/tests
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Mar 31 13:46:47 CEST 2009
Author: mattm
Date: 2009-03-31 13:46:47 +0200 (Tue, 31 Mar 2009)
New Revision: 2962
Modified:
trunk/openvas-manager/ChangeLog
trunk/openvas-manager/src/tests/omp_delete_task_0.c
Log:
* src/tests/omp_delete_task_0.c: Test by checking status instead of
counting tasks.
Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog 2009-03-31 11:42:44 UTC (rev 2961)
+++ trunk/openvas-manager/ChangeLog 2009-03-31 11:46:47 UTC (rev 2962)
@@ -1,5 +1,10 @@
2009-03-31 Matthew Mundell <matt at mundell.ukfsn.org>
+ * src/tests/omp_delete_task_0.c: Test by checking status instead of
+ counting tasks.
+
+2009-03-31 Matthew Mundell <matt at mundell.ukfsn.org>
+
Cleanup and annotate, from Splint. Comment RATS annotations.
* src/CMakeLists.txt (splint): Switch to +unixlib.
Modified: trunk/openvas-manager/src/tests/omp_delete_task_0.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_delete_task_0.c 2009-03-31 11:42:44 UTC (rev 2961)
+++ trunk/openvas-manager/src/tests/omp_delete_task_0.c 2009-03-31 11:46:47 UTC (rev 2962)
@@ -45,14 +45,21 @@
/* Create a task. */
- if (env_authenticate (&session)) goto fail;
+ if (env_authenticate (&session))
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
if (create_task_from_rc_file (&session,
"new_task_small_rc",
"Test for omp_delete_task_0",
"Simple test scan.",
&id))
- goto fail;
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
/* Remove the task. */
@@ -63,7 +70,10 @@
int ret = send_to_manager (&session, msg);
g_free (msg);
if (ret == -1)
- goto fail;
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
/* Read the response. */
@@ -86,24 +96,39 @@
free_entity (expected);
free_entity (entity);
- /* Check the status. */
+ /* Check the status of the task. */
- if (send_to_manager (&session, "<status/>") == -1) goto fail;
+ if (sendf_to_manager (&session,
+ "<status>"
+ "<task_id>%u</task_id>"
+ "</status>",
+ id)
+ == -1)
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
entity = NULL;
- if (read_entity (&session, &entity)) goto fail;
+ if (read_entity (&session, &entity))
+ {
+ close_manager_connection (socket, session);
+ return EXIT_FAILURE;
+ }
- entity_t count = entity_child (entity, "task_count");
- if (count && strcmp (entity_text (count), "1") == 0)
+ expected = add_entity (NULL, "status_response", NULL);
+ add_entity (&expected->entities, "status", "407");
+
+ if (compare_entities (entity, expected))
{
+ free_entity (expected);
free_entity (entity);
close_manager_connection (socket, session);
- return EXIT_SUCCESS;
+ return EXIT_FAILURE;
}
+ free_entity (expected);
free_entity (entity);
-
- fail:
close_manager_connection (socket, session);
- return EXIT_FAILURE;
+ return EXIT_SUCCESS;
}
More information about the Openvas-commits
mailing list