aboutsummaryrefslogtreecommitdiff
path: root/src/fs/test_fs_directory.c
diff options
context:
space:
mode:
authorgrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2009-09-09 13:21:00 +0000
committergrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2009-09-09 13:21:00 +0000
commit2808fbb5a61130d458c27dcfc48ba3a10c22ae5b (patch)
treecb8baaa5a7386197a0b87c96c56b7dd2efedb6c4 /src/fs/test_fs_directory.c
parent4e903c463ba8cdd3d0b3b22b32d72fc3c63c3a2d (diff)
more testing
git-svn-id: https://gnunet.org/svn/gnunet@8971 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/fs/test_fs_directory.c')
-rw-r--r--src/fs/test_fs_directory.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/src/fs/test_fs_directory.c b/src/fs/test_fs_directory.c
index 9d01010788..31a9869f3e 100644
--- a/src/fs/test_fs_directory.c
+++ b/src/fs/test_fs_directory.c
@@ -51,6 +51,8 @@ processor (void *cls,
struct PCLS *p = cls;
int i;
+ if (NULL == uri)
+ return; /* ignore directory's meta data */
for (i = 0; i < p->max; i++)
{
if (GNUNET_CONTAINER_meta_data_test_equal (p->md[i],
@@ -80,10 +82,16 @@ testDirectory (unsigned int i)
char uri[512];
char txt[128];
int ret = 0;
+ struct GNUNET_TIME_Absolute start;
+ char *s;
cls.max = i;
uris = GNUNET_malloc (sizeof (struct GNUNET_FS_Uri*) * i);
mds = GNUNET_malloc (sizeof (struct GNUNET_CONTAINER_MetaData*) * i);
+ meta = GNUNET_CONTAINER_meta_data_create ();
+ GNUNET_CONTAINER_meta_data_insert (meta, EXTRACTOR_TITLE, "A title");
+ GNUNET_CONTAINER_meta_data_insert (meta, EXTRACTOR_AUTHOR, "An author");
+ db = GNUNET_FS_directory_builder_create (meta);
for (p = 0; p < i; p++)
{
mds[p] = GNUNET_CONTAINER_meta_data_create ();
@@ -112,22 +120,27 @@ testDirectory (unsigned int i)
GNUNET_free (uris);
ABORT (); /* error in testcase */
}
+ GNUNET_FS_directory_builder_add (db, uris[p], mds[p], NULL);
}
- meta = GNUNET_CONTAINER_meta_data_create ();
- GNUNET_CONTAINER_meta_data_insert (meta, EXTRACTOR_TITLE, "A title");
- GNUNET_CONTAINER_meta_data_insert (meta, EXTRACTOR_AUTHOR, "An author");
- db = GNUNET_FS_directory_builder_create (meta);
- for (p=0;p<i;p++)
- GNUNET_FS_directory_builder_add (db, uris[i], mds[i], NULL);
+ start = GNUNET_TIME_absolute_get ();
GNUNET_FS_directory_builder_finish (db,
&dlen,
(void**) &data);
- cls.pos = 0;
- cls.uri = uris;
- cls.md = mds;
- GNUNET_FS_directory_list_contents (dlen, data, 0,
- &processor, &cls);
- GNUNET_assert (cls.pos == i);
+ s = GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start));
+ fprintf (stdout,
+ "Creating directory with %u entires took %s\n",
+ i,
+ s);
+ GNUNET_free (s);
+ if (i < 1000)
+ {
+ cls.pos = 0;
+ cls.uri = uris;
+ cls.md = mds;
+ GNUNET_FS_directory_list_contents (dlen, data, 0,
+ &processor, &cls);
+ GNUNET_assert (cls.pos == i);
+ }
GNUNET_free (data);
GNUNET_CONTAINER_meta_data_destroy (meta);
for (p = 0; p < i; p++)
@@ -140,6 +153,7 @@ testDirectory (unsigned int i)
return ret;
}
+
int
main (int argc, char *argv[])
{
@@ -153,11 +167,8 @@ main (int argc, char *argv[])
"WARNING",
#endif
NULL);
- for (i = 17; i < 2000; i *= 2)
- {
- fprintf (stderr, ".");
- failureCount += testDirectory (i);
- }
+ for (i = 17; i < 10000; i *= 2)
+ failureCount += testDirectory (i);
fprintf (stderr, "\n");
if (failureCount != 0)