gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: meson: add datacache tests; improve test


From: gnunet
Subject: [gnunet] branch master updated: meson: add datacache tests; improve test return values
Date: Mon, 16 Oct 2023 16:23:50 +0200

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 ceee98d58 meson: add datacache tests; improve test return values
ceee98d58 is described below

commit ceee98d58fd06c7e86397c41c0af7e1788f8b202
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Mon Oct 16 16:23:45 2023 +0200

    meson: add datacache tests; improve test return values
---
 src/datacache/meson.build            | 122 ++++++++++++++++++++++++++++++++++-
 src/datacache/perf_datacache.c       |   9 ++-
 src/datacache/test_datacache.c       |  18 ++++--
 src/datacache/test_datacache_quota.c |  19 ++++--
 4 files changed, 151 insertions(+), 17 deletions(-)

diff --git a/src/datacache/meson.build b/src/datacache/meson.build
index bde9f8621..775f2ee61 100644
--- a/src/datacache/meson.build
+++ b/src/datacache/meson.build
@@ -37,6 +37,7 @@ shared_module('gnunet_plugin_datacache_sqlite',
         include_directories: [incdir, configuration_inc],
         install: true,
         install_dir: get_option('libdir')/'gnunet')
+
 shared_module('gnunet_plugin_datacache_heap',
         ['plugin_datacache_heap.c'],
         dependencies: [libgnunetutil_dep,
@@ -45,7 +46,6 @@ shared_module('gnunet_plugin_datacache_heap',
         install: true,
         install_dir: get_option('libdir')/'gnunet')
 
-
 if pq_dep.found()
   shared_module('gnunet_plugin_datacache_postgres',
           ['plugin_datacache_postgres.c'],
@@ -57,3 +57,123 @@ if pq_dep.found()
           install: true,
           install_dir: get_option('libdir')/'gnunet')
 endif
+
+testdc_sqlite = executable ('test_datacache_sqlite',
+            ['test_datacache.c'],
+            dependencies: [
+              libgnunetdatacache_dep,
+              libgnunetutil_dep,
+              libgnunettesting_dep
+              ],
+            include_directories: [incdir, configuration_inc],
+            install: false)
+
+testdc_quota_sqlite = executable ('test_datacache_quota_sqlite',
+            ['test_datacache_quota.c'],
+            dependencies: [
+              libgnunetdatacache_dep,
+              libgnunetutil_dep,
+              libgnunettesting_dep
+              ],
+            include_directories: [incdir, configuration_inc],
+            install: false)
+
+#testdc_perf_sqlite = executable ('perf_datacache_sqlite',
+#            ['perf_datacache.c'],
+#            dependencies: [
+#              libgnunetdatacache_dep,
+#              libgnunetutil_dep,
+#              libgnunettesting_dep
+#              ],
+#            include_directories: [incdir, configuration_inc],
+#            install: false)
+
+testdc_heap = executable ('test_datacache_heap',
+            ['test_datacache.c'],
+            dependencies: [
+              libgnunetdatacache_dep,
+              libgnunetutil_dep,
+              libgnunettesting_dep
+              ],
+            include_directories: [incdir, configuration_inc],
+            install: false)
+
+testdc_quota_heap = executable ('test_datacache_quota_heap',
+            ['test_datacache_quota.c'],
+            dependencies: [
+              libgnunetdatacache_dep,
+              libgnunetutil_dep,
+              libgnunettesting_dep
+              ],
+            include_directories: [incdir, configuration_inc],
+            install: false)
+
+#testdc_perf_heap = executable ('perf_datacache_heap',
+#            ['perf_datacache.c'],
+#            dependencies: [
+#              libgnunetdatacache_dep,
+#              libgnunetutil_dep,
+#              libgnunettesting_dep
+#             ],
+#            include_directories: [incdir, configuration_inc],
+#            install: false)
+
+testdc_pq = executable ('test_datacache_postgres',
+            ['test_datacache.c'],
+            dependencies: [
+              libgnunetdatacache_dep,
+              libgnunetutil_dep,
+              libgnunettesting_dep
+              ],
+            include_directories: [incdir, configuration_inc],
+            install: false)
+
+testdc_quota_pq = executable ('test_datacache_quota_postgres',
+            ['test_datacache_quota.c'],
+            dependencies: [
+              libgnunetdatacache_dep,
+              libgnunetutil_dep,
+              libgnunettesting_dep
+              ],
+            include_directories: [incdir, configuration_inc],
+            install: false)
+
+#testdc_perf_pq = executable ('perf_datacache_postgres',
+#            ['perf_datacache.c'],
+#            dependencies: [
+#              libgnunetdatacache_dep,
+#              libgnunetutil_dep,
+#              libgnunettesting_dep
+#              ],
+#            include_directories: [incdir, configuration_inc],
+#            install: false)
+
+configure_file(input : 'test_datacache_data_sqlite.conf',
+               output : 'test_datacache_data_sqlite.conf',
+               copy: true)
+configure_file(input : 'test_datacache_data_heap.conf',
+               output : 'test_datacache_data_heap.conf',
+               copy: true)
+configure_file(input : 'test_datacache_data_postgres.conf',
+               output : 'test_datacache_data_postgres.conf',
+               copy: true)
+
+test('test_datacache_sqlite', testdc_sqlite,
+  suite: 'datacache', workdir: meson.current_build_dir())
+test('test_datacache_quota_sqlite', testdc_quota_sqlite,
+  suite: 'datacache', workdir: meson.current_build_dir())
+#test('perf_datacache_sqlite', testdc_perf_sqlite,
+#  suite: 'datacache', workdir: meson.current_build_dir())
+test('test_datacache_heap', testdc_heap,
+  suite: 'datacache', workdir: meson.current_build_dir())
+test('test_datacache_quota_heap', testdc_quota_heap,
+  suite: 'datacache', workdir: meson.current_build_dir())
+#test('perf_datacache_heap', testdc_perf_heap,
+#  suite: 'datacache', workdir: meson.current_build_dir())
+test('test_datacache_postgres', testdc_pq,
+  suite: 'datacache', workdir: meson.current_build_dir())
+test('test_datacache_quota_postgres', testdc_quota_pq,
+  suite: 'datacache', workdir: meson.current_build_dir())
+#test('perf_datacache_postgres', testdc_perf_pq,
+#  suite: 'datacache', workdir: meson.current_build_dir())
+
diff --git a/src/datacache/perf_datacache.c b/src/datacache/perf_datacache.c
index adbb958cc..3c9666dc4 100644
--- a/src/datacache/perf_datacache.c
+++ b/src/datacache/perf_datacache.c
@@ -163,8 +163,13 @@ main (int argc, char *argv[])
   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,
-                      "perf-datacache", "nohelp", options, &run, NULL);
+  if (GNUNET_OK != GNUNET_PROGRAM_run ((sizeof(xargv) / sizeof(char *)) - 1,
+                                       xargv,
+                                       "perf-datacache", "nohelp", options,
+                                       &run, NULL))
+  {
+    return 1;
+  }
   if ((0 != ok) && (77 != ok))
     fprintf (stderr, "Missed some perfcases: %d\n", ok);
   return ok;
diff --git a/src/datacache/test_datacache.c b/src/datacache/test_datacache.c
index a97a3f33c..7b7270609 100644
--- a/src/datacache/test_datacache.c
+++ b/src/datacache/test_datacache.c
@@ -187,13 +187,17 @@ main (int argc, char *argv[])
                    sizeof(cfg_name),
                    "test_datacache_data_%s.conf",
                    plugin_name);
