aboutsummaryrefslogtreecommitdiff
path: root/src/datacache
diff options
context:
space:
mode:
Diffstat (limited to 'src/datacache')
-rw-r--r--src/datacache/perf_datacache.c17
-rw-r--r--src/datacache/test_datacache.c6
-rw-r--r--src/datacache/test_datacache_quota.c13
3 files changed, 17 insertions, 19 deletions
diff --git a/src/datacache/perf_datacache.c b/src/datacache/perf_datacache.c
index 6fc0a7217..0f4fea419 100644
--- a/src/datacache/perf_datacache.c
+++ b/src/datacache/perf_datacache.c
@@ -71,8 +71,7 @@ run (void *cls, char *const *args, const char *cfgfile,
71 71
72 if (h == NULL) 72 if (h == NULL)
73 { 73 {
74 fprintf (stderr, 74 FPRINTF (stderr, "%s", "Failed to initialize datacache. Database likely not setup, skipping test.\n");
75 "Failed to initialize datacache. Database likely not setup, skipping test.\n");
76 return; 75 return;
77 } 76 }
78 exp = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS); 77 exp = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS);
@@ -81,15 +80,15 @@ run (void *cls, char *const *args, const char *cfgfile,
81 for (i = 0; i < ITERATIONS; i++) 80 for (i = 0; i < ITERATIONS; i++)
82 { 81 {
83 if (0 == i % (ITERATIONS / 80)) 82 if (0 == i % (ITERATIONS / 80))
84 fprintf (stderr, "."); 83 FPRINTF (stderr, "%s", ".");
85 GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n); 84 GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n);
86 ASSERT (GNUNET_OK == 85 ASSERT (GNUNET_OK ==
87 GNUNET_DATACACHE_put (h, &k, sizeof (GNUNET_HashCode), 86 GNUNET_DATACACHE_put (h, &k, sizeof (GNUNET_HashCode),
88 (const char *) &n, 1 + i % 16, exp)); 87 (const char *) &n, 1 + i % 16, exp));
89 k = n; 88 k = n;
90 } 89 }
91 fprintf (stderr, "\n"); 90 FPRINTF (stderr, "%s", "\n");
92 fprintf (stdout, "Stored %u items in %llums\n", ITERATIONS, 91 FPRINTF (stdout, "Stored %u items in %llums\n", ITERATIONS,
93 (unsigned long long) 92 (unsigned long long)
94 GNUNET_TIME_absolute_get_duration (start).rel_value); 93 GNUNET_TIME_absolute_get_duration (start).rel_value);
95 GNUNET_snprintf (gstr, sizeof (gstr), "DATACACHE-%s", plugin_name); 94 GNUNET_snprintf (gstr, sizeof (gstr), "DATACACHE-%s", plugin_name);
@@ -101,13 +100,13 @@ run (void *cls, char *const *args, const char *cfgfile,
101 for (i = 0; i < ITERATIONS; i++) 100 for (i = 0; i < ITERATIONS; i++)
102 { 101 {
103 if (0 == i % (ITERATIONS / 80)) 102 if (0 == i % (ITERATIONS / 80))
104 fprintf (stderr, "."); 103 FPRINTF (stderr, "%s", ".");
105 GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n); 104 GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n);
106 GNUNET_DATACACHE_get (h, &k, 1 + i % 16, &checkIt, &n); 105 GNUNET_DATACACHE_get (h, &k, 1 + i % 16, &checkIt, &n);
107 k = n; 106 k = n;
108 } 107 }
109 fprintf (stderr, "\n"); 108 FPRINTF (stderr, "%s", "\n");
110 fprintf (stdout, 109 FPRINTF (stdout,
111 "Found %u/%u items in %llums (%u were deleted during storage processing)\n", 110 "Found %u/%u items in %llums (%u were deleted during storage processing)\n",
112 found, ITERATIONS, 111 found, ITERATIONS,
113 (unsigned long long) 112 (unsigned long long)
@@ -169,7 +168,7 @@ main (int argc, char *argv[])
169 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv, 168 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,
170 "perf-datacache", "nohelp", options, &run, NULL); 169 "perf-datacache", "nohelp", options, &run, NULL);
171 if (ok != 0) 170 if (ok != 0)
172 fprintf (stderr, "Missed some perfcases: %d\n", ok); 171 FPRINTF (stderr, "Missed some perfcases: %d\n", ok);
173 return ok; 172 return ok;
174} 173}
175 174
diff --git a/src/datacache/test_datacache.c b/src/datacache/test_datacache.c
index 6c70807c1..ff3640b6f 100644
--- a/src/datacache/test_datacache.c
+++ b/src/datacache/test_datacache.c
@@ -71,8 +71,8 @@ run (void *cls, char *const *args, const char *cfgfile,
71 h = GNUNET_DATACACHE_create (cfg, "testcache"); 71 h = GNUNET_DATACACHE_create (cfg, "testcache");
72 if (h == NULL) 72 if (h == NULL)
73 { 73 {
74 fprintf (stderr, 74 FPRINTF (stderr,
75 "Failed to initialize datacache. Database likely not setup, skipping test.\n"); 75 "Failed to initialize datacache. Database likely not setup, skipping test.\n", NULL);
76 return; 76 return;
77 } 77 }
78 exp = GNUNET_TIME_absolute_get (); 78 exp = GNUNET_TIME_absolute_get ();
@@ -154,7 +154,7 @@ main (int argc, char *argv[])
154 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv, 154 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,
155 "test-datacache", "nohelp", options, &run, NULL); 155 "test-datacache", "nohelp", options, &run, NULL);
156 if (ok != 0) 156 if (ok != 0)
157 fprintf (stderr, "Missed some testcases: %d\n", ok); 157 FPRINTF (stderr, "Missed some testcases: %d\n", ok);
158 return ok; 158 return ok;
159} 159}
160 160
diff --git a/src/datacache/test_datacache_quota.c b/src/datacache/test_datacache_quota.c
index d3681da8e..468972c9e 100644
--- a/src/datacache/test_datacache_quota.c
+++ b/src/datacache/test_datacache_quota.c
@@ -60,8 +60,7 @@ run (void *cls, char *const *args, const char *cfgfile,
60 60
61 if (h == NULL) 61 if (h == NULL)
62 { 62 {
63 fprintf (stderr, 63 FPRINTF (stderr, "%s", "Failed to initialize datacache. Database likely not setup, skipping test.\n");
64 "Failed to initialize datacache. Database likely not setup, skipping test.\n");
65 return; 64 return;
66 } 65 }
67 exp = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS); 66 exp = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS);
@@ -69,7 +68,7 @@ run (void *cls, char *const *args, const char *cfgfile,
69 memset (&k, 0, sizeof (GNUNET_HashCode)); 68 memset (&k, 0, sizeof (GNUNET_HashCode));
70 for (i = 0; i < 10; i++) 69 for (i = 0; i < 10; i++)
71 { 70 {
72 fprintf (stderr, "."); 71 FPRINTF (stderr, "%s", ".");
73 GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n); 72 GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n);
74 for (j = i; j < sizeof (buf); j += 10) 73 for (j = i; j < sizeof (buf); j += 10)
75 { 74 {
@@ -80,11 +79,11 @@ run (void *cls, char *const *args, const char *cfgfile,
80 } 79 }
81 k = n; 80 k = n;
82 } 81 }
83 fprintf (stderr, "\n"); 82 FPRINTF (stderr, "%s", "\n");
84 memset (&k, 0, sizeof (GNUNET_HashCode)); 83 memset (&k, 0, sizeof (GNUNET_HashCode));
85 for (i = 0; i < 10; i++) 84 for (i = 0; i < 10; i++)
86 { 85 {
87 fprintf (stderr, "."); 86 FPRINTF (stderr, "%s", ".");
88 GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n); 87 GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n);
89 if (i < 2) 88 if (i < 2)
90 ASSERT (0 == GNUNET_DATACACHE_get (h, &k, 1 + i, NULL, NULL)); 89 ASSERT (0 == GNUNET_DATACACHE_get (h, &k, 1 + i, NULL, NULL));
@@ -92,7 +91,7 @@ run (void *cls, char *const *args, const char *cfgfile,
92 ASSERT (0 < GNUNET_DATACACHE_get (h, &k, 1 + i, NULL, NULL)); 91 ASSERT (0 < GNUNET_DATACACHE_get (h, &k, 1 + i, NULL, NULL));
93 k = n; 92 k = n;
94 } 93 }
95 fprintf (stderr, "\n"); 94 FPRINTF (stderr, "%s", "\n");
96 GNUNET_DATACACHE_destroy (h); 95 GNUNET_DATACACHE_destroy (h);
97 return; 96 return;
98FAILURE: 97FAILURE:
@@ -145,7 +144,7 @@ main (int argc, char *argv[])
145 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv, 144 GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,
146 "test-datacache-quota", "nohelp", options, &run, NULL); 145 "test-datacache-quota", "nohelp", options, &run, NULL);
147 if (ok != 0) 146 if (ok != 0)
148 fprintf (stderr, "Missed some testcases: %d\n", ok); 147 FPRINTF (stderr, "Missed some testcases: %d\n", ok);
149 return ok; 148 return ok;
150} 149}
151 150