Taken from upstream.
From b0cd77e588620465b78f7c017d3f240e13936aa3 Mon Sep 17 00:00:00 2001
From: Pavlo Solntsev
Date: Sun, 19 Sep 2021 22:51:38 -0500
Subject: [PATCH] Test: Skip test if no server available
Two variables will be checked. If they set
and provide all needed information the test
will be executed. If they are not set, the test
will return TRUE and will terminate with
termination status EXIT_SUCCESS.
---
tests/db/check-db-catalog-postgresql.c | 16 ++++++++++++++++
tests/test-server-operation-postgresql.c | 16 ++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/tests/db/check-db-catalog-postgresql.c b/tests/db/check-db-catalog-postgresql.c
index 5b8e9395c..bf9a8942c 100644
--- a/tests/db/check-db-catalog-postgresql.c
+++ b/tests/db/check-db-catalog-postgresql.c
@@ -25,6 +25,9 @@
#include
#include "../test-cnc-utils.h"
+#define PROVIDER_DB_CREATE_PARAMS "POSTGRESQL_DBCREATE_PARAMS"
+#define PROVIDER_CNC_PARAMS "POSTGRESQL_CNC_PARAMS"
+
typedef struct {
GdaDbCatalog *catalog;
GdaConnection *cnc;
@@ -359,6 +362,19 @@ main (gint argc,
{
setlocale (LC_ALL,"");
+ const gchar *db_create_str;
+ const gchar *cnc_params;
+
+ db_create_str = g_getenv (PROVIDER_DB_CREATE_PARAMS);
+ cnc_params = g_getenv (PROVIDER_CNC_PARAMS);
+
+ if (!db_create_str || !cnc_params) {
+ g_print ("Please set POSTGRESQL_DBCREATE_PARAMS and POSTGRESQL_CNC_PARAMS variable"
+ "with dbname, host, user and port (usually 5432)\n");
+ g_print ("Test will not be performed\n");
+ return EXIT_SUCCESS;
+ }
+
g_test_init (&argc,&argv,NULL);
g_test_add ("/test-db-postgresql/meta-tables",
diff --git a/tests/test-server-operation-postgresql.c b/tests/test-server-operation-postgresql.c
index 37796c4be..860f41a18 100644
--- a/tests/test-server-operation-postgresql.c
+++ b/tests/test-server-operation-postgresql.c
@@ -38,9 +38,12 @@
#include
#include
#include
+/*#include */
#include "test-cnc-utils.h"
#define PROVIDER_NAME "PostgreSQL"
+#define PROVIDER_DB_CREATE_PARAMS "POSTGRESQL_DBCREATE_PARAMS"
+#define PROVIDER_CNC_PARAMS "POSTGRESQL_CNC_PARAMS"
#define GDA_PGSQL_ERROR_HANDLE(e) (g_print("Error: %s: %s\n", G_STRLOC, e && e->message ? e->message : "No default"));
@@ -1335,6 +1338,19 @@ main(gint argc, gchar *argv[])
{
setlocale (LC_ALL,"");
+ const gchar *db_create_str;
+ const gchar *cnc_params;
+
+ db_create_str = g_getenv (PROVIDER_DB_CREATE_PARAMS);
+ cnc_params = g_getenv (PROVIDER_CNC_PARAMS);
+
+ if (!db_create_str || !cnc_params) {
+ g_print ("Please set POSTGRESQL_DBCREATE_PARAMS and POSTGRESQL_CNC_PARAMS variable"
+ "with dbname, host, user and port (usually 5432)\n");
+ g_print ("Test will not be performed\n");
+ return EXIT_SUCCESS;
+ }
+
g_test_init (&argc,&argv,NULL);
g_test_add ("/test-server-operation-sqlite/old-so-module",
--
GitLab
gnu/store/.links but only contribute to ~4% of the space savings
afforded by deduplication.
Not considering these files for deduplication speeds up file insertion
in the store and, more importantly, leaves 'removeUnusedLinks' with
fewer entries to traverse, thereby speeding it up proportionally.
Partly fixes <https://issues.guix.gnu.org/24937>.
* config-daemon.ac: Remove symlink hard link check and CAN_LINK_SYMLINK
definition.
* guix/store/deduplication.scm (%deduplication-minimum-size): New
variable.
(deduplicate)[loop]: Do not recurse when FILE's size is below
%DEDUPLICATION-MINIMUM-SIZE.
(dump-port): New procedure.
(dump-file/deduplicate)[hash]: Turn into...
[dump-and-compute-hash]: ... this thunk.
Call 'deduplicate' only when SIZE is greater than
%DEDUPLICATION-MINIMUM-SIZE; otherwise call 'dump-port'.
* nix/libstore/gc.cc (LocalStore::removeUnusedLinks): Drop files where
st.st_size < deduplicationMinSize.
* nix/libstore/local-store.hh (deduplicationMinSize): New declaration.
* nix/libstore/optimise-store.cc (deduplicationMinSize): New variable.
(LocalStore::optimisePath_): Return when PATH is a symlink or smaller
than 'deduplicationMinSize'.
* tests/derivations.scm ("identical files are deduplicated"): Produce
files bigger than %DEDUPLICATION-MINIMUM-SIZE.
* tests/nar.scm ("restore-file-set with directories (signed, valid)"):
Likewise.
* tests/store-deduplication.scm ("deduplicate, below %deduplication-minimum-size"):
New test.
("deduplicate", "deduplicate, ENOSPC"): Produce files bigger than
%DEDUPLICATION-MINIMUM-SIZE.
* tests/store.scm ("substitute, deduplication"): Likewise.
Ludovic Courtès |
2020-12-15 | deduplicate: Create the '.links' directory lazily....This avoids repeated (mkdir-p "/gnu/store/.links") calls when
deduplicating lots of files.
* guix/store/deduplication.scm (deduplicate): Remove initial call to
'mkdir-p'. Add ENOENT case in 'link' exception handler. Reindent.
* tests/store-deduplication.scm ("deduplicate, ENOSPC"): Check
for (<= links 4) to account for the initial 'link' call.
| Ludovic Courtès |
2020-12-15 | store-copy: 'populate-store' can optionally deduplicate files....Until now deduplication was performed as an additional pass after
copying files, which involve re-traversing all the files that had just
been copied.
* guix/store/deduplication.scm (copy-file/deduplicate): New procedure.
* tests/store-deduplication.scm ("copy-file/deduplicate"): New test.
* guix/build/store-copy.scm (populate-store): Add #:deduplicate?
parameter and honor it.
* tests/gexp.scm ("gexp->derivation, store copy"): Pass #:deduplicate? #f
to 'populate-store'.
* gnu/build/image.scm (initialize-root-partition): Pass #:deduplicate?
to 'populate-store'. Pass #:deduplicate? #f to 'register-closure'.
* gnu/build/vm.scm (root-partition-initializer): Likewise.
* gnu/build/install.scm (populate-single-profile-directory): Pass
#:deduplicate? #f to 'populate-store'.
* gnu/build/linux-initrd.scm (build-initrd): Likewise.
* guix/scripts/pack.scm (self-contained-tarball)[import-module?]: New
procedure.
[build]: Pass it as an argument to 'source-module-closure'.
* guix/scripts/pack.scm (squashfs-image)[build]: Wrap in
'with-extensions'.
* gnu/system/linux-initrd.scm (expression->initrd)[import-module?]: New
procedure.
[builder]: Pass it to 'source-module-closure'.
* gnu/system/install.scm (cow-store-service-type)[import-module?]: New
procedure. Pass it to 'source-module-closure'.
| Ludovic Courtès |