gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-merchant] 01/04: renaming generator into taler-merch


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] 01/04: renaming generator into taler-merchant-benchmark
Date: Tue, 03 Jul 2018 12:07:40 +0200

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

marcello pushed a commit to branch master
in repository merchant.

commit 83359f4a182c20034b339be387ade30a50faaeb6
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue Jul 3 11:25:21 2018 +0200

    renaming generator into taler-merchant-benchmark
---
 src/merchant-tools/Makefile.am                     |  29 +----
 ...erate-payments.c => taler-merchant-benchmark.c} | 141 ++++++++++++++++++++-
 .../taler-merchant-generate-payments-alt.c         |   9 +-
 3 files changed, 145 insertions(+), 34 deletions(-)

diff --git a/src/merchant-tools/Makefile.am b/src/merchant-tools/Makefile.am
index 24337c8..4533c0b 100644
--- a/src/merchant-tools/Makefile.am
+++ b/src/merchant-tools/Makefile.am
@@ -3,8 +3,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/include
 
 bin_PROGRAMS = \
   taler-merchant-dbinit \
-  taler-merchant-generate-payments \
-  taler-merchant-generate-payments-alt
+  taler-merchant-generate-payments
 
 taler_merchant_dbinit_SOURCES = \
   taler-merchant-dbinit.c
@@ -16,30 +15,10 @@ taler_merchant_dbinit_LDADD = \
   -ltalerutil \
   -ltalerpq
 
-taler_merchant_generate_payments_alt_SOURCES = \
-  taler-merchant-generate-payments-alt.c
+taler_merchant_benchmark_SOURCES = \
+  taler-merchant-benchmark.c
 
-taler_merchant_generate_payments_alt_LDADD = \
-  $(top_srcdir)/src/backenddb/libtalermerchantdb.la \
-  $(top_srcdir)/src/lib/libtalermerchant.la \
-  $(top_srcdir)/src/lib/libtalermerchanttesting.la \
-  $(LIBGCRYPT_LIBS) \
-  -ltalertesting \
-  -ltalerfakebank \
-  -ltalerbank \
-  -ltalerbanktesting \
-  -ltalerexchange \
-  -ltalerjson \
-  -ltalerutil \
-  -lgnunetjson \
-  -lgnunetcurl \
-  -lgnunetutil \
-  -ljansson
-
-taler_merchant_generate_payments_SOURCES = \
-  taler-merchant-generate-payments.c
-
-taler_merchant_generate_payments_LDADD = \
+taler_merchant_benchmark_LDADD = \
   $(top_srcdir)/src/backenddb/libtalermerchantdb.la \
   $(top_srcdir)/src/lib/libtalermerchant.la \
   $(top_srcdir)/src/lib/libtalermerchanttesting.la \
diff --git a/src/merchant-tools/taler-merchant-generate-payments.c 
b/src/merchant-tools/taler-merchant-benchmark.c
similarity index 81%
rename from src/merchant-tools/taler-merchant-generate-payments.c
rename to src/merchant-tools/taler-merchant-benchmark.c
index 93cd132..61d7204 100644
--- a/src/merchant-tools/taler-merchant-generate-payments.c
+++ b/src/merchant-tools/taler-merchant-benchmark.c
@@ -69,6 +69,26 @@ enum PaymentGeneratorError {
      USER_LOGIN_NAME, USER_LOGIN_PASS, EXCHANGE_URL)
 
 /**
+ * Help string shown if NO subcommand is given on command line.
+ */
+char *root_help;
+
+/**
+ * Alternative non default instance.
+ */
+static char *alt_instance;
+
+/**
+ * How many unaggregated payments we want to generate.
+ */
+static unsigned int unaggregated_number = 1;
+
+/**
+ * How many payments that use two coins we want to generate.
+ */
+static unsigned int twocoins_number = 1;
+
+/**
  * Exit code.
  */
 static unsigned int result;
