aboutsummaryrefslogtreecommitdiff
path: root/src/testing/test_testing_peerstartup.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-06-10 01:01:03 +0000
committerChristian Grothoff <christian@grothoff.org>2012-06-10 01:01:03 +0000
commit823825f3995c0850c4bc748fa267c0a74d35dbb3 (patch)
treeac5e16ea917031bad5b9807821f1bcc5a86a0ad5 /src/testing/test_testing_peerstartup.c
parentcefe62b18a22ae045fa64fa6bba44c3581ab64d5 (diff)
downloadgnunet-823825f3995c0850c4bc748fa267c0a74d35dbb3.tar.gz
gnunet-823825f3995c0850c4bc748fa267c0a74d35dbb3.zip
-minor fixes
Diffstat (limited to 'src/testing/test_testing_peerstartup.c')
-rw-r--r--src/testing/test_testing_peerstartup.c36
1 files changed, 4 insertions, 32 deletions
diff --git a/src/testing/test_testing_peerstartup.c b/src/testing/test_testing_peerstartup.c
index 13853fe68..990486467 100644
--- a/src/testing/test_testing_peerstartup.c
+++ b/src/testing/test_testing_peerstartup.c
@@ -33,8 +33,6 @@
33#define LOG(kind,...) \ 33#define LOG(kind,...) \
34 GNUNET_log (kind, __VA_ARGS__) 34 GNUNET_log (kind, __VA_ARGS__)
35 35
36#define TIME_REL_SEC(sec) \
37 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, sec)
38 36
39/** 37/**
40 * The testing context 38 * The testing context
@@ -89,37 +87,11 @@ run (void *cls, char *const *args, const char *cfgfile,
89 struct GNUNET_CONFIGURATION_Handle *new_cfg; 87 struct GNUNET_CONFIGURATION_Handle *new_cfg;
90 struct TestingContext *test_ctx; 88 struct TestingContext *test_ctx;
91 char *emsg; 89 char *emsg;
92 char *_tmpdir;
93 char *tmpdir;
94#ifdef MINGW
95 char *tmpdir_w;
96#endif
97
98 struct GNUNET_PeerIdentity id; 90 struct GNUNET_PeerIdentity id;
99 91
100 _tmpdir = getenv ("TMP"); 92 system = GNUNET_TESTING_system_create ("test-gnunet-testing",
101 if (NULL == _tmpdir)
102 _tmpdir = getenv ("TEMP");
103 if (NULL == _tmpdir)
104 _tmpdir = getenv ("TMPDIR");
105 if (NULL == _tmpdir)
106 _tmpdir = "/tmp";
107 GNUNET_asprintf (&tmpdir, "%s/%s", _tmpdir, "test-gnunet-testing_new-XXXXXX");
108#ifdef MINGW
109 tmpdir_w = GNUNET_malloc (MAX_PATH + 1);
110 GNUNET_assert (ERROR_SUCCESS == plibc_conv_to_win_path (tmpdir, tmpdir_w));
111 GNUNET_free (tmpdir);
112 tmpdir = tmpdir_w;
113 //GNUNET_assert (0 == _mktemp_s (tmpdir, strlen (tmpdir) + 1));
114#else
115 GNUNET_assert (mkdtemp (tmpdir) == tmpdir);
116#endif
117 /* LOG (GNUNET_ERROR_TYPE_ERROR, */
118 /* "Temporary directory: %s\n", tmpdir); */
119 system = GNUNET_TESTING_system_create (tmpdir,
120 "127.0.0.1"); 93 "127.0.0.1");
121 GNUNET_assert (NULL != system); 94 GNUNET_assert (NULL != system);
122 GNUNET_free (tmpdir);
123 new_cfg = GNUNET_CONFIGURATION_dup (cfg); 95 new_cfg = GNUNET_CONFIGURATION_dup (cfg);
124 emsg = NULL; 96 emsg = NULL;
125 peer = GNUNET_TESTING_peer_configure (system, new_cfg, 0, &id, &emsg); 97 peer = GNUNET_TESTING_peer_configure (system, new_cfg, 0, &id, &emsg);
@@ -130,9 +102,7 @@ run (void *cls, char *const *args, const char *cfgfile,
130 test_ctx->system = system; 102 test_ctx->system = system;
131 test_ctx->peer = peer; 103 test_ctx->peer = peer;
132 test_ctx->cfg = new_cfg; 104 test_ctx->cfg = new_cfg;
133 GNUNET_SCHEDULER_add_delayed (TIME_REL_SEC (5), 105 GNUNET_SCHEDULER_add_now (&do_shutdown, test_ctx);
134 &do_shutdown, test_ctx);
135
136} 106}
137 107
138 108
@@ -150,3 +120,5 @@ int main (int argc, char *argv[])
150 return 1; 120 return 1;
151 return 0; 121 return 0;
152} 122}
123
124/* end of test_testing_peerstartup.c */