mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-21 16:38:06 -06:00
Fix invalid home test
If a user has set environment variable GNC_DATA_HOME to a valid directory (containing real gnucash metadata) the test would fail. It expects to follow the code path to set up a gnucash data home directory in the temporary directory, but the directory pointed to in GNC_DATA_HOME is used instead. Fix this by also setting environment variable GNC_DATA_HOME to something invalid during the test.
This commit is contained in:
parent
cf73829e24
commit
831ce065bb
@ -72,6 +72,7 @@ main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv)
|
|||||||
const char *tmp_dir = g_get_tmp_dir();
|
const char *tmp_dir = g_get_tmp_dir();
|
||||||
const char *builddir = g_getenv ("GNC_BUILDDIR");
|
const char *builddir = g_getenv ("GNC_BUILDDIR");
|
||||||
char *homedir = g_build_filename (builddir, "notexist", NULL);
|
char *homedir = g_build_filename (builddir, "notexist", NULL);
|
||||||
|
char *testdatahome = g_build_filename (homedir, "gnucash", NULL);
|
||||||
|
|
||||||
/* Assume we're not in a build environment to test
|
/* Assume we're not in a build environment to test
|
||||||
* the function's actual behaviour in a real world use case, using
|
* the function's actual behaviour in a real world use case, using
|
||||||
@ -83,7 +84,9 @@ main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv)
|
|||||||
* The code should fall back to using the temporary
|
* The code should fall back to using the temporary
|
||||||
* directory in that case. */
|
* directory in that case. */
|
||||||
g_setenv("HOME", homedir, TRUE);
|
g_setenv("HOME", homedir, TRUE);
|
||||||
|
g_setenv("GNC_DATA_HOME", testdatahome, TRUE);
|
||||||
g_free (homedir);
|
g_free (homedir);
|
||||||
|
g_free (testdatahome);
|
||||||
|
|
||||||
for (i = 0; strs2[i].funcname != NULL; i++)
|
for (i = 0; strs2[i].funcname != NULL; i++)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user