@@ -413,7 +433,95 @@ main (int argc,
   default_config_file = GNUNET_OS_project_data_get
     ()->user_config_file;
 
-  struct GNUNET_GETOPT_CommandLineOption options[] = {
+
+  struct GNUNET_GETOPT_CommandLineOption root[] = {
+
+    GNUNET_GETOPT_option_cfgfile
+      (&cfg_filename),
+
+    GNUNET_GETOPT_option_version
+      (PACKAGE_VERSION " " VCS_VERSION),
+
+    GNUNET_GETOPT_option_string
+      ('h',
+       "help",
+       NULL,
+       "root help TBW",
+       &root_help),
+
+    GNUNET_GETOPT_OPTION_END
+  };
+
+  struct GNUNET_GETOPT_CommandLineOption corner[] = {
+
+    GNUNET_GETOPT_option_help
+      ("Populate databases with corner case payments"),
+
+    GNUNET_GETOPT_option_loglevel
+      (&loglev),
+
+    GNUNET_GETOPT_option_uint
+      ('u',
+       "unaggregated-number",
+       "UN",
+       "will generate UN unaggregated payments, defaults to 1",
+       &unaggregated_number),
+
+    GNUNET_GETOPT_option_uint
+      ('t',
+       "two-coins",
+       "TC",
+       "will perform TC 2-coins payments, defaults to 1",
+       &twocoins_number),
+
+    /**
+     * NOTE: useful when the setup serves merchant
+     * backends via unix domain sockets, since there
+     * is no way - yet? - to get the merchant base url.
+     * Clearly, we could introduce a merchant_base_url
+     * value into the configuration.
+     */
+    GNUNET_GETOPT_option_string
+      ('m',
+       "merchant-url",
+       "MU",
+       "merchant base url, mandatory",
+       &merchant_url),
+
+    GNUNET_GETOPT_option_string
+      ('i',
+       "alt-instance",
+       "AI",
+       "alternative (non default) instance,"
+       " used to provide fresh wire details to"
+       " make unaggregated transactions stay so."
+       " Note, this instance will be given far"
+       " future wire deadline, and so it should"
+       " never author now-deadlined transactions,"
+       " as they would get those far future ones"
+       " aggregated too.",
+       &alt_instance),
+
+    GNUNET_GETOPT_option_string
+      ('b',
+       "bank-url",
+       "BU",
+       "bank base url, mandatory",
+       &bank_url),
+
+    GNUNET_GETOPT_option_string
+      ('l',
+       "logfile",
+       "LF",
+       "will log to file LF",
+       &logfile),
+
+    GNUNET_GETOPT_OPTION_END
+
+
+  };
+
+  struct GNUNET_GETOPT_CommandLineOption ordinary[] = {
 
     GNUNET_GETOPT_option_cfgfile
       (&cfg_filename),
@@ -474,17 +582,44 @@ main (int argc,
 
   result = GNUNET_GETOPT_run
     ("taler-merchant-generate-payments",
-     options,
+     root,
      argc,
      argv);
 
+  if (root_help)
+  {
+    fprintf (stderr, "Main/root help string\n"); 
+    return 0; 
+  }
+
   if (GNUNET_NO == result)
   {
-    /* --help or --version were given, just return.  */ 
+    /* --version was given, just return.  */ 
     return 0;
   }
 
   GNUNET_assert (GNUNET_SYSERR != result);
+
+  /* extract subcommand.  */
+  if (0 == strcmp ("ordinary", argv[result]))
+  {
+    TALER_LOG_DEBUG ("'ordinary' subcommand found\n"); 
+    return 0; // DEBUGGISH 
+  }
+  else if (0 == strcmp ("corner", argv[result]))
+  {
+    TALER_LOG_DEBUG ("'corner' subcommand found\n"); 
+    return 0; // DEBUGGISH 
+  }
+  else
+  {
+    TALER_LOG_ERROR ("Unknown subcommand given.\n"); 
+    return 1;  
+  }
+
+  return 0;
+
+  GNUNET_assert (GNUNET_SYSERR != result);
   loglev = NULL;
   GNUNET_log_setup ("taler-merchant-generate-payments",
                     loglev,
diff --git a/src/merchant-tools/taler-merchant-generate-payments-alt.c 
b/src/merchant-tools/taler-merchant-generate-payments-alt.c
index 0ff9976..d8184a8 100644
--- a/src/merchant-tools/taler-merchant-generate-payments-alt.c
+++ b/src/merchant-tools/taler-merchant-generate-payments-alt.c
@@ -451,15 +451,12 @@ main (int argc,
 
   result = GNUNET_GETOPT_run
     ("taler-merchant-generate-payments-alt",
-     options,
+     root,
      argc,
      argv);
 
-  if (GNUNET_NO == result)
-  {
-    /* --help or --version were given, just return.  */ 
-    return 0;
-  }
+
+  return 0;
 
   GNUNET_assert (GNUNET_SYSERR != result);
   loglev = NULL;

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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