gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: -fix tests


From: gnunet
Subject: [gnunet] branch master updated: -fix tests
Date: Tue, 10 Nov 2020 08:35:49 +0100

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 10081ef56 -fix tests
10081ef56 is described below

commit 10081ef560ef3e624d4dcadf5e19f0330b078d64
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Tue Nov 10 16:28:23 2020 +0900

    -fix tests
---
 src/gnsrecord/gnsrecord_misc.c                  | 32 ++++++++++++++-----------
 src/namestore/test_namestore_api_zone_to_name.c |  3 ++-
 src/namestore/test_plugin_rest_namestore.sh     | 21 ++++++++--------
 3 files changed, 31 insertions(+), 25 deletions(-)

diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c
index 2e00141a3..82c38f19a 100644
--- a/src/gnsrecord/gnsrecord_misc.c
+++ b/src/gnsrecord/gnsrecord_misc.c
@@ -107,8 +107,8 @@ GNUNET_GNSRECORD_records_cmp (const struct 
GNUNET_GNSRECORD_Data *a,
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "Expiration time %llu != %llu\n",
-         a->expiration_time,
-         b->expiration_time);
+         (unsigned long long) a->expiration_time,
+         (unsigned long long) b->expiration_time);
     return GNUNET_NO;
   }
   if ((a->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS)
@@ -282,11 +282,13 @@ GNUNET_GNSRECORD_identity_from_data (const char *data,
     return GNUNET_SYSERR;
   if (data_size > sizeof (struct GNUNET_IDENTITY_PublicKey))
     return GNUNET_SYSERR;
-  return (GNUNET_IDENTITY_read_key_from_buffer(key, data, data_size) == 
data_size?
-                 GNUNET_OK :
-                 GNUNET_SYSERR);
+  return (GNUNET_IDENTITY_read_key_from_buffer (key, data, data_size) ==
+          data_size?
+          GNUNET_OK :
+          GNUNET_SYSERR);
 }
 
+
 enum GNUNET_GenericReturnValue
 GNUNET_GNSRECORD_data_from_identity (const struct
                                      GNUNET_IDENTITY_PublicKey *key,
@@ -294,14 +296,15 @@ GNUNET_GNSRECORD_data_from_identity (const struct
                                      size_t *data_size,
                                      uint32_t *type)
 {
-  *type = key->type;
+  *type = ntohl (key->type);
   *data_size = GNUNET_IDENTITY_key_get_length (key);
   if (0 == *data_size)
     return GNUNET_SYSERR;
   *data = GNUNET_malloc (*data_size);
-  return (GNUNET_IDENTITY_write_key_to_buffer(key, data, *data_size) == 
*data_size?
-                 GNUNET_OK :
-                 GNUNET_SYSERR);
+  return (GNUNET_IDENTITY_write_key_to_buffer (key, *data, *data_size) ==
+          *data_size?
+          GNUNET_OK :
+          GNUNET_SYSERR);
 }
 
 
@@ -310,14 +313,15 @@ GNUNET_GNSRECORD_is_zonekey_type (uint32_t type)
 {
   switch (type)
   {
-    case GNUNET_GNSRECORD_TYPE_PKEY:
-    case GNUNET_GNSRECORD_TYPE_EDKEY:
-      return GNUNET_YES;
-    default:
-      return GNUNET_NO;
+  case GNUNET_GNSRECORD_TYPE_PKEY:
+  case GNUNET_GNSRECORD_TYPE_EDKEY:
+    return GNUNET_YES;
+  default:
+    return GNUNET_NO;
   }
 }
 
+
 size_t
 GNUNET_GNSRECORD_block_get_size (const struct GNUNET_GNSRECORD_Block *block)
 {
diff --git a/src/namestore/test_namestore_api_zone_to_name.c 
b/src/namestore/test_namestore_api_zone_to_name.c
index e5ede6bcd..3fd10e4a1 100644
--- a/src/namestore/test_namestore_api_zone_to_name.c
+++ b/src/namestore/test_namestore_api_zone_to_name.c
@@ -212,12 +212,13 @@ run (void *cls,
   GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
                               &s_zone_value,
                               sizeof(s_zone_value));
+  s_zone_value.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
   {
     struct GNUNET_GNSRECORD_Data rd;
 
     rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us;
     rd.record_type = GNUNET_GNSRECORD_TYPE_PKEY;
-    rd.data_size = sizeof(s_zone_value);
+    rd.data_size = GNUNET_IDENTITY_key_get_length (&s_zone_value);
     rd.data = &s_zone_value;
     rd.flags = 0;
 
diff --git a/src/namestore/test_plugin_rest_namestore.sh 
b/src/namestore/test_plugin_rest_namestore.sh
index 12a7fa50c..8a45cebf5 100755
--- a/src/namestore/test_plugin_rest_namestore.sh
+++ b/src/namestore/test_plugin_rest_namestore.sh
@@ -84,14 +84,15 @@ gnunet-identity -C $TEST_ID -c test_namestore_api.conf
 test="$(gnunet-namestore -D -z $TEST_ID -c test_namestore_api.conf)"
 name=$TEST_ID
 public="$(gnunet-identity -d -c test_namestore_api.conf | grep $TEST_ID | awk 
'NR==1{print $3}')"
-gnunet-namestore -z $name -p -a -n "test_entry" -e "1d" -V 
"HVX38H2CB7WJM0WCPWT9CFX6GASMYJVR65RN75SJSSKAYVYXHMRG" -t "PKEY" -c 
test_namestore_api.conf
+echo "$name $public"
+valgrind gnunet-namestore -z $name -p -a -n "test_entry" -e "1d" -V 
"000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8" -t "PKEY" -c 
test_namestore_api.conf
 #curl_get "${namestore_link}" "HTTP/1.1 200 OK"
 curl_get "${namestore_link}/$name" "HTTP/1.1 200 OK"
 curl_get "${namestore_link}/$public" "error"
 gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf
 
 #Test POST with NAME
-curl_post "${namestore_link}/$name" '{"data": 
[{"value":"HVX38H2CB7WJM0WCPWT9CFX6GASMYJVR65RN75SJSSKAYVYXHMRG", 
"record_type":"PKEY", "expiration_time":"1d","private": false, 
"relative_expiration": false, "supplemental": false, "shadow": 
false}],"record_name":"test_entry"}' "HTTP/1.1 204 No Content"
+curl_post "${namestore_link}/$name" '{"data": 
[{"value":"000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8", 
"record_type":"PKEY", "expiration_time":"1d","private": false, 
"relative_expiration": false, "supplemental": false, "shadow": 
false}],"record_name":"test_entry"}' "HTTP/1.1 204 No Content"
 gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > 
/dev/null 2>&1
 
 # invalid values
@@ -106,29 +107,29 @@ curl_post "${namestore_link}/$name" '{"data": 
[{"record_type":"PKEY", "expiratio
 gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > 
/dev/null 2>&1
 
 #expirations
-curl_post "${namestore_link}/$name" '{"data": 
[{"value":"HVX38H2CB7WJM0WCPWT9CFX6GASMYJVR65RN75SJSSKAYVYXHMRG", 
"record_type":"PKEY", "expiration_time":"0d","private": false, 
"relative_expiration": true, "supplemental": false, "shadow": 
false}],"record_name":"test_entry"}' "HTTP/1.1 204"
+curl_post "${namestore_link}/$name" '{"data": 
[{"value":"000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8", 
"record_type":"PKEY", "expiration_time":"0d","private": false, 
"relative_expiration": true, "supplemental": false, "shadow": 
false}],"record_name":"test_entry"}' "HTTP/1.1 204"
 gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > 
/dev/null 2>&1
 
-curl_post "${namestore_link}/$name" '{"data": 
[{"value":"HVX38H2CB7WJM0WCPWT9CFX6GASMYJVR65RN75SJSSKAYVYXHMRG", 
"record_type":"PKEY", "expiration_time":"10000d","private": false, 
"relative_expiration": true, "supplemental": false, "shadow": 
false}],"record_name":"test_entry"}' "HTTP/1.1 204"
+curl_post "${namestore_link}/$name" '{"data": 
[{"value":"000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8", 
"record_type":"PKEY", "expiration_time":"10000d","private": false, 
"relative_expiration": true, "supplemental": false, "shadow": 
false}],"record_name":"test_entry"}' "HTTP/1.1 204"
 gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > 
