[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r21844 - gnunet/src/testing
From: |
gnunet |
Subject: |
[GNUnet-SVN] r21844 - gnunet/src/testing |
Date: |
Sun, 10 Jun 2012 03:01:03 +0200 |
Author: grothoff
Date: 2012-06-10 03:01:03 +0200 (Sun, 10 Jun 2012)
New Revision: 21844
Modified:
gnunet/src/testing/test_testing_peerstartup.c
gnunet/src/testing/test_testing_portreservation.c
gnunet/src/testing/test_testing_servicestartup.c
gnunet/src/testing/testing.c
Log:
-minor fixes
Modified: gnunet/src/testing/test_testing_peerstartup.c
===================================================================
--- gnunet/src/testing/test_testing_peerstartup.c 2012-06-10 00:46:03 UTC
(rev 21843)
+++ gnunet/src/testing/test_testing_peerstartup.c 2012-06-10 01:01:03 UTC
(rev 21844)
@@ -33,8 +33,6 @@
#define LOG(kind,...) \
GNUNET_log (kind, __VA_ARGS__)
-#define TIME_REL_SEC(sec) \
- GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, sec)
/**
* The testing context
@@ -89,37 +87,11 @@
struct GNUNET_CONFIGURATION_Handle *new_cfg;
struct TestingContext *test_ctx;
char *emsg;
- char *_tmpdir;
- char *tmpdir;
-#ifdef MINGW
- char *tmpdir_w;
-#endif
-
struct GNUNET_PeerIdentity id;
- _tmpdir = getenv ("TMP");
- if (NULL == _tmpdir)
- _tmpdir = getenv ("TEMP");
- if (NULL == _tmpdir)
- _tmpdir = getenv ("TMPDIR");
- if (NULL == _tmpdir)
- _tmpdir = "/tmp";
- GNUNET_asprintf (&tmpdir, "%s/%s", _tmpdir,
"test-gnunet-testing_new-XXXXXX");
-#ifdef MINGW
- tmpdir_w = GNUNET_malloc (MAX_PATH + 1);
- GNUNET_assert (ERROR_SUCCESS == plibc_conv_to_win_path (tmpdir, tmpdir_w));
- GNUNET_free (tmpdir);
- tmpdir = tmpdir_w;
- //GNUNET_assert (0 == _mktemp_s (tmpdir, strlen (tmpdir) + 1));
-#else
- GNUNET_assert (mkdtemp (tmpdir) == tmpdir);
-#endif
- /* LOG (GNUNET_ERROR_TYPE_ERROR, */
- /* "Temporary directory: %s\n", tmpdir); */
- system = GNUNET_TESTING_system_create (tmpdir,
+ system = GNUNET_TESTING_system_create ("test-gnunet-testing",
"127.0.0.1");
GNUNET_assert (NULL != system);
- GNUNET_free (tmpdir);
new_cfg = GNUNET_CONFIGURATION_dup (cfg);
emsg = NULL;
peer = GNUNET_TESTING_peer_configure (system, new_cfg, 0, &id, &emsg);
@@ -130,9 +102,7 @@
test_ctx->system = system;
test_ctx->peer = peer;
test_ctx->cfg = new_cfg;
- GNUNET_SCHEDULER_add_delayed (TIME_REL_SEC (5),
- &do_shutdown, test_ctx);
-
+ GNUNET_SCHEDULER_add_now (&do_shutdown, test_ctx);
}
@@ -150,3 +120,5 @@
return 1;
return 0;
}
+
+/* end of test_testing_peerstartup.c */
Modified: gnunet/src/testing/test_testing_portreservation.c
===================================================================
--- gnunet/src/testing/test_testing_portreservation.c 2012-06-10 00:46:03 UTC
(rev 21843)
+++ gnunet/src/testing/test_testing_portreservation.c 2012-06-10 01:01:03 UTC
(rev 21844)
@@ -89,3 +89,5 @@
}
return 0;
}
+
+/* end of test_testing_portreservation.c */
Modified: gnunet/src/testing/test_testing_servicestartup.c
===================================================================
--- gnunet/src/testing/test_testing_servicestartup.c 2012-06-10 00:46:03 UTC
(rev 21843)
+++ gnunet/src/testing/test_testing_servicestartup.c 2012-06-10 01:01:03 UTC
(rev 21844)
@@ -23,7 +23,6 @@
* @brief test case for testing service startup using new testing API
* @author Sree Harsha Totakura
*/
-
#include "platform.h"
#include "gnunet_scheduler_lib.h"
#include "gnunet_testing_lib-new.h"
@@ -32,28 +31,13 @@
#define LOG(kind,...) \
GNUNET_log (kind, __VA_ARGS__)
-#define TIME_REL_SEC(sec) \
- GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, sec)
/**
* Global test status
*/
static int test_success;
-/**
- * The shutdown task. Used to signal that testing is done and service has to be
- * stopped
- *
- * @param cls NULL
- */
-static void
-shutdown_task(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- test_success = GNUNET_YES;
- GNUNET_SCHEDULER_shutdown ();
-}
-
/**
* The testing callback function
*
@@ -66,7 +50,8 @@
GNUNET_assert (NULL == cls);
GNUNET_assert (NULL != cfg);
LOG (GNUNET_ERROR_TYPE_DEBUG, "Service arm started successfully\n");
- GNUNET_SCHEDULER_add_delayed (TIME_REL_SEC (3), &shutdown_task, NULL);
+ test_success = GNUNET_YES;
+ GNUNET_SCHEDULER_shutdown ();
}
@@ -75,37 +60,14 @@
*/
int main (int argc, char *argv[])
{
- char *_tmpdir;
- char *tmpdir;
-#ifdef MINGW
- char *tmpdir_w;
-#endif
-
- GNUNET_log_setup ("test_testing_new_servicestartup", "DEBUG", NULL);
- _tmpdir = getenv ("TMP");
- if (NULL == _tmpdir)
- _tmpdir = getenv ("TEMP");
- if (NULL == _tmpdir)
- _tmpdir = getenv ("TMPDIR");
- if (NULL == _tmpdir)
- _tmpdir = "/tmp";
- GNUNET_asprintf (&tmpdir, "%s/%s", _tmpdir,
"test-gnunet-testing_new-XXXXXX");
-#ifdef MINGW
- tmpdir_w = GNUNET_malloc (MAX_PATH + 1);
- GNUNET_assert (ERROR_SUCCESS == plibc_conv_to_win_path (tmpdir, tmpdir_w));
- GNUNET_free (tmpdir);
- tmpdir = tmpdir_w;
- //GNUNET_assert (0 == _mktemp_s (tmpdir, strlen (tmpdir) + 1));
-#else
- GNUNET_assert (mkdtemp (tmpdir) == tmpdir);
-#endif
-
test_success = GNUNET_NO;
- GNUNET_assert (0 == GNUNET_TESTING_service_run (tmpdir,
+ GNUNET_assert (0 == GNUNET_TESTING_service_run
("test-testing-servicestartup",
"arm",
"test_testing_defaults.conf",
&test_run,
NULL));
- GNUNET_free (tmpdir);
return (GNUNET_YES == test_success) ? 0 : 1;
}
+
+/* end of test_testing_servicestartup.c */
+
Modified: gnunet/src/testing/testing.c
===================================================================
--- gnunet/src/testing/testing.c 2012-06-10 00:46:03 UTC (rev 21843)
+++ gnunet/src/testing/testing.c 2012-06-10 01:01:03 UTC (rev 21844)
@@ -245,7 +245,12 @@
GNUNET_assert (NULL != tmppath);
system = GNUNET_malloc (sizeof (struct GNUNET_TESTING_System));
- system->tmppath = GNUNET_strdup (tmppath);
+ system->tmppath = GNUNET_DISK_mkdtemp (tmppath);
+ if (NULL == system->tmppath)
+ {
+ GNUNET_free (system);
+ return NULL;
+ }
if (NULL != controller)
system->controller = GNUNET_strdup (controller);
if (GNUNET_OK != hostkeys_load (system))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r21844 - gnunet/src/testing,
gnunet <=