aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-08-27 00:35:01 +0200
committerChristian Grothoff <christian@grothoff.org>2024-08-27 00:35:11 +0200
commit740194aaa7201f5d294a7de4c92b417b83279d86 (patch)
tree4e71a6dbc9e597b4914ee8595775a335eea45029
parent37ea1398bbdbd2ee297b445fab0c919f0d32bb79 (diff)
-style fixes
-rw-r--r--src/exchange-tools/taler-exchange-offline.c11
-rw-r--r--src/include/taler_twister_testing_lib.h24
-rw-r--r--src/lib/exchange_api_get_kyc_statistics.c2
-rw-r--r--src/lib/exchange_api_management_get_keys.c4
-rw-r--r--src/lib/exchange_api_stefan.c4
-rw-r--r--src/testing/testing_api_cmd_age_withdraw.c19
-rw-r--r--src/testing/testing_api_cmd_deposit.c23
-rw-r--r--src/testing/testing_api_cmd_refresh.c6
-rw-r--r--src/testing/testing_api_cmd_signal.c19
-rw-r--r--src/testing/testing_api_cmd_take_aml_decision.c4
-rw-r--r--src/testing/testing_api_cmd_twister_exec_client.c39
-rw-r--r--src/testing/testing_api_loop.c9
-rw-r--r--src/testing/testing_api_twister_helpers.c2
-rw-r--r--src/util/test_age_restriction.c17
-rw-r--r--src/util/test_url.c10
15 files changed, 113 insertions, 80 deletions
diff --git a/src/exchange-tools/taler-exchange-offline.c b/src/exchange-tools/taler-exchange-offline.c
index 1f10c55e3..023c59390 100644
--- a/src/exchange-tools/taler-exchange-offline.c
+++ b/src/exchange-tools/taler-exchange-offline.c
@@ -2160,7 +2160,7 @@ upload_keys (const char *exchange_url,
struct TALER_EXCHANGE_SigningKeySignature *ss = &pkd.sign_sigs[i];
json_t *val = json_array_get (signkey_sigs,
i);
- struct GNUNET_JSON_Specification spec[] = {
+ struct GNUNET_JSON_Specification ispec[] = {
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
&ss->exchange_pub),
GNUNET_JSON_spec_fixed_auto ("master_sig",
@@ -2170,7 +2170,7 @@ upload_keys (const char *exchange_url,
if (GNUNET_OK !=
GNUNET_JSON_parse (val,
- spec,
+ ispec,
&err_name,
&err_line))
{
@@ -2190,7 +2190,7 @@ upload_keys (const char *exchange_url,
struct TALER_EXCHANGE_DenominationKeySignature *ds = &pkd.denom_sigs[i];
json_t *val = json_array_get (denom_sigs,
i);
- struct GNUNET_JSON_Specification spec[] = {
+ struct GNUNET_JSON_Specification ispec[] = {
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
&ds->h_denom_pub),
GNUNET_JSON_spec_fixed_auto ("master_sig",
@@ -2200,7 +2200,7 @@ upload_keys (const char *exchange_url,
if (GNUNET_OK !=
GNUNET_JSON_parse (val,
- spec,
+ ispec,
&err_name,
&err_line))
{
@@ -3314,7 +3314,8 @@ do_del_wire (char *const *args)
if (NULL != in)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Downloaded data was not consumed, not deleting wire account\n");
+ "Downloaded data was not consumed, not deleting wire account\n")
+ ;
GNUNET_SCHEDULER_shutdown ();
global_ret = EXIT_FAILURE;
return;
diff --git a/src/include/taler_twister_testing_lib.h b/src/include/taler_twister_testing_lib.h
index cdafab04b..711d6b652 100644
--- a/src/include/taler_twister_testing_lib.h
+++ b/src/include/taler_twister_testing_lib.h
@@ -29,7 +29,29 @@
#include "taler_testing_lib.h"
#define TWISTER_FAIL() \
- do {GNUNET_break (0); return NULL; } while (0)
+ do {GNUNET_break (0); return NULL; } while (0)
+
+
+/**
+ * Prepare twister for execution; mainly checks whether the
+ * HTTP port is available and construct the base URL based on it.
+ *
+ * @param config_filename configuration file name.
+ * @return twister base URL, NULL upon errors.
+ */
+char *
+TALER_TWISTER_prepare_twister (const char *config_filename);
+
+
+/**
+ * Run the twister service.
+ *
+ * @param config_filename configuration file name.
+ * @return twister process handle, NULL upon errors.
+ */
+struct GNUNET_OS_Process *
+TALER_TWISTER_run_twister (const char *config_filename);
+
/**
* Define a "hack response code" CMD. This causes the next
diff --git a/src/lib/exchange_api_get_kyc_statistics.c b/src/lib/exchange_api_get_kyc_statistics.c
index d029e44b5..4183e9118 100644
--- a/src/lib/exchange_api_get_kyc_statistics.c
+++ b/src/lib/exchange_api_get_kyc_statistics.c
@@ -182,7 +182,7 @@ handle_lookup_finished (void *cls,
struct TALER_EXCHANGE_KycGetStatisticsHandle *
-TALER_EXCHANGE_get_kyc_statistics (
+TALER_EXCHANGE_kyc_get_statistics (
struct GNUNET_CURL_Context *ctx,
const char *exchange_url,
const char *name,
diff --git a/src/lib/exchange_api_management_get_keys.c b/src/lib/exchange_api_management_get_keys.c
index b88ddc205..9ad59f3f8 100644
--- a/src/lib/exchange_api_management_get_keys.c
+++ b/src/lib/exchange_api_management_get_keys.c
@@ -176,7 +176,7 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
struct TALER_EXCHANGE_FutureDenomPublicKey *denom_key
= &fk->denom_keys[i];
const char *section_name;
- struct GNUNET_JSON_Specification spec[] = {
+ struct GNUNET_JSON_Specification ispec[] = {
TALER_JSON_spec_amount_any ("value",
&denom_key->value),
GNUNET_JSON_spec_timestamp ("stamp_start",
@@ -206,7 +206,7 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
if (GNUNET_OK !=
GNUNET_JSON_parse (j,
- spec,
+ ispec,
NULL, NULL))
{
GNUNET_break_op (0);
diff --git a/src/lib/exchange_api_stefan.c b/src/lib/exchange_api_stefan.c
index 226bca82f..437e78c8b 100644
--- a/src/lib/exchange_api_stefan.c
+++ b/src/lib/exchange_api_stefan.c
@@ -125,7 +125,7 @@ TALER_EXCHANGE_keys_stefan_b2n (
min = get_unit (keys);
if (NULL == min)
return GNUNET_SYSERR;
- if (1.0f <= keys->stefan_lin)
+ if (1.0d <= keys->stefan_lin)
{
/* This cannot work, linear STEFAN fee estimate always
exceed any gross amount. */
@@ -273,7 +273,7 @@ TALER_EXCHANGE_keys_stefan_n2b (
min = get_unit (keys);
if (NULL == min)
return GNUNET_SYSERR;
- if (1.0f <= keys->stefan_lin)
+ if (1.0d <= keys->stefan_lin)
{
/* This cannot work, linear STEFAN fee estimate always
exceed any gross amount. */
diff --git a/src/testing/testing_api_cmd_age_withdraw.c b/src/testing/testing_api_cmd_age_withdraw.c
index ed08773c7..3192fc9b1 100644
--- a/src/testing/testing_api_cmd_age_withdraw.c
+++ b/src/testing/testing_api_cmd_age_withdraw.c
@@ -742,16 +742,17 @@ TALER_TESTING_cmd_age_withdraw_reveal (
awrs->age_withdraw_reference = age_withdraw_reference;
awrs->expected_response_code = expected_response_code;
+ {
+ struct TALER_TESTING_Command cmd = {
+ .cls = awrs,
+ .label = label,
+ .run = age_withdraw_reveal_run,
+ .cleanup = age_withdraw_reveal_cleanup,
+ .traits = age_withdraw_reveal_traits,
+ };
- struct TALER_TESTING_Command cmd = {
- .cls = awrs,
- .label = label,
- .run = age_withdraw_reveal_run,
- .cleanup = age_withdraw_reveal_cleanup,
- .traits = age_withdraw_reveal_traits,
- };
-
- return cmd;
+ return cmd;
+ }
}
diff --git a/src/testing/testing_api_cmd_deposit.c b/src/testing/testing_api_cmd_deposit.c
index 849c78c70..2467488ea 100644
--- a/src/testing/testing_api_cmd_deposit.c
+++ b/src/testing/testing_api_cmd_deposit.c
@@ -38,7 +38,7 @@
* How long do we wait AT MOST when retrying?
*/
#define MAX_BACKOFF GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_MILLISECONDS, 100)
+ GNUNET_TIME_UNIT_MILLISECONDS, 100)
/**
@@ -342,18 +342,18 @@ deposit_run (void *cls,
if (NULL != ds->deposit_reference)
{
/* We're copying another deposit operation, initialize here. */
- const struct TALER_TESTING_Command *cmd;
+ const struct TALER_TESTING_Command *drcmd;
struct DepositState *ods;
- cmd = TALER_TESTING_interpreter_lookup_command (is,
- ds->deposit_reference);
- if (NULL == cmd)
+ drcmd = TALER_TESTING_interpreter_lookup_command (is,
+ ds->deposit_reference);
+ if (NULL == drcmd)
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (is);
return;
}
- ods = cmd->cls;
+ ods = drcmd->cls;
ds->coin_reference = ods->coin_reference;
ds->coin_index = ods->coin_index;
ds->wire_details = json_incref (ods->wire_details);
@@ -370,18 +370,19 @@ deposit_run (void *cls,
{
/* We're copying the merchant key from another deposit operation */
const struct TALER_MerchantPrivateKeyP *merchant_priv;
- const struct TALER_TESTING_Command *cmd;
+ const struct TALER_TESTING_Command *mpcmd;
- cmd = TALER_TESTING_interpreter_lookup_command (is,
- ds->merchant_priv_reference);
- if (NULL == cmd)
+ mpcmd = TALER_TESTING_interpreter_lookup_command (
+ is,
+ ds->merchant_priv_reference);
+ if (NULL == mpcmd)
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (is);
return;
}
if ( (GNUNET_OK !=
- TALER_TESTING_get_trait_merchant_priv (cmd,
+ TALER_TESTING_get_trait_merchant_priv (mpcmd,
&merchant_priv)) )
{
GNUNET_break (0);
diff --git a/src/testing/testing_api_cmd_refresh.c b/src/testing/testing_api_cmd_refresh.c
index 111e9118f..9d58422c7 100644
--- a/src/testing/testing_api_cmd_refresh.c
+++ b/src/testing/testing_api_cmd_refresh.c
@@ -32,7 +32,7 @@
* How long do we wait AT MOST when retrying?
*/
#define MAX_BACKOFF GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_MILLISECONDS, 100)
+ GNUNET_TIME_UNIT_MILLISECONDS, 100)
/**
* How often do we retry before giving up?
@@ -43,7 +43,7 @@
* How long do we wait AT MOST when retrying?
*/
#define MAX_BACKOFF GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_MILLISECONDS, 100)
+ GNUNET_TIME_UNIT_MILLISECONDS, 100)
/**
* Information about a fresh coin generated by the refresh
@@ -800,6 +800,7 @@ refresh_link_run (void *cls,
const struct TALER_TESTING_Command *melt_cmd;
const struct TALER_TESTING_Command *coin_cmd;
const char *exchange_url;
+ const struct TALER_CoinSpendPrivateKeyP *coin_priv;
rls->cmd = cmd;
rls->is = is;
@@ -839,7 +840,6 @@ refresh_link_run (void *cls,
return;
}
- const struct TALER_CoinSpendPrivateKeyP *coin_priv;
if (GNUNET_OK !=
TALER_TESTING_get_trait_coin_priv (coin_cmd,
0,
diff --git a/src/testing/testing_api_cmd_signal.c b/src/testing/testing_api_cmd_signal.c
index be3a58bdd..578c95cb2 100644
--- a/src/testing/testing_api_cmd_signal.c
+++ b/src/testing/testing_api_cmd_signal.c
@@ -102,13 +102,14 @@ TALER_TESTING_cmd_signal (const char *label,
ss->process = process;
ss->signal = signal;
-
- struct TALER_TESTING_Command cmd = {
- .cls = ss,
- .label = label,
- .run = &signal_run,
- .cleanup = &signal_cleanup
- };
-
- return cmd;
+ {
+ struct TALER_TESTING_Command cmd = {
+ .cls = ss,
+ .label = label,
+ .run = &signal_run,
+ .cleanup = &signal_cleanup
+ };
+
+ return cmd;
+ }
}
diff --git a/src/testing/testing_api_cmd_take_aml_decision.c b/src/testing/testing_api_cmd_take_aml_decision.c
index e61c03efa..b3976b82e 100644
--- a/src/testing/testing_api_cmd_take_aml_decision.c
+++ b/src/testing/testing_api_cmd_take_aml_decision.c
@@ -368,9 +368,9 @@ take_aml_decision_run (void *cls,
officer_priv,
&take_aml_decision_cb,
ds);
- for (unsigned int i = 0; i<num_rules; i++)
+ for (unsigned int j = 0; j<num_rules; j++)
{
- struct TALER_EXCHANGE_AccountRule *rule = &rules[i];
+ struct TALER_EXCHANGE_AccountRule *rule = &rules[j];
GNUNET_free (rule->measures);
}
diff --git a/src/testing/testing_api_cmd_twister_exec_client.c b/src/testing/testing_api_cmd_twister_exec_client.c
index bf83c1f80..eccd8b23a 100644
--- a/src/testing/testing_api_cmd_twister_exec_client.c
+++ b/src/testing/testing_api_cmd_twister_exec_client.c
@@ -523,16 +523,17 @@ TALER_TESTING_cmd_delete_object (const char *label,
dos = GNUNET_new (struct DeleteObjectState);
dos->path = path;
dos->config_filename = config_filename;
+ {
+ struct TALER_TESTING_Command cmd = {
+ .label = label,
+ .run = &delete_object_run,
+ .cleanup = &delete_object_cleanup,
+ .traits = &delete_object_traits,
+ .cls = dos
+ };
- struct TALER_TESTING_Command cmd = {
- .label = label,
- .run = &delete_object_run,
- .cleanup = &delete_object_cleanup,
- .traits = &delete_object_traits,
- .cls = dos
- };
-
- return cmd;
+ return cmd;
+ }
}
@@ -901,17 +902,17 @@ TALER_TESTING_cmd_malform_response (const char *label,
mrs = GNUNET_new (struct MalformResponseState);
mrs->config_filename = config_filename;
+ {
+ struct TALER_TESTING_Command cmd = {
+ .label = label,
+ .run = &malform_response_run,
+ .cleanup = &malform_response_cleanup,
+ .traits = &malform_response_traits,
+ .cls = mrs
+ };
- struct TALER_TESTING_Command cmd = {
- .label = label,
- .run = &malform_response_run,
- .cleanup = &malform_response_cleanup,
- .traits = &malform_response_traits,
- .cls = mrs
- };
-
- return cmd;
-
+ return cmd;
+ }
}
diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c
index 958b3b5df..00126b3e7 100644
--- a/src/testing/testing_api_loop.c
+++ b/src/testing/testing_api_loop.c
@@ -829,14 +829,15 @@ rewind_ip_run (void *cls,
NULL != is->commands[new_ip].label;
new_ip++)
{
- const struct TALER_TESTING_Command *cmd = &is->commands[new_ip];
+ const struct TALER_TESTING_Command *ipcmd
+ = &is->commands[new_ip];
- if (cmd == target)
+ if (ipcmd == target)
break;
- if (TALER_TESTING_cmd_is_batch (cmd))
+ if (TALER_TESTING_cmd_is_batch (ipcmd))
{
int ret = seek_batch (is,
- cmd,
+ ipcmd,
target);
if (GNUNET_SYSERR == ret)
return; /* failure! */
diff --git a/src/testing/testing_api_twister_helpers.c b/src/testing/testing_api_twister_helpers.c
index 68fbf0082..d5f61e87c 100644
--- a/src/testing/testing_api_twister_helpers.c
+++ b/src/testing/testing_api_twister_helpers.c
@@ -23,11 +23,11 @@
* @author Christian Grothoff
* @author Marcello Stanisci
*/
-
#include "platform.h"
#include <gnunet/gnunet_util_lib.h>
#include "taler_twister_testing_lib.h"
+
/**
* Prepare twister for execution; mainly checks whether the
* HTTP port is available and construct the base URL based on it.
diff --git a/src/util/test_age_restriction.c b/src/util/test_age_restriction.c
index 61499e5e0..0d87926d4 100644
--- a/src/util/test_age_restriction.c
+++ b/src/util/test_age_restriction.c
@@ -30,7 +30,7 @@
* @return String representation of the age mask, allocated by GNUNET_malloc.
* Can be used as value in the TALER config.
*/
-char *
+static char *
age_mask_to_string (
const struct TALER_AgeMask *m)
{
@@ -68,7 +68,7 @@ age_mask_to_string (
}
-enum GNUNET_GenericReturnValue
+static enum GNUNET_GenericReturnValue
test_groups (void)
{
struct
@@ -129,7 +129,7 @@ test_groups (void)
}
-enum GNUNET_GenericReturnValue
+static enum GNUNET_GenericReturnValue
test_dates (void)
{
struct TALER_AgeMask mask = {
@@ -137,7 +137,7 @@ test_dates (void)
};
struct
{
- char *date;
+ const char *date;
uint32_t expected;
enum GNUNET_GenericReturnValue ret;
}
@@ -174,7 +174,7 @@ test_dates (void)
{
uint32_t d;
enum GNUNET_GenericReturnValue ret;
- char *date = test[t].date;
+ const char *date = test[t].date;
if (NULL == test[t].date)
{
@@ -224,7 +224,7 @@ test_dates (void)
}
-enum GNUNET_GenericReturnValue
+static enum GNUNET_GenericReturnValue
test_lowest (void)
{
struct TALER_AgeMask mask = {
@@ -270,7 +270,7 @@ test_lowest (void)
}
-enum GNUNET_GenericReturnValue
+static enum GNUNET_GenericReturnValue
test_adult (void)
{
struct { struct TALER_AgeMask mask; uint8_t expected; }
@@ -304,7 +304,8 @@ static struct TALER_AgeMask age_mask = {
.bits = 1 | 1 << 8 | 1 << 10 | 1 << 12 | 1 << 14 | 1 << 16 | 1 << 18 | 1 << 21
};
-enum GNUNET_GenericReturnValue
+
+static enum GNUNET_GenericReturnValue
test_attestation (void)
{
uint8_t age;
diff --git a/src/util/test_url.c b/src/util/test_url.c
index 029302993..f5e6ff4ee 100644
--- a/src/util/test_url.c
+++ b/src/util/test_url.c
@@ -30,11 +30,15 @@
* @param expected expected input
*/
static void
-cf (char *input, char *expected)
+cf (char *input,
+ const char *expected)
{
- if (0 != strcmp (input, expected))
+ if (0 != strcmp (input,
+ expected))
{
- printf ("got '%s' but expected '%s'\n", input, expected);
+ printf ("got '%s' but expected '%s'\n",
+ input,
+ expected);
GNUNET_assert (0);
}
GNUNET_free (input);