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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed May 13 17:38:40 CEST 2009


Author: mattm
Date: 2009-05-13 17:38:40 +0200 (Wed, 13 May 2009)
New Revision: 3361

Added:
   trunk/openvas-manager/src/tests/omp_start_task_2.c
Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/src/tests/CMakeLists.txt
Log:
	* src/tests/omp_start_task_2.c: New file.

	* src/tests/CMakeLists.txt: Add omp_start_task_2.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2009-05-13 14:15:07 UTC (rev 3360)
+++ trunk/openvas-manager/ChangeLog	2009-05-13 15:38:40 UTC (rev 3361)
@@ -1,5 +1,11 @@
 2009-05-13  Matthew Mundell <mmundell at intevation.de>
 
+	* src/tests/omp_start_task_2.c: New file.
+
+	* src/tests/CMakeLists.txt: Add omp_start_task_2.
+
+2009-05-13  Matthew Mundell <mmundell at intevation.de>
+
 	Ensure that the manager process continues handling server messages if
 	the client exits before the server has finished a running task.
 

Modified: trunk/openvas-manager/src/tests/CMakeLists.txt
===================================================================
--- trunk/openvas-manager/src/tests/CMakeLists.txt	2009-05-13 14:15:07 UTC (rev 3360)
+++ trunk/openvas-manager/src/tests/CMakeLists.txt	2009-05-13 15:38:40 UTC (rev 3361)
@@ -283,6 +283,13 @@
 target_link_libraries (omp_start_task_1 common)
 ADD_TEST (omp_start_task_1 omp_start_task_1)
 
+add_executable (omp_start_task_2 omp_start_task_2.c)
+target_link_libraries (omp_start_task_2 string)
+set_target_properties (omp_start_task_2 PROPERTIES COMPILE_FLAGS "-I .. ${GLIB_CFLAGS}")
+set_target_properties (omp_start_task_2 PROPERTIES LINK_FLAGS "${OVAS_LDFLAG} ${GLIB_LDFLAGS}")
+target_link_libraries (omp_start_task_2 common)
+ADD_TEST (omp_start_task_2 omp_start_task_2)
+
 add_executable (omp_status_0 omp_status_0.c)
 target_link_libraries (omp_status_0 string)
 set_target_properties (omp_status_0 PROPERTIES COMPILE_FLAGS "-I .. ${GLIB_CFLAGS}")

Added: trunk/openvas-manager/src/tests/omp_start_task_2.c
===================================================================
--- trunk/openvas-manager/src/tests/omp_start_task_2.c	2009-05-13 14:15:07 UTC (rev 3360)
+++ trunk/openvas-manager/src/tests/omp_start_task_2.c	2009-05-13 15:38:40 UTC (rev 3361)
@@ -0,0 +1,93 @@
+/* Test 2 of OMP START_TASK.
+ * $Id$
+ * Description: Test OMP START_TASK, exiting the session early.
+ *
+ * Authors:
+ * Matthew Mundell <matt at mundell.ukfsn.org>
+ *
+ * Copyright:
+ * Copyright (C) 2009 Greenbone Networks GmbH
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * or, at your option, any later version as published by the Free
+ * Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#define TRACE 0
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "common.h"
+#include "../tracef.h"
+
+int
+main ()
+{
+  int socket;
+  gnutls_session_t session;
+  unsigned int id;
+
+  socket = connect_to_manager (&session);
+  if (socket == -1) return EXIT_FAILURE;
+
+  if (env_authenticate (&session)) goto fail;
+
+  /* Create a task. */
+
+  if (create_task_from_rc_file (&session,
+                                "new_task_empty_rc",
+                                "Task for omp_start_task_0",
+                                "Test omp_start_task_0 task.",
+                                &id))
+    goto fail;
+
+  /* Start the task. */
+
+  if (start_task (&session, id)) goto delete_fail;
+
+  /* End the session. */
+
+  if (close_manager_connection (socket, session)) goto delete_fail;
+
+  /* Connect again. */
+
+  socket = connect_to_manager (&session);
+  if (socket == -1) return EXIT_FAILURE;
+
+  if (env_authenticate (&session)) goto fail;
+
+  /* Wait for the task to finish on the server. */
+
+  if (wait_for_task_end (&session, id)) goto delete_fail;
+
+  /* Start the task again. */
+
+  if (start_task (&session, id)) goto delete_fail;
+
+  /* Wait for the task to finish on the server again. */
+
+  if (wait_for_task_end (&session, id)) goto delete_fail;
+
+  delete_task (&session, id);
+  close_manager_connection (socket, session);
+  return EXIT_SUCCESS;
+
+ delete_fail:
+  delete_task (&session, id);
+ fail:
+  close_manager_connection (socket, session);
+  return EXIT_FAILURE;
+}



More information about the Openvas-commits mailing list