@@ -83,6 +83,17 @@ typedef struct
8383 GSList* hdlrs;
8484} Fixture;
8585
86+
87+ static char *
88+ normalize_path (char * path)
89+ {
90+ g_return_val_if_fail (path, nullptr );
91+ auto rv = gnc_uri_normalize_uri (path, FALSE );
92+ g_free (path);
93+ return rv;
94+ }
95+
96+
8697static void
8798setup (Fixture* fixture, gconstpointer pData)
8899{
@@ -94,14 +105,17 @@ setup (Fixture* fixture, gconstpointer pData)
94105 * prevents creating the lock file. Force the session to get
95106 * around that.
96107 */
97- qof_session_begin (fixture->session , DBI_TEST_XML_FILENAME,
108+ qof_session_begin (fixture->session ,
109+ normalize_path (g_strdup (DBI_TEST_XML_FILENAME)),
98110 SESSION_BREAK_LOCK);
99111 g_assert_cmpint (qof_session_get_error (fixture->session ), == ,
100112 ERR_BACKEND_NO_ERR);
101113 qof_session_load (fixture->session , NULL );
102114
103115 if (g_strcmp0 (url, " sqlite3" ) == 0 )
104- fixture->filename = g_strdup_printf (" /tmp/test-sqlite-%d" , getpid ());
116+ fixture->filename =
117+ normalize_path (g_strdup_printf (TEMPDIR " /test-sqlite-%d" ,
118+ getpid ()));
105119 else
106120 fixture->filename = NULL ;
107121}
@@ -158,7 +172,9 @@ setup_memory (Fixture* fixture, gconstpointer pData)
158172
159173 fixture->session = session;
160174 if (g_strcmp0 (url, " sqlite3" ) == 0 )
161- fixture->filename = g_strdup_printf (" /tmp/test-sqlite-%d" , getpid ());
175+ fixture->filename =
176+ normalize_path (g_strdup_printf (TEMPDIR " /test-sqlite-%d" ,
177+ getpid ()));
162178 else
163179 fixture->filename = NULL ;
164180}
@@ -237,7 +253,9 @@ setup_business (Fixture* fixture, gconstpointer pData)
237253
238254 fixture->session = session;
239255 if (g_strcmp0 (url, " sqlite3" ) == 0 )
240- fixture->filename = g_strdup_printf (" /tmp/test-sqlite-%d" , getpid ());
256+ fixture->filename =
257+ normalize_path (g_strdup_printf (TEMPDIR " /test-sqlite-%d" ,
258+ getpid ()));
241259 else
242260 fixture->filename = NULL ;
243261}
0 commit comments