/dev/null 2>&1
 
-curl_post "${namestore_link}/$name" '{"data": 
[{"value":"HVX38H2CB7WJM0WCPWT9CFX6GASMYJVR65RN75SJSSKAYVYXHMRG", 
"record_type":"PKEY", "expiration_time":"now","private": false, 
"relative_expiration": false, "supplemental": false, "shadow": 
false}],"record_name":"test_entry"}' "error"
+curl_post "${namestore_link}/$name" '{"data": 
[{"value":"000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8", 
"record_type":"PKEY", "expiration_time":"now","private": false, 
"relative_expiration": false, "supplemental": false, "shadow": 
false}],"record_name":"test_entry"}' "error"
 gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > 
/dev/null 2>&1
 
-curl_post "${namestore_link}/$name" '{"data": 
[{"value":"HVX38H2CB7WJM0WCPWT9CFX6GASMYJVR65RN75SJSSKAYVYXHMRG", 
"record_type":"PKEY", "expiration_time_missing":"1d","private": false, 
"relative_expiration": false, "supplemental": false, "shadow": 
false}],"record_name":"test_entry"}' "error"
+curl_post "${namestore_link}/$name" '{"data": 
[{"value":"000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8", 
"record_type":"PKEY", "expiration_time_missing":"1d","private": false, 
"relative_expiration": false, "supplemental": false, "shadow": 
false}],"record_name":"test_entry"}' "error"
 gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > 
