Port most of the tests to the new g_test_build_filename() API.
https://bugzilla.gnome.org/show_bug.cgi?id=549783
#include <stdlib.h>
#include <string.h>
-static const gchar *datapath;
static const gchar *test_file;
char *test_file_buffer;
GError *error = NULL;
int ret;
- if (g_getenv ("G_TEST_DATA"))
- datapath = g_getenv ("G_TEST_DATA");
- else
- datapath = SRCDIR;
-
g_test_init (&argc, &argv, NULL);
- test_file = g_strconcat (datapath, "/contexts.c", NULL);
+ test_file = g_test_build_filename (G_TEST_DISTED, "contexts.c", NULL);
g_file_get_contents (test_file, &test_file_buffer,
&test_file_size, &error);
g_assert_no_error (error);
#include <sys/stat.h>
#endif
-static const gchar *datapath;
-
static void
test_basic (void)
{
GFile *file;
GFileType type;
GError *error = NULL;
+ gchar *datapath;
+ datapath = g_test_build_filename (G_TEST_DISTED, ".", NULL);
datapath_f = g_file_new_for_path (datapath);
+ g_free (datapath);
file = g_file_get_child (datapath_f, "g-icon.c");
type = g_file_query_file_type (file, 0, NULL);
int
main (int argc, char *argv[])
{
- if (g_getenv ("G_TEST_DATA"))
- datapath = g_getenv ("G_TEST_DATA");
- else
- datapath = SRCDIR;
-
g_test_init (&argc, &argv, NULL);
g_test_bug_base ("http://bugzilla.gnome.org/");
#include <stdlib.h>
#include <string.h>
-static const gchar *datapath;
-
static void
test_g_icon_to_string (void)
{
gchar *str;
gchar *path;
- path = g_strconcat (datapath, "/g-icon.c", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "g-icon.c", NULL);
file = g_file_new_for_path (path);
icon = g_file_icon_new (file);
main (int argc,
char *argv[])
{
- if (g_getenv ("G_TEST_DATA"))
- datapath = g_getenv ("G_TEST_DATA");
- else
- datapath = SRCDIR;
-
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/icons/to-string", test_g_icon_to_string);
#include "gdbus-tests.h"
#include "gdbus-sessionbus.h"
-static const gchar *datapath;
-static const gchar *binpath;
-
static gint outstanding_watches;
static GMainLoop *main_loop;
va_start (ap, first_arg);
array = g_ptr_array_new ();
- g_ptr_array_add (array, g_build_filename (binpath, "basic-application", NULL));
+ g_ptr_array_add (array, g_test_build_filename (G_TEST_BUILT, "basic-application", NULL));
for (arg = first_arg; arg; arg = va_arg (ap, const gchar *))
g_ptr_array_add (array, g_strdup (arg));
g_ptr_array_add (array, NULL);
static void
test_nodbus (void)
{
- char *binpath = g_build_filename (datapath, "unimportant", NULL);
+ char *binpath = g_test_build_filename (G_TEST_BUILT, "unimportant", NULL);
gchar *argv[] = { binpath, NULL };
GApplication *app;
static void
test_noappid (void)
{
- char *binpath = g_build_filename (datapath, "unimportant", NULL);
+ char *binpath = g_test_build_filename (G_TEST_BUILT, "unimportant", NULL);
gchar *argv[] = { binpath, NULL };
GApplication *app;
test_quit (void)
{
GDBusConnection *c;
- char *binpath = g_build_filename (datapath, "unimportant", NULL);
+ char *binpath = g_test_build_filename (G_TEST_BUILT, "unimportant", NULL);
gchar *argv[] = { binpath, NULL };
GApplication *app;
static void
test_actions (void)
{
- char *binpath = g_build_filename (datapath, "unimportant", NULL);
+ char *binpath = g_test_build_filename (G_TEST_BUILT, "unimportant", NULL);
gchar *argv[] = { binpath, NULL };
GApplication *app;
static void
test_local_command_line (void)
{
- char *binpath = g_build_filename (datapath, "unimportant", NULL);
+ char *binpath = g_test_build_filename (G_TEST_BUILT, "unimportant", NULL);
gchar *argv[] = { binpath, "-invalid", NULL };
GApplication *app;
int
main (int argc, char **argv)
{
- if (g_getenv ("G_TEST_DATA"))
- datapath = binpath = g_getenv ("G_TEST_DATA");
- else
- {
- datapath = SRCDIR;
- binpath = BUILDDIR;
- }
-
g_test_init (&argc, &argv, NULL);
g_test_dbus_unset ();
#include "gdbus-tests.h"
-static const gchar *binpath;
-
/* all tests rely on a global connection */
static GDBusConnection *c = NULL;
gint ret;
gchar *path;
- if (g_getenv ("G_TEST_DATA"))
- binpath = g_getenv ("G_TEST_DATA");
- else
- binpath = BUILDDIR;
-
g_test_init (&argc, &argv, NULL);
/* all the tests rely on a shared main loop */
session_bus_up ();
/* this is safe; testserver will exit once the bus goes away */
- path = g_build_filename (binpath, "gdbus-testserver", NULL);
+ path = g_test_build_filename (G_TEST_BUILT, "gdbus-testserver", NULL);
g_assert (g_spawn_command_line_async (path, NULL));
g_free (path);
#include "gdbus-tests.h"
-static const gchar *binpath;
-
/* all tests rely on a shared mainloop */
static GMainLoop *loop = NULL;
gchar *path;
error = NULL;
- path = g_build_filename (binpath, "gdbus-connection-flush-helper", NULL);
+ path = g_test_build_filename (G_TEST_BUILT, "gdbus-connection-flush-helper", NULL);
ret = g_spawn_command_line_sync (path,
NULL, /* stdout */
NULL, /* stderr */
session_bus_up ();
/* this is safe; testserver will exit once the bus goes away */
- path = g_build_filename (binpath, "gdbus-testserver", NULL);
+ path = g_test_build_filename (G_TEST_BUILT, "gdbus-testserver", NULL);
g_assert (g_spawn_command_line_async (path, NULL));
g_free (path);
main (int argc,
char *argv[])
{
- if (g_getenv ("G_TEST_DATA"))
- binpath = g_getenv ("G_TEST_DATA");
- else
- binpath = BUILDDIR;
-
g_test_init (&argc, &argv, NULL);
/* all the tests rely on a shared main loop */
#include "gdbus-tests.h"
-const gchar *srcdir;
-const gchar *builddir;
-
/* all tests rely on a shared mainloop */
static GMainLoop *loop = NULL;
g_assert_cmpint (data.num_outgoing, ==, 4);
/* this is safe; testserver will exit once the bus goes away */
- path = g_build_filename (builddir, "gdbus-testserver", NULL);
+ path = g_test_build_filename (G_TEST_BUILT, "gdbus-testserver", NULL);
g_assert (g_spawn_command_line_async (path, NULL));
g_free (path);
{
g_test_init (&argc, &argv, NULL);
- if (g_getenv ("G_TEST_DATA"))
- srcdir = builddir = g_getenv ("G_TEST_DATA");
- else
- {
- srcdir = SRCDIR;
- builddir = BUILDDIR;
- }
-
/* all the tests rely on a shared main loop */
loop = g_main_loop_new (NULL, FALSE);
#include "gdbus-tests.h"
-static const gchar *binpath;
-
/* all tests rely on a shared mainloop */
static GMainLoop *loop = NULL;
g_assert_no_error (error);
/* this is safe; testserver will exit once the bus goes away */
- path = g_build_filename (binpath, "gdbus-testserver", NULL);
+ path = g_test_build_filename (G_TEST_BUILT, "gdbus-testserver", NULL);
g_assert (g_spawn_command_line_async (path, NULL));
g_free (path);
{
gint ret;
- if (g_getenv ("G_TEST_DATA"))
- binpath = g_getenv ("G_TEST_DATA");
- else
- binpath = BUILDDIR;
-
g_test_init (&argc, &argv, NULL);
/* all the tests rely on a shared main loop */
static gboolean is_unix = FALSE;
#endif
-static const gchar *datapath;
-
static gchar *tmp_address = NULL;
static gchar *test_guid = NULL;
static GMutex service_loop_lock;
gsize len;
gchar *buf2;
gsize len2;
- char *testfile = g_build_filename (datapath, "file.c", NULL);
+ char *testfile = g_test_build_filename (G_TEST_DISTED, "file.c", NULL);
method_call_message = g_dbus_message_new_method_call (NULL, /* name */
"/org/gtk/GDBus/PeerTestObject",
GDBusNodeInfo *introspection_data = NULL;
gchar *tmpdir = NULL;
- if (g_getenv ("G_TEST_DATA"))
- datapath = g_getenv ("G_TEST_DATA");
- else
- datapath = SRCDIR;
-
g_test_init (&argc, &argv, NULL);
introspection_data = g_dbus_node_info_new_for_xml (test_interface_introspection_xml, NULL);
#include "gdbus-tests.h"
-static const gchar *binpath;
-
/* all tests rely on a shared mainloop */
static GMainLoop *loop = NULL;
g_assert (g_dbus_proxy_get_cached_property_names (ap) == NULL);
/* this is safe; testserver will exit once the bus goes away */
- path = g_build_filename (binpath, "gdbus-testserver", NULL);
+ path = g_test_build_filename (G_TEST_BUILT, "gdbus-testserver", NULL);
g_assert (g_spawn_command_line_async (path, NULL));
g_free (path);
* the 'y' property should be back at 1...
*/
/* this is safe; testserver will exit once the bus goes away */
- path = g_build_filename (binpath, "gdbus-testserver", NULL);
+ path = g_test_build_filename (G_TEST_BUILT, "gdbus-testserver", NULL);
g_assert (g_spawn_command_line_async (path, NULL));
g_free (path);
{
gint ret;
- if (g_getenv ("G_TEST_DATA"))
- binpath = g_getenv ("G_TEST_DATA");
- else
- binpath = BUILDDIR;
-
g_test_init (&argc, &argv, NULL);
/* all the tests rely on a shared main loop */
#include "gdbus-tests.h"
-static const gchar *binpath;
-
/* all tests rely on a shared mainloop */
static GMainLoop *loop = NULL;
g_assert_no_error (error);
/* this is safe; testserver will exit once the bus goes away */
- path = g_build_filename (binpath, "gdbus-testserver", NULL);
+ path = g_test_build_filename (G_TEST_BUILT, "gdbus-testserver", NULL);
g_assert (g_spawn_command_line_async (path, NULL));
g_free (path);
NULL);
/* this is safe; testserver will exit once the bus goes away */
- path = g_build_filename (binpath, "gdbus-testserver", NULL);
+ path = g_test_build_filename (G_TEST_BUILT, "gdbus-testserver", NULL);
g_assert (g_spawn_command_line_async (path, NULL));
g_free (path);
gint ret;
GDBusNodeInfo *introspection_data = NULL;
- if (g_getenv ("G_TEST_DATA"))
- binpath = g_getenv ("G_TEST_DATA");
- else
- binpath = BUILDDIR;
-
g_test_init (&argc, &argv, NULL);
introspection_data = g_dbus_node_info_new_for_xml (frob_dbus_interface_xml, NULL);
#include "gdbus-tests.h"
-static const gchar *binpath;
-
/* all tests rely on a global connection */
static GDBusConnection *c = NULL;
gint ret;
gchar *path;
- if (g_getenv ("G_TEST_DATA"))
- binpath = g_getenv ("G_TEST_DATA");
- else
- binpath = BUILDDIR;
-
g_test_init (&argc, &argv, NULL);
session_bus_up ();
/* this is safe; testserver will exit once the bus goes away */
- path = g_build_filename (binpath, "gdbus-testserver", NULL);
+ path = g_test_build_filename (G_TEST_BUILT, "gdbus-testserver", NULL);
g_assert (g_spawn_command_line_async (path, NULL));
g_free (path);
#include <gio/gio.h>
#include <gstdio.h>
-const gchar *datapath;
const gchar *glib_compile_schemas;
typedef struct {
{
SchemaTest *test = (SchemaTest *) data;
gchar *filename = g_strconcat (test->name, ".gschema.xml", NULL);
- gchar *path = g_build_filename (datapath, "schema-tests", filename, NULL);
+ gchar *path = g_test_build_filename (G_TEST_DISTED, "schema-tests", filename, NULL);
gchar *argv[] = {
(gchar*)glib_compile_schemas,
"--strict",
setlocale (LC_ALL, "");
- if (g_getenv ("G_TEST_DATA"))
- datapath = g_getenv ("G_TEST_DATA");
- else
- datapath = SRCDIR;
-
if (g_getenv ("GLIB_COMPILE_SCHEMAS"))
glib_compile_schemas = g_getenv ("GLIB_COMPILE_SCHEMAS");
else
#include "gconstructor.h"
#include "test_resources2.h"
-const gchar *datapath, *libpath;
-
static void
test_resource (GResource *resource)
{
g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_NOENT);
g_clear_error (&error);
- path = g_build_filename (datapath, "test.gresource", NULL);
+ path = g_test_build_filename (G_TEST_BUILT, "test.gresource", NULL);
resource = g_resource_load (path, &error);
g_assert (resource != NULL);
g_assert_no_error (error);
GBytes *data;
gchar *path;
- path = g_build_filename (datapath, "test.gresource", NULL);
+ path = g_test_build_filename (G_TEST_BUILT, "test.gresource", NULL);
loaded_file = g_file_get_contents (path, &content, &content_size, NULL);
g_assert (loaded_file);
g_free (path);
char buffer[128];
gchar *path;
- path = g_build_filename (datapath, "test.gresource", NULL);
+ path = g_test_build_filename (G_TEST_BUILT, "test.gresource", NULL);
resource = g_resource_load (path, &error);
g_assert (resource != NULL);
g_assert_no_error (error);
{
char *path;
- path = g_build_filename (libpath, "libresourceplugin", NULL);
+ path = g_test_build_filename (G_TEST_BUILT, "libresourceplugin", NULL);
module = g_io_module_new (path);
g_free (path);
gchar *path;
const char *content_type;
- path = g_build_filename (datapath, "test.gresource", NULL);
+ path = g_test_build_filename (G_TEST_BUILT, "test.gresource", NULL);
loaded_file = g_file_get_contents (path, &content, &content_size, NULL);
g_assert (loaded_file);
g_free (path);
gssize skipped;
gchar *path;
- path = g_build_filename (datapath, "test.gresource", NULL);
+ path = g_test_build_filename (G_TEST_BUILT, "test.gresource", NULL);
loaded_file = g_file_get_contents (path, &content, &content_size, NULL);
g_assert (loaded_file);
g_free (path);
main (int argc,
char *argv[])
{
- if (g_getenv ("G_TEST_DATA"))
- {
- datapath = g_getenv ("G_TEST_DATA");
- libpath = g_getenv ("G_TEST_DATA");
- }
- else
- {
- datapath = SRCDIR;
- libpath = ".libs";
- }
-
g_test_init (&argc, &argv, NULL);
_g_test2_register_resource ();
#include "gtesttlsbackend.h"
-gchar *datapath;
-
typedef struct
{
gchar *cert_pems[3];
GError *error = NULL;
/* Check PEM parsing in certificate, private key order. */
- path = g_build_filename (datapath, "cert-key.pem", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "cert-key.pem", NULL);
g_file_get_contents (path, &pem, NULL, &error);
g_assert_no_error (error);
g_assert (pem);
g_free (pem);
/* Check PEM parsing in private key, certificate order */
- path = g_build_filename (datapath, "key-cert.pem", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "key-cert.pem", NULL);
g_file_get_contents (path, &pem, NULL, &error);
g_assert_no_error (error);
g_assert (pem);
g_object_unref (cert);
/* Check certificate only PEM */
- path = g_build_filename (datapath, "cert1.pem", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "cert1.pem", NULL);
g_file_get_contents (path, &pem, NULL, &error);
g_assert_no_error (error);
g_assert (pem);
g_object_unref (cert);
/* Check error with private key only PEM */
- path = g_build_filename (datapath, "key.pem", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "key.pem", NULL);
g_file_get_contents (path, &pem, NULL, &error);
g_assert_no_error (error);
g_assert (pem);
gchar *path;
GError *error = NULL;
- path = g_build_filename (datapath, "key-cert.pem", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "key-cert.pem", NULL);
cert = g_tls_certificate_new_from_file (path, &error);
g_assert_no_error (error);
g_assert (cert);
gchar *path, *path2;
GError *error = NULL;
- path = g_build_filename (datapath, "cert1.pem", NULL);
- path2 = g_build_filename (datapath, "key.pem", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "cert1.pem", NULL);
+ path2 = g_test_build_filename (G_TEST_DISTED, "cert-tests", "key.pem", NULL);
cert = g_tls_certificate_new_from_files (path, path2, &error);
g_assert_no_error (error);
g_assert (cert);
g_object_unref (cert);
/* Missing private key */
- path = g_build_filename (datapath, "cert1.pem", NULL);
- path2 = g_build_filename (datapath, "cert2.pem", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "cert1.pem", NULL);
+ path2 = g_test_build_filename (G_TEST_DISTED, "cert-tests", "cert2.pem", NULL);
cert = g_tls_certificate_new_from_files (path, path2, &error);
g_assert_error (error, G_TLS_ERROR, G_TLS_ERROR_BAD_CERTIFICATE);
g_clear_error (&error);
g_free (path2);
/* Missing certificate */
- path = g_build_filename (datapath, "key.pem", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "key.pem", NULL);
cert = g_tls_certificate_new_from_files (path, path, &error);
g_assert_error (error, G_TLS_ERROR, G_TLS_ERROR_BAD_CERTIFICATE);
g_clear_error (&error);
/* Using this method twice with a file containing both private key and
* certificate as a way to inforce private key presence is a fair use
*/
- path = g_build_filename (datapath, "key-cert.pem", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "key-cert.pem", NULL);
cert = g_tls_certificate_new_from_files (path, path, &error);
g_assert_no_error (error);
g_assert (cert);
gchar *path, *path2;
GError *error = NULL;
- path = g_build_filename (datapath, "cert1.pem", NULL);
- path2 = g_build_filename (datapath, "key8.pem", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "cert1.pem", NULL);
+ path2 = g_test_build_filename (G_TEST_DISTED, "cert-tests", "key8.pem", NULL);
cert = g_tls_certificate_new_from_files (path, path2, &error);
g_assert_no_error (error);
g_assert (cert);
gchar *path;
int i;
- path = g_build_filename (datapath, "cert-list.pem", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "cert-list.pem", NULL);
list = g_tls_certificate_list_new_from_file (path, &error);
g_assert_no_error (error);
g_assert_cmpint (g_list_length (list), ==, 3);
g_list_free_full (list, g_object_unref);
/* Empty list is not an error */
- path = g_build_filename (datapath, "nothing.pem", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "nothing.pem", NULL);
list = g_tls_certificate_list_new_from_file (path, &error);
g_assert_no_error (error);
g_assert_cmpint (g_list_length (list), ==, 0);
GError *error = NULL;
gchar *path;
- if (g_getenv ("G_TEST_DATA"))
- datapath = g_build_filename (g_getenv ("G_TEST_DATA"), "cert-tests", NULL);
- else
- datapath = g_build_filename (SRCDIR, "cert-tests", NULL);
-
g_test_init (&argc, &argv, NULL);
_g_test_tls_backend_get_type ();
/* Load reference PEM */
- path = g_build_filename (datapath, "cert1.pem", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "cert1.pem", NULL);
g_file_get_contents (path, &ref.cert_pems[0], NULL, &error);
g_assert_no_error (error);
g_assert (ref.cert_pems[0]);
g_free (path);
- path = g_build_filename (datapath, "cert2.pem", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "cert2.pem", NULL);
g_file_get_contents (path, &ref.cert_pems[1], NULL, &error);
g_assert_no_error (error);
g_assert (ref.cert_pems[1]);
g_free (path);
- path = g_build_filename (datapath, "cert3.pem", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "cert3.pem", NULL);
g_file_get_contents (path, &ref.cert_pems[2], NULL, &error);
g_assert_no_error (error);
g_assert (ref.cert_pems[2]);
g_free (path);
- path = g_build_filename (datapath, "key.pem", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "key.pem", NULL);
g_file_get_contents (path, &ref.key_pem, NULL, &error);
g_assert_no_error (error);
g_assert (ref.key_pem);
g_free (path);
- path = g_build_filename (datapath, "key8.pem", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "key8.pem", NULL);
g_file_get_contents (path, &ref.key8_pem, NULL, &error);
g_assert_no_error (error);
g_assert (ref.key8_pem);
GError *error;
const gchar *name;
gchar *path;
- const gchar *datapath;
g_test_init (&argc, &argv, NULL);
}
error = NULL;
- if (g_getenv ("G_TEST_DATA"))
- datapath = g_getenv ("G_TEST_DATA");
- else
- datapath = SRCDIR;
- path = g_build_filename (datapath, "bookmarks", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "bookmarks", NULL);
dir = g_dir_open (path, 0, &error);
g_free (path);
g_assert_no_error (error);
while ((name = g_dir_read_name (dir)) != NULL)
{
path = g_strdup_printf ("/bookmarks/parse/%s", name);
- g_test_add_data_func_full (path, g_build_filename (datapath, "bookmarks", name, NULL),
+ g_test_add_data_func_full (path, g_test_build_filename (G_TEST_DISTED, "bookmarks", name, NULL),
test_file, g_free);
g_free (path);
}
#include <string.h>
#include <stdlib.h>
-static const gchar *datapath;
-
static GKeyFile *
load_data (const gchar *data,
GKeyFileFlags flags)
file = g_key_file_new ();
error = NULL;
- path = g_build_filename (datapath, "keyfile.c", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "keyfile.c", NULL);
g_assert (!g_key_file_load_from_file (file, path, 0, &error));
g_free (path);
g_assert_error (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_PARSE);
file = g_key_file_new ();
error = NULL;
- path = g_build_filename (datapath, "pages.ini", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "pages.ini", NULL);
g_key_file_load_from_file (file, path, G_KEY_FILE_NONE, &error);
g_free (path);
g_assert_no_error (error);
int
main (int argc, char *argv[])
{
- if (g_getenv ("G_TEST_DATA"))
- datapath = g_getenv ("G_TEST_DATA");
- else
- datapath = SRCDIR;
+ g_test_init (&argc, &argv, NULL);
#ifdef G_OS_UNIX
- g_setenv ("XDG_DATA_HOME", datapath, TRUE);
+ g_setenv ("XDG_DATA_HOME", g_test_build_filename (G_TEST_DISTED, ".", NULL), TRUE);
#endif
- g_test_init (&argc, &argv, NULL);
g_test_bug_base ("http://bugzilla.gnome.org/");
g_test_add_func ("/keyfile/line-ends", test_line_ends);
#include <sys/types.h>
#include <fcntl.h>
-static const gchar *datapath;
-
static void
test_basic (void)
{
gchar *path;
error = NULL;
- path = g_build_filename (datapath, "empty", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "empty", NULL);
file = g_mapped_file_new (path, FALSE, &error);
g_free (path);
g_assert_no_error (error);
gchar *path;
error = NULL;
- path = g_build_filename (datapath, "empty", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "empty", NULL);
file = g_mapped_file_new (path, FALSE, &error);
g_free (path);
g_assert_no_error (error);
char *srcpath;
gchar *tmp_copy_path;
- srcpath = g_build_filename (datapath, "4096-random-bytes", NULL);
+ srcpath = g_test_build_filename (G_TEST_DISTED, "4096-random-bytes", NULL);
tmp_copy_path = g_build_filename (g_get_user_runtime_dir (), "glib-test-4096-random-bytes", NULL);
g_file_get_contents (srcpath, &contents, &len, &error);
char *srcpath;
gchar *tmp_copy_path;
- srcpath = g_build_filename (datapath, "4096-random-bytes", NULL);
+ srcpath = g_test_build_filename (G_TEST_DISTED, "4096-random-bytes", NULL);
tmp_copy_path = g_build_filename (g_get_user_runtime_dir (), "glib-test-4096-random-bytes", NULL);
g_file_get_contents (srcpath, &contents, &len, &error);
gchar *path;
error = NULL;
- path = g_build_filename (datapath, "empty", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "empty", NULL);
file = g_mapped_file_new (path, FALSE, &error);
g_free (path);
g_assert_no_error (error);
int
main (int argc, char *argv[])
{
- if (g_getenv ("G_TEST_DATA"))
- datapath = g_getenv ("G_TEST_DATA");
- else
- datapath = SRCDIR;
-
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/mappedfile/basic", test_basic);
static int depth = 0;
static GString *string;
-static const gchar *datapath;
static void
indent (int extra)
const gchar *name;
gchar *path;
- if (g_getenv ("G_TEST_DATA"))
- datapath = g_getenv ("G_TEST_DATA");
- else
- datapath = SRCDIR;
-
g_setenv ("LANG", "en_US.utf-8", TRUE);
setlocale (LC_ALL, "");
}
error = NULL;
- path = g_build_filename (datapath, "markups", NULL);
+ path = g_test_build_filename (G_TEST_DISTED, "markups", NULL);
dir = g_dir_open (path, 0, &error);
g_free (path);
g_assert_no_error (error);
continue;
path = g_strdup_printf ("/markup/parse/%s", name);
- g_test_add_data_func_full (path, g_build_filename (datapath, "markups", name, NULL),
+ g_test_add_data_func_full (path, g_test_build_filename (G_TEST_DISTED, "markups", name, NULL),
test_parse, g_free);
g_free (path);
}