test_get_helper_executable: Add function

This is basically the same as get_test_exec() in dbus-spawn-test.c,
but GLib-flavoured.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2018-10-31 15:22:26 +00:00
parent 2a2c6e6790
commit 6eb1c2cd53
2 changed files with 22 additions and 0 deletions

View file

@ -890,3 +890,23 @@ test_incomplete (const gchar *message)
g_test_skip (message);
}
}
/*
* Return location of @exe test helper executable, or NULL if unknown.
*
* @exe must already include %DBUS_EXEEXT if appropriate.
*
* Returns: (transfer full) (nullable): an absolute path or NULL.
*/
gchar *
test_get_helper_executable (const gchar *exe)
{
const char *dbus_test_exec;
dbus_test_exec = _dbus_getenv ("DBUS_TEST_EXEC");
if (dbus_test_exec == NULL)
return NULL;
return g_build_filename (dbus_test_exec, exe, NULL);
}

View file

@ -129,4 +129,6 @@ void test_store_result_cb (GObject *source_object,
void test_incomplete (const gchar *message);
gchar *test_get_helper_executable (const gchar *exe);
#endif