[libsoup/carlosgc/web-sockets: 2/3] test-utils: ensure we always provide an absolute path to g_tls_file_database_new



commit d6fe06b0877beea86bddff2e160e4145d82fdda2
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Mon Jun 17 15:09:06 2019 +0200

    test-utils: ensure we always provide an absolute path to g_tls_file_database_new
    
    This made tests fail when run from build dir due to runtime critical
    
    GLib-Net-WARNING **: 12:41:13.877: The anchor file name used with a GTlsFileDatabase must be an absolute 
path, and not relative: tests/test-cert.pem

 tests/test-utils.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/tests/test-utils.c b/tests/test-utils.c
index 9c742060..b720cbd8 100644
--- a/tests/test-utils.c
+++ b/tests/test-utils.c
@@ -239,9 +239,13 @@ soup_test_session_new (GType type, ...)
        va_end (args);
 
        if (tls_available) {
+               char *abs_cafile;
+
                cafile = g_test_build_filename (G_TEST_DIST, "test-cert.pem", NULL);
-               tlsdb = g_tls_file_database_new (cafile, &error);
+               abs_cafile = g_canonicalize_filename (cafile, NULL);
                g_free (cafile);
+               tlsdb = g_tls_file_database_new (abs_cafile, &error);
+               g_free (abs_cafile);
                if (error) {
                        if (g_strcmp0 (g_getenv ("GIO_USE_TLS"), "dummy") == 0)
                                g_clear_error (&error);


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