gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: NEWS: GNUNET_TESTING_get_testname_from_u


From: gnunet
Subject: [gnunet] branch master updated: NEWS: GNUNET_TESTING_get_testname_from_underscore renamed to GNUNET_STRINGS_get_suffix_from_binary_name and moved from libgnunettesting to libgnuneutil
Date: Sat, 09 Sep 2023 13:37:05 +0200

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

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 3f5fd958a NEWS: GNUNET_TESTING_get_testname_from_underscore renamed to 
GNUNET_STRINGS_get_suffix_from_binary_name and moved from libgnunettesting to 
libgnuneutil
3f5fd958a is described below

commit 3f5fd958a855c28430d8f7ebfad11a674785821e
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Sep 9 13:36:36 2023 +0200

    NEWS: GNUNET_TESTING_get_testname_from_underscore renamed to 
GNUNET_STRINGS_get_suffix_from_binary_name and moved from libgnunettesting to 
libgnuneutil
---
 contrib/gana                                  |  2 +-
 contrib/sphinx                                |  2 +-
 src/datacache/perf_datacache.c                |  2 +-
 src/datacache/test_datacache.c                |  2 +-
 src/datacache/test_datacache_quota.c          |  2 +-
 src/datastore/perf_datastore_api.c            |  2 +-
 src/datastore/perf_plugin_datastore.c         |  2 +-
 src/datastore/test_datastore_api.c            |  2 +-
 src/datastore/test_datastore_api_management.c |  2 +-
 src/datastore/test_plugin_datastore.c         |  2 +-
 src/include/gnunet_strings_lib.h              | 21 ++++++++++--
 src/include/gnunet_testing_lib.h              | 17 ----------
 src/namecache/test_plugin_namecache.c         |  2 +-
 src/namestore/test_common.c                   |  4 +--
 src/namestore/test_plugin_namestore.c         |  2 +-
 src/peerstore/test_plugin_peerstore.c         |  2 +-
 src/testing/testing.c                         | 37 ++-------------------
 src/transport/test_communicator_basic.c       |  2 +-
 src/util/strings.c                            | 47 ++++++++++++++++++++++++---
 19 files changed, 80 insertions(+), 74 deletions(-)

diff --git a/contrib/gana b/contrib/gana
index 917f93ec9..c1dc2dc97 160000
--- a/contrib/gana
+++ b/contrib/gana
@@ -1 +1 @@
-Subproject commit 917f93ec912881e7e24d433a5b8fea05d140cd6f
+Subproject commit c1dc2dc975742c929a523c22d91f7d4f82787230
diff --git a/contrib/sphinx b/contrib/sphinx
index c70e38766..9c5b9d904 160000
--- a/contrib/sphinx
+++ b/contrib/sphinx
@@ -1 +1 @@
-Subproject commit c70e3876678be75d0d3c481aeeac42870d266dad
+Subproject commit 9c5b9d9040d21542eff792e26624cf9669b127aa
diff --git a/src/datacache/perf_datacache.c b/src/datacache/perf_datacache.c
index 84bc4a852..adbb958cc 100644
--- a/src/datacache/perf_datacache.c
+++ b/src/datacache/perf_datacache.c
@@ -160,7 +160,7 @@ main (int argc, char *argv[])
   GNUNET_log_setup ("perf-datacache",
                     "WARNING",
                     NULL);