-  GNUNET_PROGRAM_run ((sizeof(xargv) / sizeof(char *)) - 1,
-                      xargv,
-                      "test-datacache",
-                      "nohelp",
-                      options,
-                      &run,
-                      NULL);
+  if (GNUNET_OK != GNUNET_PROGRAM_run ((sizeof(xargv) / sizeof(char *)) - 1,
+                                       xargv,
+                                       "test-datacache",
+                                       "nohelp",
+                                       options,
+                                       &run,
+                                       NULL))
+  {
+    GNUNET_free (plugin_name);
+    return 1;
+  }
   if ((0 != ok) && (77 != ok))
     fprintf (stderr,
              "Missed some testcases: %d\n",
diff --git a/src/datacache/test_datacache_quota.c 
b/src/datacache/test_datacache_quota.c
index 2cdff8083..e2fc6ae61 100644
--- a/src/datacache/test_datacache_quota.c
+++ b/src/datacache/test_datacache_quota.c
@@ -68,6 +68,7 @@ run (void *cls,
     fprintf (stderr,
              "%s",
              "Failed to initialize datacache.  Database likely not setup, 
skipping test.\n");
+    ok = 77;
     return;
   }
   block.expiration_time = GNUNET_TIME_relative_to_absolute (
@@ -175,13 +176,17 @@ main (int argc,
                    sizeof(cfg_name),
                    "test_datacache_data_%s.conf",
                    plugin_name);
-  GNUNET_PROGRAM_run ((sizeof(xargv) / sizeof(char *)) - 1,
-                      xargv,
-                      "test-datacache-quota",
-                      "nohelp",
-                      options,
-                      &run,
-                      NULL);
+  if (GNUNET_OK != GNUNET_PROGRAM_run ((sizeof(xargv) / sizeof(char *)) - 1,
+                                       xargv,
+                                       "test-datacache-quota",
+                                       "nohelp",
+                                       options,
+                                       &run,
+                                       NULL))
+  {
+    GNUNET_free (plugin_name);
+    return 1;
+  }
   if (0 != ok)
     fprintf (stderr,
              "Missed some testcases: %d\n",

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