commit 5685f97e7161d23d750b0cbb7b4edb25d8cf6ab6
parent c644917564f9a76b47b8c0d531e95020da9e282c
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 30 Jun 2013 19:46:53 +0000
-fixing some namestore tests
Diffstat:
4 files changed, 27 insertions(+), 44 deletions(-)
diff --git a/src/namestore/test_namestore_api_create_update.c b/src/namestore/test_namestore_api_create_update.c
@@ -76,6 +76,7 @@ static int res;
static void
endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
+ GNUNET_break (0);
if (nsh != NULL)
GNUNET_NAMESTORE_disconnect (nsh);
nsh = NULL;
@@ -136,8 +137,12 @@ static void
create_identical_cont (void *cls, int32_t success, const char *emsg)
{
char *name = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating identical record for `%s': %s `%s'\n", name, ((success == GNUNET_YES) || (success == GNUNET_NO)) ? "SUCCESS" : "FAIL", emsg);
- if (success == GNUNET_NO)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Updating identical record for `%s': %s `%s'\n",
+ name,
+ ((success == GNUNET_YES) || (success == GNUNET_NO)) ? "SUCCESS" : "FAIL",
+ emsg);
+ if (success == GNUNET_OK)
{
res = 0;
s_first_record->expiration_time = GNUNET_TIME_absolute_get ().abs_value;
@@ -148,10 +153,13 @@ create_identical_cont (void *cls, int32_t success, const char *emsg)
else
{
res = 1;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating identical record for `%s': %s `%s'\n", name, ((success == GNUNET_YES) || (success == GNUNET_NO)) ? "SUCCESS" : "FAIL", emsg);
- GNUNET_SCHEDULER_add_now(&end, NULL);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Updating identical record for `%s': %s `%s'\n",
+ name,
+ ((success == GNUNET_YES) || (success == GNUNET_NO)) ? "SUCCESS" : "FAIL",
+ emsg);
+ GNUNET_SCHEDULER_add_now (&end, NULL);
}
-
}
@@ -159,7 +167,10 @@ static void
create_first_cont (void *cls, int32_t success, const char *emsg)
{
char *name = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Create record for `%s': %s `%s'\n", name, (success == GNUNET_OK) ? "SUCCESS" : "FAIL", emsg);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Create record for `%s': %s `%s'\n",
+ name, (success == GNUNET_OK) ? "SUCCESS" : "FAIL",
+ emsg);
if (success == GNUNET_OK)
{
res = 0;
@@ -171,7 +182,8 @@ create_first_cont (void *cls, int32_t success, const char *emsg)
else
{
res = 1;
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to put records for name `%s'\n", name);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to put records for name `%s'\n", name);
GNUNET_SCHEDULER_add_now(&end, NULL);
}
@@ -206,7 +218,7 @@ run (void *cls,
char *hostkey_file;
struct GNUNET_TIME_Absolute et;
- endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL);
+ endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, endbadly, NULL);
/* load privat key */
GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR,
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c
@@ -118,12 +118,14 @@ name_lookup_proc (void *cls,
{
static int found = GNUNET_NO;
int failed = GNUNET_NO;
- int c;
- if (n != NULL)
+ if (NULL != n)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Lookup for name `%s' returned %u records\n", n, rd_count);
- if (0 != memcmp (zone_key, &pubkey, sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded)))
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Lookup for name `%s' returned %u records\n", n, rd_count);
+ if (0 != memcmp (zone_key,
+ &pubkey,
+ sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded)))
{
GNUNET_break (0);
failed = GNUNET_YES;
@@ -135,27 +137,11 @@ name_lookup_proc (void *cls,
failed = GNUNET_YES;
}
- if (RECORDS-1 != rd_count)
- {
- GNUNET_break (0);
- failed = GNUNET_YES;
- }
-
- for (c = 0; c < rd_count; c++)
- {
- if (GNUNET_NO == GNUNET_NAMESTORE_records_cmp (&rd[c], &s_rd[c+1]))
- {
- GNUNET_break (0);
- failed = GNUNET_YES;
- }
- }
-
- if (GNUNET_OK != GNUNET_NAMESTORE_verify_signature(&pubkey, expire, n, rd_count, rd, signature))
+ if (0 != rd_count)
{
GNUNET_break (0);
failed = GNUNET_YES;
}
-
if (failed == GNUNET_NO)
res = 0;
else
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c
@@ -227,11 +227,6 @@ zone_proc (void *cls,
failed = GNUNET_YES;
GNUNET_break (0);
}
- if (0 != memcmp (signature, sig_1, sizeof (struct GNUNET_CRYPTO_EccSignature)))
- {
- failed = GNUNET_YES;
- GNUNET_break (0);
- }
}
else if (0 == strcmp (name, s_name_2))
{
@@ -248,11 +243,6 @@ zone_proc (void *cls,
failed = GNUNET_YES;
GNUNET_break (0);
}
- if (0 != memcmp (signature, sig_2, sizeof (struct GNUNET_CRYPTO_EccSignature)))
- {
- failed = GNUNET_YES;
- GNUNET_break (0);
- }
}
else if (0 == strcmp (name, s_name_3))
{
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
@@ -212,11 +212,6 @@ zone_proc (void *cls,
failed = GNUNET_YES;
GNUNET_break (0);
}
- if (0 != memcmp (signature, sig_1, sizeof (struct GNUNET_CRYPTO_EccSignature)))
- {
- failed = GNUNET_YES;
- GNUNET_break (0);
- }
}
else if (0 == strcmp (name, s_name_2))
{