-  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
   GNUNET_snprintf (cfg_name, sizeof(cfg_name), "perf_datacache_data_%s.conf",
                    plugin_name);
   GNUNET_PROGRAM_run ((sizeof(xargv) / sizeof(char *)) - 1, xargv,
diff --git a/src/datacache/test_datacache.c b/src/datacache/test_datacache.c
index 5392f6b17..a97a3f33c 100644
--- a/src/datacache/test_datacache.c
+++ b/src/datacache/test_datacache.c
@@ -182,7 +182,7 @@ main (int argc, char *argv[])
   GNUNET_log_setup ("test-datacache",
                     "WARNING",
                     NULL);
-  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
   GNUNET_snprintf (cfg_name,
                    sizeof(cfg_name),
                    "test_datacache_data_%s.conf",
diff --git a/src/datacache/test_datacache_quota.c 
b/src/datacache/test_datacache_quota.c
index 0ad7fb8a4..2cdff8083 100644
--- a/src/datacache/test_datacache_quota.c
+++ b/src/datacache/test_datacache_quota.c
@@ -170,7 +170,7 @@ main (int argc,
                     "WARNING",
                     NULL);
 
-  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
   GNUNET_snprintf (cfg_name,
                    sizeof(cfg_name),
                    "test_datacache_data_%s.conf",
diff --git a/src/datastore/perf_datastore_api.c 
b/src/datastore/perf_datastore_api.c
index fef38891e..f7d9fa544 100644
--- a/src/datastore/perf_datastore_api.c
+++ b/src/datastore/perf_datastore_api.c
@@ -610,7 +610,7 @@ main (int argc,
 {
   char cfg_name[PATH_MAX];
 
-  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
   GNUNET_snprintf (cfg_name,
                    sizeof(cfg_name),
                    "test_datastore_api_data_%s.conf",
diff --git a/src/datastore/perf_plugin_datastore.c 
b/src/datastore/perf_plugin_datastore.c
index d7488d4e7..8e63b08e6 100644
--- a/src/datastore/perf_plugin_datastore.c
+++ b/src/datastore/perf_plugin_datastore.c
@@ -550,7 +550,7 @@ main (int argc, char *argv[])
     GNUNET_GETOPT_OPTION_END
   };
 
-  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
   GNUNET_snprintf (dir_name, sizeof(dir_name), "/tmp/perf-gnunet-datastore-%s",
                    plugin_name);
   GNUNET_DISK_directory_remove (dir_name);
diff --git a/src/datastore/test_datastore_api.c 
b/src/datastore/test_datastore_api.c
index e72a6acd3..58a6b7a28 100644
--- a/src/datastore/test_datastore_api.c
+++ b/src/datastore/test_datastore_api.c
@@ -710,7 +710,7 @@ main (int argc,
   char cfg_name[PATH_MAX];
   int ret;
 
-  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
   GNUNET_snprintf (cfg_name,
                    sizeof(cfg_name),
                    "test_datastore_api_data_%s.conf",
diff --git a/src/datastore/test_datastore_api_management.c 
b/src/datastore/test_datastore_api_management.c
index 175765267..b9b134fbc 100644
--- a/src/datastore/test_datastore_api_management.c
+++ b/src/datastore/test_datastore_api_management.c
@@ -387,7 +387,7 @@ main (int argc, char *argv[])
   char cfg_name[PATH_MAX];
   int ret;
 
-  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
   GNUNET_snprintf (cfg_name,
                    sizeof(cfg_name),
                    "test_datastore_api_data_%s.conf",
diff --git a/src/datastore/test_plugin_datastore.c 
b/src/datastore/test_plugin_datastore.c
index 9fe2462e7..7de1acf2d 100644
--- a/src/datastore/test_plugin_datastore.c
+++ b/src/datastore/test_plugin_datastore.c
@@ -457,7 +457,7 @@ main (int argc, char *argv[])
   };
 
   /* determine name of plugin to use */
-  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
   GNUNET_snprintf (dir_name, sizeof(dir_name),
                    "/tmp/test-gnunet-datastore-plugin-%s", plugin_name);
   GNUNET_DISK_directory_remove (dir_name);
diff --git a/src/include/gnunet_strings_lib.h b/src/include/gnunet_strings_lib.h
index b751ef044..be41fb1d9 100644
--- a/src/include/gnunet_strings_lib.h
+++ b/src/include/gnunet_strings_lib.h
@@ -18,7 +18,7 @@
      SPDX-License-Identifier: AGPL3.0-or-later
  */
 
-#if !defined (__GNUNET_UTIL_LIB_H_INSIDE__)
+#if ! defined (__GNUNET_UTIL_LIB_H_INSIDE__)
 #error "Only <gnunet_util_lib.h> can be included directly."
 #endif
 
@@ -41,7 +41,7 @@
  * @{
  */
 
-#if !defined (__GNUNET_UTIL_LIB_H_INSIDE__)
+#if ! defined (__GNUNET_UTIL_LIB_H_INSIDE__)
 #error "Only <gnunet_util_lib.h> can be included directly."
 #endif
 
@@ -670,6 +670,23 @@ GNUNET_strlcpy (char *dst,
                 size_t n);
 
 
+/**
+ * Sometimes we use the binary name to determine which specific
+ * test to run.  In those cases, the string after the last "_"
+ * in 'argv[0]' specifies a string that determines the configuration
+ * file or plugin to use.
+ *
+ * This function returns the respective substring, taking care
+ * of issues such as binaries ending in '.exe' on W32.
+ *
+ * @param argv0 the name of the binary
+ * @return string between the last '_' and the '.exe' (or the end of the 
string),
+ *         NULL if argv0 has no '_'
+ */
+char *
+GNUNET_STRINGS_get_suffix_from_binary_name (const char *argv0);
+
+
 /* ***************** IPv4/IPv6 parsing ****************** */
 
 struct GNUNET_STRINGS_PortPolicy
diff --git a/src/include/gnunet_testing_lib.h b/src/include/gnunet_testing_lib.h
index cd9d88822..0d74de8c2 100644
--- a/src/include/gnunet_testing_lib.h
+++ b/src/include/gnunet_testing_lib.h
@@ -449,23 +449,6 @@ GNUNET_TESTING_service_run (const char *testdir,
                             void *tm_cls);
 
 
-/**
- * Sometimes we use the binary name to determine which specific
- * test to run.  In those cases, the string after the last "_"
- * in 'argv[0]' specifies a string that determines the configuration
- * file or plugin to use.
- *
- * This function returns the respective substring, taking care
- * of issues such as binaries ending in '.exe' on W32.
- *
- * @param argv0 the name of the binary
- * @return string between the last '_' and the '.exe' (or the end of the 
string),
- *         NULL if argv0 has no '_'
- */
-char *
-GNUNET_TESTING_get_testname_from_underscore (const char *argv0);
-
-
 #if 0                           /* keep Emacsens' auto-indent happy */
 {
 #endif
diff --git a/src/namecache/test_plugin_namecache.c 
b/src/namecache/test_plugin_namecache.c
index 242b3503b..141698a23 100644
--- a/src/namecache/test_plugin_namecache.c
+++ b/src/namecache/test_plugin_namecache.c
@@ -113,7 +113,7 @@ main (int argc, char *argv[])
     GNUNET_GETOPT_OPTION_END
   };
 
-  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
   GNUNET_snprintf (cfg_name, sizeof(cfg_name), "test_plugin_namecache_%s.conf",
                    plugin_name);
 
diff --git a/src/namestore/test_common.c b/src/namestore/test_common.c
index 60749a0b1..4df24a7f7 100644
--- a/src/namestore/test_common.c
+++ b/src/namestore/test_common.c
@@ -98,7 +98,7 @@ TNC_test_plugin (const char *cfg_name)
   do                                                                        \
   {                                                                         \
     GNUNET_log_setup (__FILE__, "WARNING", NULL);                           \
-    plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);    \
+    plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);    \
     GNUNET_asprintf (&cfg_name, file_template, plugin_name); \
     if (! TNC_test_plugin (cfg_name))                                       \
     {                                                                       \
@@ -116,7 +116,7 @@ TNC_test_plugin (const char *cfg_name)
   do                                                                        \
   {                                                                         \
     GNUNET_log_setup (__FILE__, "WARNING", NULL);                           \
-    plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);    \
+    plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);    \
     GNUNET_asprintf (&cfg_name, "test_namestore_api_%s.conf", plugin_name); \
     if (! TNC_test_plugin (cfg_name))                                       \
     {                                                                       \
diff --git a/src/namestore/test_plugin_namestore.c 
b/src/namestore/test_plugin_namestore.c
index b89cc95d0..d82a3d349 100644
--- a/src/namestore/test_plugin_namestore.c
+++ b/src/namestore/test_plugin_namestore.c
@@ -195,7 +195,7 @@ main (int argc, char *argv[])
   { GNUNET_GETOPT_OPTION_END };
 
   GNUNET_log_setup ("test-plugin-namestore", "WARNING", NULL);
-  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
   GNUNET_snprintf (cfg_name,
                    sizeof(cfg_name),
                    "test_plugin_namestore_%s.conf",
diff --git a/src/peerstore/test_plugin_peerstore.c 
b/src/peerstore/test_plugin_peerstore.c
index a4221ea63..bce62dda9 100644
--- a/src/peerstore/test_plugin_peerstore.c
+++ b/src/peerstore/test_plugin_peerstore.c
@@ -201,7 +201,7 @@ main (int argc, char *argv[])
   GNUNET_log_setup ("test-plugin-peerstore",
                     "WARNING",
                     NULL);
-  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  plugin_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
   GNUNET_snprintf (cfg_name,
                    sizeof(cfg_name),
                    "test_plugin_peerstore_%s.conf",
diff --git a/src/testing/testing.c b/src/testing/testing.c
index e360d7083..fdfa80d87 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -272,7 +272,7 @@ struct GNUNET_TESTING_Peer
  * @param system the testing system handle
  * @return #GNUNET_OK on success; #GNUNET_SYSERR on error
  */
-static int
+static enum GNUNET_GenericReturnValue
 hostkeys_load (struct GNUNET_TESTING_System *system)
 {
   uint64_t fs;
@@ -505,7 +505,7 @@ cleanup_shared_service_instance (struct 
SharedServiceInstance *i)
 }
 
 
-static int
+static enum GNUNET_GenericReturnValue
 start_shared_service_instance (struct SharedServiceInstance *i)
 {
   char *binary;
@@ -1721,39 +1721,6 @@ GNUNET_TESTING_service_run (const char *testdir,
 }
 
 
-/**
- * Sometimes we use the binary name to determine which specific
- * test to run.  In those cases, the string after the last "_"
- * in 'argv[0]' specifies a string that determines the configuration
- * file or plugin to use.
- *
- * This function returns the respective substring, taking care
- * of issues such as binaries ending in '.exe' on W32.
- *
- * @param argv0 the name of the binary
- * @return string between the last '_' and the '.exe' (or the end of the 
string),
- *         NULL if argv0 has no '_'
- */
-char *
-GNUNET_TESTING_get_testname_from_underscore (const char *argv0)
-{
-  size_t slen = strlen (argv0) + 1;
-  char sbuf[slen];
-  char *ret;
-  char *dot;
-
-  GNUNET_memcpy (sbuf, argv0, slen);
-  ret = strrchr (sbuf, '_');
-  if (NULL == ret)
-    return NULL;
-  ret++; /* skip underscore */
-  dot = strchr (ret, '.');
-  if (NULL != dot)
-    *dot = '\0';
-  return GNUNET_strdup (ret);
-}
-
-
 /**
  * Every line in the topology configuration starts with a string indicating 
which
  * kind of information will be configured with this line. Configuration values 
following
diff --git a/src/transport/test_communicator_basic.c 
b/src/transport/test_communicator_basic.c
index 713275fd3..fdbad0957 100644
--- a/src/transport/test_communicator_basic.c
+++ b/src/transport/test_communicator_basic.c
@@ -1095,7 +1095,7 @@ main (int argc,
   phase[0] = TP_INIT;
   phase[1] = TP_INIT;
   ret = 1;
-  test_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+  test_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
   communicator_name = strchr (test_name, '-');
   communicator_name[0] = '\0';
   communicator_name++;
diff --git a/src/util/strings.c b/src/util/strings.c
index 479c0fcd6..86323bc83 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -1859,11 +1859,18 @@ GNUNET_STRINGS_urlencode (const char *data,
     if (0 == (0x80 & *i8))
     {
       /* traditional ASCII */
-      if (isalnum (*i8) || (*i8 == '-') || (*i8 == '_') || (*i8 == '.') ||
-          (*i8 == '~') )
-        GNUNET_buffer_write (&buf, (const char*) i8, 1);
+      if ( isalnum (*i8) ||
+           (*i8 == '-') ||
+           (*i8 == '_') ||
+           (*i8 == '.') ||
+           (*i8 == '~') )
+        GNUNET_buffer_write (&buf,
+                             (const char*) i8,
+                             1);
       else if (*i8 == ' ')
-        GNUNET_buffer_write (&buf, "+", 1);
+        GNUNET_buffer_write (&buf,
+                             "+",
+                             1);
       else
         GNUNET_buffer_write_fstr (&buf,
                                   "%%%X%X",
@@ -1952,4 +1959,36 @@ GNUNET_STRINGS_urlencode (const char *data,
 }
 
 
+/**
+ * Sometimes we use the binary name to determine which specific
+ * test to run.  In those cases, the string after the last "_"
+ * in 'argv[0]' specifies a string that determines the configuration
+ * file or plugin to use.
+ *
+ * This function returns the respective substring, taking care
+ * of issues such as binaries ending in '.exe' on W32.
+ *
+ * @param argv0 the name of the binary
+ * @return string between the last '_' and the '.exe' (or the end of the 
string),
+ *         NULL if argv0 has no '_'
+ */
+char *
+GNUNET_STRINGS_get_suffix_from_binary_name (const char *argv0)
+{
+  const char *ret;
+  const char *dot;
+
+  ret = strrchr (argv0, '_');
+  if (NULL == ret)
+    return NULL;
+  ret++; /* skip underscore */
+  dot = strchr (ret,
+                '.');
+  if (NULL != dot)
+    return GNUNET_strndup (ret,
+                           dot - ret);
+  return GNUNET_strdup (ret);
+}
+
+
 /* end of strings.c */

-- 
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]