test_namestore_api_sign_verify.c
test_namestore_api_sign_verify_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/namestore/libgnunetnamestore.la
test_namestore_api_SOURCES = \
test_namestore_api.c
test_namestore_api_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/namestore/libgnunetnamestore.la
test_namestore_api_put_SOURCES = \
test_namestore_api_put.c
test_namestore_api_put_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/namestore/libgnunetnamestore.la
test_namestore_api_lookup_SOURCES = \
test_namestore_api_lookup.c
test_namestore_api_lookup_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/namestore/libgnunetnamestore.la
test_namestore_api_lookup_specific_type_SOURCES = \
test_namestore_api_lookup_specific_type.c
test_namestore_api_lookup_specific_type_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/namestore/libgnunetnamestore.la
test_namestore_api_create_SOURCES = \
test_namestore_api_create.c
test_namestore_api_create_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/namestore/libgnunetnamestore.la
test_namestore_api_create_update_SOURCES = \
test_namestore_api_create_update.c
test_namestore_api_create_update_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/namestore/libgnunetnamestore.la
test_namestore_api_remove_SOURCES = \
test_namestore_api_remove.c
test_namestore_api_remove_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/namestore/libgnunetnamestore.la
test_namestore_api_remove_not_existing_record_SOURCES = \
test_namestore_api_remove_not_existing_record.c
test_namestore_api_remove_not_existing_record_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/namestore/libgnunetnamestore.la
test_namestore_api_zone_to_name_SOURCES = \
test_namestore_api_zone_to_name.c
test_namestore_api_zone_to_name_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/namestore/libgnunetnamestore.la
test_namestore_api_zone_iteration_SOURCES = \
test_namestore_api_zone_iteration.c
test_namestore_api_zone_iteration_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/namestore/libgnunetnamestore.la
test_namestore_api_zone_iteration_specific_zone_SOURCES = \
test_namestore_api_zone_iteration_specific_zone.c
test_namestore_api_zone_iteration_specific_zone_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/namestore/libgnunetnamestore.la
test_namestore_api_zone_iteration_stop_SOURCES = \
test_namestore_api_zone_iteration_stop.c
test_namestore_api_zone_iteration_stop_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/namestore/libgnunetnamestore.la
test_namestore_record_serialization_SOURCES = \
test_namestore_record_serialization.c
test_namestore_record_serialization_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/namestore/libgnunetnamestore.la
#include "platform.h"
#include "gnunet_common.h"
#include "gnunet_namestore_service.h"
+#include "gnunet_testing_lib-new.h"
#define TEST_RECORD_TYPE 1234
#define TEST_RECORD_DATALEN 123
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
-static struct GNUNET_NAMESTORE_Handle * nsh;
+static struct GNUNET_NAMESTORE_Handle *nsh;
static GNUNET_SCHEDULER_TaskIdentifier endbadly_task;
-static struct GNUNET_OS_Process *arm;
-
-static struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
+static struct GNUNET_CRYPTO_RsaPrivateKey *privkey;
static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
static int res;
-static void
-start_arm (const char *cfgname)
-{
- arm = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
- "gnunet-service-arm", "-c", cfgname,
- NULL);
-}
-
-
-static void
-stop_arm ()
-{
- if (NULL != arm)
- {
- if (0 != GNUNET_OS_process_kill (arm, SIGTERM))
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
- GNUNET_OS_process_wait (arm);
- GNUNET_OS_process_destroy (arm);
- arm = NULL;
- }
-}
-
-
/**
* Re-establish the connection to the service.
*
if (privkey != NULL)
GNUNET_CRYPTO_rsa_key_free (privkey);
privkey = NULL;
-
- if (NULL != arm)
- stop_arm();
-
+ GNUNET_SCHEDULER_shutdown ();
res = 1;
}
privkey = NULL;
if (nsh != NULL)
+ {
GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES);
- nsh = NULL;
-
-
- if (NULL != arm)
- stop_arm();
-
+ nsh = NULL;
+ }
res = 0;
}
static void
put_cont (void *cls, int32_t success, const char *emsg)
{
- char * name = cls;
+ const char *name = cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Name store added record for `%s': %s\n", name, (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_CRYPTO_RsaSignature signature;
rd.data_size = TEST_RECORD_DATALEN;
rd.data = GNUNET_malloc(TEST_RECORD_DATALEN);
memset ((char *) rd.data, 'a', TEST_RECORD_DATALEN);
- start_arm (cfgfile);
- GNUNET_assert (arm != NULL);
nsh = GNUNET_NAMESTORE_connect (cfg);
GNUNET_break (NULL != nsh);
GNUNET_NAMESTORE_record_put (nsh, &pubkey, name,
- GNUNET_TIME_UNIT_FOREVER_ABS,
- 1, &rd, &signature, put_cont, name);
+ GNUNET_TIME_UNIT_FOREVER_ABS,
+ 1, &rd, &signature, &put_cont, (void*) name);
GNUNET_free ((void *)rd.data);
}
int
main (int argc, char *argv[])
{
- static char *const argv[] = { "test-namestore-api",
- "-c",
- "test_namestore_api.conf",
- NULL
- };
- static struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_END
- };
-
res = 1;
- GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, "test-namestore-api",
- "nohelp", options, &run, &res);
+ if (0 !=
+ GNUNET_TESTING_service_run ("test-namestore-api",
+ "namestore",
+ "test_namestore_api.conf",
+ &run,
+ NULL))
+ return 1;
return res;
}
#include "platform.h"
#include "gnunet_common.h"
#include "gnunet_namestore_service.h"
+#include "gnunet_testing_lib-new.h"
#include "namestore.h"
#define RECORDS 5
+
#define TEST_RECORD_TYPE 1234
+
#define TEST_RECORD_DATALEN 123
+
#define TEST_RECORD_DATA 'a'
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
+
static struct GNUNET_NAMESTORE_Handle * nsh;
static GNUNET_SCHEDULER_TaskIdentifier endbadly_task;
-static struct GNUNET_OS_Process *arm;
static struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
+
static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
static struct GNUNET_NAMESTORE_RecordData *s_rd;
static int res;
-static void
-start_arm (const char *cfgname)
-{
- arm = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
- "gnunet-service-arm", "-c", cfgname,
- NULL);
-}
-
-static void
-stop_arm ()
-{
- if (NULL != arm)
- {
- if (0 != GNUNET_OS_process_kill (arm, SIGTERM))
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
- GNUNET_OS_process_wait (arm);
- GNUNET_OS_process_destroy (arm);
- arm = NULL;
- }
-}
-
/**
* Re-establish the connection to the service.
*
nsh = NULL;
if (privkey != NULL)
+ {
GNUNET_CRYPTO_rsa_key_free (privkey);
- privkey = NULL;
-
- if (NULL != arm)
- stop_arm();
+ privkey = NULL;
+ }
+ GNUNET_SCHEDULER_shutdown ();
res = 1;
}
}
if (privkey != NULL)
+ {
GNUNET_CRYPTO_rsa_key_free (privkey);
- privkey = NULL;
-
+ privkey = NULL;
+ }
if (nsh != NULL)
+ {
GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES);
- nsh = NULL;
-
- if (NULL != arm)
- stop_arm();
+ nsh = NULL;
+ }
}
static void
put_cont (void *cls, int32_t success, const char *emsg)
{
- char * name = cls;
+ const char * name = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name store added record for `%s': %s\n", name, (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Name store added record for `%s': %s\n",
+ name, (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
if (success == GNUNET_OK)
res = 0;
else
res = 1;
-
- GNUNET_SCHEDULER_add_now(&end, NULL);
+ GNUNET_SCHEDULER_add_now (&end, NULL);
}
static struct GNUNET_NAMESTORE_RecordData *
create_record (int count)
{
- int c;
+ unsigned int c;
struct GNUNET_NAMESTORE_RecordData * rd;
- rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData));
+ rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData));
for (c = 0; c < RECORDS; c++)
{
- rd[c].expiration = GNUNET_TIME_absolute_get();
- rd[c].record_type = TEST_RECORD_TYPE;
- rd[c].data_size = TEST_RECORD_DATALEN;
- rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN);
- memset ((char *) rd[c].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN);
+ rd[c].expiration = GNUNET_TIME_absolute_get();
+ rd[c].record_type = TEST_RECORD_TYPE;
+ rd[c].data_size = TEST_RECORD_DATALEN;
+ rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN);
+ memset ((char *) rd[c].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN);
}
return rd;
}
static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_CRYPTO_RsaSignature *signature;
const char * s_name = "dummy.dummy.gnunet";
int c;
+ char *hostkey_file;
delete_existing_db(cfg);
endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL);
-
/* load privat key */
- char *hostkey_file;
GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR,
"N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
privkey = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file);
- GNUNET_free (hostkey_file);
-
GNUNET_assert (privkey != NULL);
+ GNUNET_free (hostkey_file);
/* get public key */
GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
-
- start_arm (cfgfile);
- GNUNET_assert (arm != NULL);
-
nsh = GNUNET_NAMESTORE_connect (cfg);
GNUNET_break (NULL != nsh);
-
/* create record */
s_rd = create_record (RECORDS);
-
signature = GNUNET_NAMESTORE_create_signature(privkey, s_rd[0].expiration, s_name, s_rd, RECORDS);
-
GNUNET_break (s_rd != NULL);
GNUNET_break (s_name != NULL);
-
GNUNET_NAMESTORE_record_put (nsh, &pubkey, s_name,
- GNUNET_TIME_UNIT_FOREVER_ABS,
- RECORDS, s_rd, signature, put_cont, s_name);
-
+ GNUNET_TIME_UNIT_FOREVER_ABS,
+ RECORDS, s_rd, signature, &put_cont, (void*) s_name);
GNUNET_free (signature);
-
for (c = 0; c < RECORDS; c++)
GNUNET_free_non_null((void *) s_rd[c].data);
GNUNET_free (s_rd);
-
}
int
main (int argc, char *argv[])
{
- static char *const argv[] = { "test-namestore-api",
- "-c",
- "test_namestore_api.conf",
- NULL
- };
- static struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_END
- };
-
res = 1;
- GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, "test-namestore-api",
- "nohelp", options, &run, &res);
+ if (0 != GNUNET_TESTING_service_run ("test-namestore-api-put",
+ "namestore",
+ "test_namestore_api.conf",
+ &run,
+ NULL))
+ return 1;
return res;
}
$(top_builddir)/src/hello/libgnunethello.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/transport/libgnunettransporttesting.la
-
+
test_transport_api_bidirectional_connect_SOURCES = \
test_transport_api_bidirectional_connect.c
test_transport_api_bidirectional_connect_LDADD = \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/transport/libgnunettransporttesting.la
-
+
test_transport_api_limited_sockets_tcp_SOURCES = \
test_transport_api_limited_sockets.c
test_transport_api_limited_sockets_tcp_LDADD = \
$(top_builddir)/src/hello/libgnunethello.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/transport/libgnunettransporttesting.la
-
+
test_transport_api_timeout_https_SOURCES = \
test_transport_api_timeout.c
test_transport_api_timeout_https_LDADD = \
$(top_builddir)/src/hello/libgnunethello.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/transport/libgnunettransporttesting.la
-
+
test_transport_api_reliability_tcp_nat_SOURCES = \
test_transport_api_reliability.c
test_transport_api_reliability_tcp_nat_LDADD = \
$(top_builddir)/src/hello/libgnunethello.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/transport/libgnunettransporttesting.la
-
+
test_transport_api_udp_SOURCES = \
test_transport_api.c
test_transport_api_udp_LDADD = \
$(top_builddir)/src/hello/libgnunethello.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/transport/libgnunettransporttesting.la
-
+
test_transport_api_timeout_udp_SOURCES = \
test_transport_api_timeout.c
test_transport_api_timeout_udp_LDADD = \
$(top_builddir)/src/hello/libgnunethello.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/transport/libgnunettransporttesting.la
-
- test_transport_api_http_nat_SOURCES = \
+
+test_transport_api_http_nat_SOURCES = \
test_transport_api.c
test_transport_api_http_nat_LDADD = \
$(top_builddir)/src/transport/libgnunettransport.la \
#include "gnunet_transport_plugin.h"
#include "transport.h"
-#define VERBOSE GNUNET_NO
-
/**
* How long until we give up on transmitting the message?
*/
"test_plugin_transport",
"-c",
"test_plugin_transport_data.conf",
- "-L",
-#if VERBOSE
- "DEBUG",
-#else
- "WARNING",
-#endif
+ "-L", "WARNING",
NULL
};
GNUNET_log_setup ("test-plugin-transport",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
ok = 1; /* set to fail */
ret =