/dev/null 2>&1
 
 #record_name
-curl_post "${namestore_link}/$name" '{"data": 
[{"value":"HVX38H2CB7WJM0WCPWT9CFX6GASMYJVR65RN75SJSSKAYVYXHMRG", 
"record_type":"PKEY", "expiration_time":"1d","private": false, 
"relative_expiration": false, "supplemental": false, "shadow": 
false}],"record_name":""}' "error"
+curl_post "${namestore_link}/$name" '{"data": 
[{"value":"000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8", 
"record_type":"PKEY", "expiration_time":"1d","private": false, 
"relative_expiration": false, "supplemental": false, "shadow": 
false}],"record_name":""}' "error"
 gnunet-namestore -z $name -d -n "test_entry"  -c test_namestore_api.conf > 
/dev/null 2>&1
-curl_post "${namestore_link}/$name" '{"data": 
[{"value":"HVX38H2CB7WJM0WCPWT9CFX6GASMYJVR65RN75SJSSKAYVYXHMRG", 
"record_type":"PKEY", "expiration_time":"1d","private": false, 
"relative_expiration": false, "supplemental": false, "shadow": 
false}],"record_name_missing":"test_entry"}' "error"
+curl_post "${namestore_link}/$name" '{"data": 
[{"value":"000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8", 
"record_type":"PKEY", "expiration_time":"1d","private": false, 
"relative_expiration": false, "supplemental": false, "shadow": 
false}],"record_name_missing":"test_entry"}' "error"
 gnunet-namestore -z $name -d -n "test_entry"  -c test_namestore_api.conf > 
/dev/null 2>&1
 
 #Test DELETE
-gnunet-namestore -z $name -p -a -n "test_entry" -e "1d" -V 
"HVX38H2CB7WJM0WCPWT9CFX6GASMYJVR65RN75SJSSKAYVYXHMRG" -t "PKEY"  -c 
test_namestore_api.conf
+gnunet-namestore -z $name -p -a -n "test_entry" -e "1d" -V 
"000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8" -t "PKEY"  -c 
test_namestore_api.conf
 curl_delete "${namestore_link}/$name/test_entry" "HTTP/1.1 204" 
 curl_delete "${namestore_link}/$name/test_entry" "error" 
-gnunet-namestore -z $name -p -a -n "test_entry" -e "1d" -V 
"HVX38H2CB7WJM0WCPWT9CFX6GASMYJVR65RN75SJSSKAYVYXHMRG" -t "PKEY"  -c 
test_namestore_api.conf
+gnunet-namestore -z $name -p -a -n "test_entry" -e "1d" -V 
"000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8" -t "PKEY"  -c 
test_namestore_api.conf
 curl_delete "${namestore_link}/$public/test_entry" "error" 
 
 gnunet-arm -e  -c test_namestore_api.conf

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]