mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 22:46:15 +01:00
tests: use new g_test_build_filename() API
Port most of the tests to the new g_test_build_filename() API. https://bugzilla.gnome.org/show_bug.cgi?id=549783
This commit is contained in:
parent
0c4806733c
commit
58c6ca32aa
@ -2,7 +2,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
static const gchar *datapath;
|
|
||||||
static const gchar *test_file;
|
static const gchar *test_file;
|
||||||
|
|
||||||
char *test_file_buffer;
|
char *test_file_buffer;
|
||||||
@ -187,14 +186,9 @@ main (int argc, char **argv)
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (g_getenv ("G_TEST_DATA"))
|
|
||||||
datapath = g_getenv ("G_TEST_DATA");
|
|
||||||
else
|
|
||||||
datapath = SRCDIR;
|
|
||||||
|
|
||||||
g_test_init (&argc, &argv, NULL);
|
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,
|
g_file_get_contents (test_file, &test_file_buffer,
|
||||||
&test_file_size, &error);
|
&test_file_size, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const gchar *datapath;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_basic (void)
|
test_basic (void)
|
||||||
{
|
{
|
||||||
@ -85,8 +83,11 @@ test_type (void)
|
|||||||
GFile *file;
|
GFile *file;
|
||||||
GFileType type;
|
GFileType type;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
gchar *datapath;
|
||||||
|
|
||||||
|
datapath = g_test_build_filename (G_TEST_DISTED, ".", NULL);
|
||||||
datapath_f = g_file_new_for_path (datapath);
|
datapath_f = g_file_new_for_path (datapath);
|
||||||
|
g_free (datapath);
|
||||||
|
|
||||||
file = g_file_get_child (datapath_f, "g-icon.c");
|
file = g_file_get_child (datapath_f, "g-icon.c");
|
||||||
type = g_file_query_file_type (file, 0, NULL);
|
type = g_file_query_file_type (file, 0, NULL);
|
||||||
@ -793,11 +794,6 @@ test_copy_preserve_mode (void)
|
|||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
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_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
g_test_bug_base ("http://bugzilla.gnome.org/");
|
g_test_bug_base ("http://bugzilla.gnome.org/");
|
||||||
|
@ -27,8 +27,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
static const gchar *datapath;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_g_icon_to_string (void)
|
test_g_icon_to_string (void)
|
||||||
{
|
{
|
||||||
@ -469,7 +467,7 @@ test_file_icon (void)
|
|||||||
gchar *str;
|
gchar *str;
|
||||||
gchar *path;
|
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);
|
file = g_file_new_for_path (path);
|
||||||
icon = g_file_icon_new (file);
|
icon = g_file_icon_new (file);
|
||||||
@ -497,11 +495,6 @@ int
|
|||||||
main (int argc,
|
main (int argc,
|
||||||
char *argv[])
|
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_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
g_test_add_func ("/icons/to-string", test_g_icon_to_string);
|
g_test_add_func ("/icons/to-string", test_g_icon_to_string);
|
||||||
|
@ -6,9 +6,6 @@
|
|||||||
#include "gdbus-tests.h"
|
#include "gdbus-tests.h"
|
||||||
#include "gdbus-sessionbus.h"
|
#include "gdbus-sessionbus.h"
|
||||||
|
|
||||||
static const gchar *datapath;
|
|
||||||
static const gchar *binpath;
|
|
||||||
|
|
||||||
static gint outstanding_watches;
|
static gint outstanding_watches;
|
||||||
static GMainLoop *main_loop;
|
static GMainLoop *main_loop;
|
||||||
|
|
||||||
@ -68,7 +65,7 @@ spawn (const gchar *expected_stdout,
|
|||||||
|
|
||||||
va_start (ap, first_arg);
|
va_start (ap, first_arg);
|
||||||
array = g_ptr_array_new ();
|
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 *))
|
for (arg = first_arg; arg; arg = va_arg (ap, const gchar *))
|
||||||
g_ptr_array_add (array, g_strdup (arg));
|
g_ptr_array_add (array, g_strdup (arg));
|
||||||
g_ptr_array_add (array, NULL);
|
g_ptr_array_add (array, NULL);
|
||||||
@ -323,7 +320,7 @@ nodbus_activate (GApplication *app)
|
|||||||
static void
|
static void
|
||||||
test_nodbus (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 };
|
gchar *argv[] = { binpath, NULL };
|
||||||
GApplication *app;
|
GApplication *app;
|
||||||
|
|
||||||
@ -353,7 +350,7 @@ noappid_activate (GApplication *app)
|
|||||||
static void
|
static void
|
||||||
test_noappid (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 };
|
gchar *argv[] = { binpath, NULL };
|
||||||
GApplication *app;
|
GApplication *app;
|
||||||
|
|
||||||
@ -392,7 +389,7 @@ static void
|
|||||||
test_quit (void)
|
test_quit (void)
|
||||||
{
|
{
|
||||||
GDBusConnection *c;
|
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 };
|
gchar *argv[] = { binpath, NULL };
|
||||||
GApplication *app;
|
GApplication *app;
|
||||||
|
|
||||||
@ -448,7 +445,7 @@ on_activate (GApplication *app)
|
|||||||
static void
|
static void
|
||||||
test_actions (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 };
|
gchar *argv[] = { binpath, NULL };
|
||||||
GApplication *app;
|
GApplication *app;
|
||||||
|
|
||||||
@ -504,7 +501,7 @@ test_loc_cmd_app_class_init (TestLocCmdAppClass *klass)
|
|||||||
static void
|
static void
|
||||||
test_local_command_line (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 };
|
gchar *argv[] = { binpath, "-invalid", NULL };
|
||||||
GApplication *app;
|
GApplication *app;
|
||||||
|
|
||||||
@ -522,14 +519,6 @@ test_local_command_line (void)
|
|||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
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_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
g_test_dbus_unset ();
|
g_test_dbus_unset ();
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
|
|
||||||
#include "gdbus-tests.h"
|
#include "gdbus-tests.h"
|
||||||
|
|
||||||
static const gchar *binpath;
|
|
||||||
|
|
||||||
/* all tests rely on a global connection */
|
/* all tests rely on a global connection */
|
||||||
static GDBusConnection *c = NULL;
|
static GDBusConnection *c = NULL;
|
||||||
|
|
||||||
@ -116,11 +114,6 @@ main (int argc,
|
|||||||
gint ret;
|
gint ret;
|
||||||
gchar *path;
|
gchar *path;
|
||||||
|
|
||||||
if (g_getenv ("G_TEST_DATA"))
|
|
||||||
binpath = g_getenv ("G_TEST_DATA");
|
|
||||||
else
|
|
||||||
binpath = BUILDDIR;
|
|
||||||
|
|
||||||
g_test_init (&argc, &argv, NULL);
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
/* all the tests rely on a shared main loop */
|
/* all the tests rely on a shared main loop */
|
||||||
@ -129,7 +122,7 @@ main (int argc,
|
|||||||
session_bus_up ();
|
session_bus_up ();
|
||||||
|
|
||||||
/* this is safe; testserver will exit once the bus goes away */
|
/* 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_assert (g_spawn_command_line_async (path, NULL));
|
||||||
g_free (path);
|
g_free (path);
|
||||||
|
|
||||||
|
@ -28,8 +28,6 @@
|
|||||||
|
|
||||||
#include "gdbus-tests.h"
|
#include "gdbus-tests.h"
|
||||||
|
|
||||||
static const gchar *binpath;
|
|
||||||
|
|
||||||
/* all tests rely on a shared mainloop */
|
/* all tests rely on a shared mainloop */
|
||||||
static GMainLoop *loop = NULL;
|
static GMainLoop *loop = NULL;
|
||||||
|
|
||||||
@ -91,7 +89,7 @@ test_connection_flush (void)
|
|||||||
gchar *path;
|
gchar *path;
|
||||||
|
|
||||||
error = NULL;
|
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,
|
ret = g_spawn_command_line_sync (path,
|
||||||
NULL, /* stdout */
|
NULL, /* stdout */
|
||||||
NULL, /* stderr */
|
NULL, /* stderr */
|
||||||
@ -194,7 +192,7 @@ test_connection_large_message (void)
|
|||||||
session_bus_up ();
|
session_bus_up ();
|
||||||
|
|
||||||
/* this is safe; testserver will exit once the bus goes away */
|
/* 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_assert (g_spawn_command_line_async (path, NULL));
|
||||||
g_free (path);
|
g_free (path);
|
||||||
|
|
||||||
@ -221,11 +219,6 @@ int
|
|||||||
main (int argc,
|
main (int argc,
|
||||||
char *argv[])
|
char *argv[])
|
||||||
{
|
{
|
||||||
if (g_getenv ("G_TEST_DATA"))
|
|
||||||
binpath = g_getenv ("G_TEST_DATA");
|
|
||||||
else
|
|
||||||
binpath = BUILDDIR;
|
|
||||||
|
|
||||||
g_test_init (&argc, &argv, NULL);
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
/* all the tests rely on a shared main loop */
|
/* all the tests rely on a shared main loop */
|
||||||
|
@ -28,9 +28,6 @@
|
|||||||
|
|
||||||
#include "gdbus-tests.h"
|
#include "gdbus-tests.h"
|
||||||
|
|
||||||
const gchar *srcdir;
|
|
||||||
const gchar *builddir;
|
|
||||||
|
|
||||||
/* all tests rely on a shared mainloop */
|
/* all tests rely on a shared mainloop */
|
||||||
static GMainLoop *loop = NULL;
|
static GMainLoop *loop = NULL;
|
||||||
|
|
||||||
@ -1005,7 +1002,7 @@ test_connection_filter (void)
|
|||||||
g_assert_cmpint (data.num_outgoing, ==, 4);
|
g_assert_cmpint (data.num_outgoing, ==, 4);
|
||||||
|
|
||||||
/* this is safe; testserver will exit once the bus goes away */
|
/* 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_assert (g_spawn_command_line_async (path, NULL));
|
||||||
g_free (path);
|
g_free (path);
|
||||||
|
|
||||||
@ -1228,14 +1225,6 @@ main (int argc,
|
|||||||
{
|
{
|
||||||
g_test_init (&argc, &argv, NULL);
|
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 */
|
/* all the tests rely on a shared main loop */
|
||||||
loop = g_main_loop_new (NULL, FALSE);
|
loop = g_main_loop_new (NULL, FALSE);
|
||||||
|
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
|
|
||||||
#include "gdbus-tests.h"
|
#include "gdbus-tests.h"
|
||||||
|
|
||||||
static const gchar *binpath;
|
|
||||||
|
|
||||||
/* all tests rely on a shared mainloop */
|
/* all tests rely on a shared mainloop */
|
||||||
static GMainLoop *loop = NULL;
|
static GMainLoop *loop = NULL;
|
||||||
|
|
||||||
@ -128,7 +126,7 @@ test_introspection_parser (void)
|
|||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
|
||||||
/* this is safe; testserver will exit once the bus goes away */
|
/* 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_assert (g_spawn_command_line_async (path, NULL));
|
||||||
g_free (path);
|
g_free (path);
|
||||||
|
|
||||||
@ -308,11 +306,6 @@ main (int argc,
|
|||||||
{
|
{
|
||||||
gint ret;
|
gint ret;
|
||||||
|
|
||||||
if (g_getenv ("G_TEST_DATA"))
|
|
||||||
binpath = g_getenv ("G_TEST_DATA");
|
|
||||||
else
|
|
||||||
binpath = BUILDDIR;
|
|
||||||
|
|
||||||
g_test_init (&argc, &argv, NULL);
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
/* all the tests rely on a shared main loop */
|
/* all the tests rely on a shared main loop */
|
||||||
|
@ -62,8 +62,6 @@ static gboolean is_unix = TRUE;
|
|||||||
static gboolean is_unix = FALSE;
|
static gboolean is_unix = FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const gchar *datapath;
|
|
||||||
|
|
||||||
static gchar *tmp_address = NULL;
|
static gchar *tmp_address = NULL;
|
||||||
static gchar *test_guid = NULL;
|
static gchar *test_guid = NULL;
|
||||||
static GMutex service_loop_lock;
|
static GMutex service_loop_lock;
|
||||||
@ -789,7 +787,7 @@ test_peer (void)
|
|||||||
gsize len;
|
gsize len;
|
||||||
gchar *buf2;
|
gchar *buf2;
|
||||||
gsize len2;
|
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 */
|
method_call_message = g_dbus_message_new_method_call (NULL, /* name */
|
||||||
"/org/gtk/GDBus/PeerTestObject",
|
"/org/gtk/GDBus/PeerTestObject",
|
||||||
@ -1847,11 +1845,6 @@ main (int argc,
|
|||||||
GDBusNodeInfo *introspection_data = NULL;
|
GDBusNodeInfo *introspection_data = NULL;
|
||||||
gchar *tmpdir = 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);
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
introspection_data = g_dbus_node_info_new_for_xml (test_interface_introspection_xml, NULL);
|
introspection_data = g_dbus_node_info_new_for_xml (test_interface_introspection_xml, NULL);
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
|
|
||||||
#include "gdbus-tests.h"
|
#include "gdbus-tests.h"
|
||||||
|
|
||||||
static const gchar *binpath;
|
|
||||||
|
|
||||||
/* all tests rely on a shared mainloop */
|
/* all tests rely on a shared mainloop */
|
||||||
static GMainLoop *loop = NULL;
|
static GMainLoop *loop = NULL;
|
||||||
|
|
||||||
@ -101,7 +99,7 @@ test_proxy_well_known_name (void)
|
|||||||
g_assert (g_dbus_proxy_get_cached_property_names (ap) == NULL);
|
g_assert (g_dbus_proxy_get_cached_property_names (ap) == NULL);
|
||||||
|
|
||||||
/* this is safe; testserver will exit once the bus goes away */
|
/* 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_assert (g_spawn_command_line_async (path, NULL));
|
||||||
g_free (path);
|
g_free (path);
|
||||||
|
|
||||||
@ -229,7 +227,7 @@ test_proxy_well_known_name (void)
|
|||||||
* the 'y' property should be back at 1...
|
* the 'y' property should be back at 1...
|
||||||
*/
|
*/
|
||||||
/* this is safe; testserver will exit once the bus goes away */
|
/* 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_assert (g_spawn_command_line_async (path, NULL));
|
||||||
g_free (path);
|
g_free (path);
|
||||||
|
|
||||||
@ -267,11 +265,6 @@ main (int argc,
|
|||||||
{
|
{
|
||||||
gint ret;
|
gint ret;
|
||||||
|
|
||||||
if (g_getenv ("G_TEST_DATA"))
|
|
||||||
binpath = g_getenv ("G_TEST_DATA");
|
|
||||||
else
|
|
||||||
binpath = BUILDDIR;
|
|
||||||
|
|
||||||
g_test_init (&argc, &argv, NULL);
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
/* all the tests rely on a shared main loop */
|
/* all the tests rely on a shared main loop */
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
|
|
||||||
#include "gdbus-tests.h"
|
#include "gdbus-tests.h"
|
||||||
|
|
||||||
static const gchar *binpath;
|
|
||||||
|
|
||||||
/* all tests rely on a shared mainloop */
|
/* all tests rely on a shared mainloop */
|
||||||
static GMainLoop *loop = NULL;
|
static GMainLoop *loop = NULL;
|
||||||
|
|
||||||
@ -783,7 +781,7 @@ test_proxy (void)
|
|||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
|
||||||
/* this is safe; testserver will exit once the bus goes away */
|
/* 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_assert (g_spawn_command_line_async (path, NULL));
|
||||||
g_free (path);
|
g_free (path);
|
||||||
|
|
||||||
@ -849,7 +847,7 @@ test_async (void)
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* this is safe; testserver will exit once the bus goes away */
|
/* 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_assert (g_spawn_command_line_async (path, NULL));
|
||||||
g_free (path);
|
g_free (path);
|
||||||
|
|
||||||
@ -921,11 +919,6 @@ main (int argc,
|
|||||||
gint ret;
|
gint ret;
|
||||||
GDBusNodeInfo *introspection_data = NULL;
|
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);
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
introspection_data = g_dbus_node_info_new_for_xml (frob_dbus_interface_xml, NULL);
|
introspection_data = g_dbus_node_info_new_for_xml (frob_dbus_interface_xml, NULL);
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
|
|
||||||
#include "gdbus-tests.h"
|
#include "gdbus-tests.h"
|
||||||
|
|
||||||
static const gchar *binpath;
|
|
||||||
|
|
||||||
/* all tests rely on a global connection */
|
/* all tests rely on a global connection */
|
||||||
static GDBusConnection *c = NULL;
|
static GDBusConnection *c = NULL;
|
||||||
|
|
||||||
@ -585,17 +583,12 @@ main (int argc,
|
|||||||
gint ret;
|
gint ret;
|
||||||
gchar *path;
|
gchar *path;
|
||||||
|
|
||||||
if (g_getenv ("G_TEST_DATA"))
|
|
||||||
binpath = g_getenv ("G_TEST_DATA");
|
|
||||||
else
|
|
||||||
binpath = BUILDDIR;
|
|
||||||
|
|
||||||
g_test_init (&argc, &argv, NULL);
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
session_bus_up ();
|
session_bus_up ();
|
||||||
|
|
||||||
/* this is safe; testserver will exit once the bus goes away */
|
/* 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_assert (g_spawn_command_line_async (path, NULL));
|
||||||
g_free (path);
|
g_free (path);
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
#include <gstdio.h>
|
#include <gstdio.h>
|
||||||
|
|
||||||
const gchar *datapath;
|
|
||||||
const gchar *glib_compile_schemas;
|
const gchar *glib_compile_schemas;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -19,7 +18,7 @@ test_schema_do_compile (gpointer data)
|
|||||||
{
|
{
|
||||||
SchemaTest *test = (SchemaTest *) data;
|
SchemaTest *test = (SchemaTest *) data;
|
||||||
gchar *filename = g_strconcat (test->name, ".gschema.xml", NULL);
|
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 *argv[] = {
|
||||||
(gchar*)glib_compile_schemas,
|
(gchar*)glib_compile_schemas,
|
||||||
"--strict",
|
"--strict",
|
||||||
@ -142,11 +141,6 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
setlocale (LC_ALL, "");
|
setlocale (LC_ALL, "");
|
||||||
|
|
||||||
if (g_getenv ("G_TEST_DATA"))
|
|
||||||
datapath = g_getenv ("G_TEST_DATA");
|
|
||||||
else
|
|
||||||
datapath = SRCDIR;
|
|
||||||
|
|
||||||
if (g_getenv ("GLIB_COMPILE_SCHEMAS"))
|
if (g_getenv ("GLIB_COMPILE_SCHEMAS"))
|
||||||
glib_compile_schemas = g_getenv ("GLIB_COMPILE_SCHEMAS");
|
glib_compile_schemas = g_getenv ("GLIB_COMPILE_SCHEMAS");
|
||||||
else
|
else
|
||||||
|
@ -23,8 +23,6 @@
|
|||||||
#include "gconstructor.h"
|
#include "gconstructor.h"
|
||||||
#include "test_resources2.h"
|
#include "test_resources2.h"
|
||||||
|
|
||||||
const gchar *datapath, *libpath;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_resource (GResource *resource)
|
test_resource (GResource *resource)
|
||||||
{
|
{
|
||||||
@ -152,7 +150,7 @@ test_resource_file (void)
|
|||||||
g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_NOENT);
|
g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_NOENT);
|
||||||
g_clear_error (&error);
|
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);
|
resource = g_resource_load (path, &error);
|
||||||
g_assert (resource != NULL);
|
g_assert (resource != NULL);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
@ -173,7 +171,7 @@ test_resource_data (void)
|
|||||||
GBytes *data;
|
GBytes *data;
|
||||||
gchar *path;
|
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);
|
loaded_file = g_file_get_contents (path, &content, &content_size, NULL);
|
||||||
g_assert (loaded_file);
|
g_assert (loaded_file);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
@ -203,7 +201,7 @@ test_resource_registered (void)
|
|||||||
char buffer[128];
|
char buffer[128];
|
||||||
gchar *path;
|
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);
|
resource = g_resource_load (path, &error);
|
||||||
g_assert (resource != NULL);
|
g_assert (resource != NULL);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
@ -408,7 +406,7 @@ test_resource_module (void)
|
|||||||
{
|
{
|
||||||
char *path;
|
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);
|
module = g_io_module_new (path);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
|
|
||||||
@ -466,7 +464,7 @@ test_uri_query_info (void)
|
|||||||
gchar *path;
|
gchar *path;
|
||||||
const char *content_type;
|
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);
|
loaded_file = g_file_get_contents (path, &content, &content_size, NULL);
|
||||||
g_assert (loaded_file);
|
g_assert (loaded_file);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
@ -518,7 +516,7 @@ test_uri_file (void)
|
|||||||
gssize skipped;
|
gssize skipped;
|
||||||
gchar *path;
|
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);
|
loaded_file = g_file_get_contents (path, &content, &content_size, NULL);
|
||||||
g_assert (loaded_file);
|
g_assert (loaded_file);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
@ -641,17 +639,6 @@ int
|
|||||||
main (int argc,
|
main (int argc,
|
||||||
char *argv[])
|
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_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
_g_test2_register_resource ();
|
_g_test2_register_resource ();
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
|
|
||||||
#include "gtesttlsbackend.h"
|
#include "gtesttlsbackend.h"
|
||||||
|
|
||||||
gchar *datapath;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
gchar *cert_pems[3];
|
gchar *cert_pems[3];
|
||||||
@ -46,7 +44,7 @@ pem_parser (const Reference *ref)
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
/* Check PEM parsing in certificate, private key order. */
|
/* 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_file_get_contents (path, &pem, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (pem);
|
g_assert (pem);
|
||||||
@ -75,7 +73,7 @@ pem_parser (const Reference *ref)
|
|||||||
g_free (pem);
|
g_free (pem);
|
||||||
|
|
||||||
/* Check PEM parsing in private key, certificate order */
|
/* 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_file_get_contents (path, &pem, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (pem);
|
g_assert (pem);
|
||||||
@ -99,7 +97,7 @@ pem_parser (const Reference *ref)
|
|||||||
g_object_unref (cert);
|
g_object_unref (cert);
|
||||||
|
|
||||||
/* Check certificate only PEM */
|
/* 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_file_get_contents (path, &pem, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (pem);
|
g_assert (pem);
|
||||||
@ -122,7 +120,7 @@ pem_parser (const Reference *ref)
|
|||||||
g_object_unref (cert);
|
g_object_unref (cert);
|
||||||
|
|
||||||
/* Check error with private key only PEM */
|
/* 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_file_get_contents (path, &pem, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (pem);
|
g_assert (pem);
|
||||||
@ -144,7 +142,7 @@ from_file (const Reference *ref)
|
|||||||
gchar *path;
|
gchar *path;
|
||||||
GError *error = NULL;
|
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);
|
cert = g_tls_certificate_new_from_file (path, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (cert);
|
g_assert (cert);
|
||||||
@ -172,8 +170,8 @@ from_files (const Reference *ref)
|
|||||||
gchar *path, *path2;
|
gchar *path, *path2;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
path = g_build_filename (datapath, "cert1.pem", NULL);
|
path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "cert1.pem", NULL);
|
||||||
path2 = g_build_filename (datapath, "key.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);
|
cert = g_tls_certificate_new_from_files (path, path2, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (cert);
|
g_assert (cert);
|
||||||
@ -193,8 +191,8 @@ from_files (const Reference *ref)
|
|||||||
g_object_unref (cert);
|
g_object_unref (cert);
|
||||||
|
|
||||||
/* Missing private key */
|
/* Missing private key */
|
||||||
path = g_build_filename (datapath, "cert1.pem", NULL);
|
path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "cert1.pem", NULL);
|
||||||
path2 = g_build_filename (datapath, "cert2.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);
|
cert = g_tls_certificate_new_from_files (path, path2, &error);
|
||||||
g_assert_error (error, G_TLS_ERROR, G_TLS_ERROR_BAD_CERTIFICATE);
|
g_assert_error (error, G_TLS_ERROR, G_TLS_ERROR_BAD_CERTIFICATE);
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
@ -203,7 +201,7 @@ from_files (const Reference *ref)
|
|||||||
g_free (path2);
|
g_free (path2);
|
||||||
|
|
||||||
/* Missing certificate */
|
/* 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);
|
cert = g_tls_certificate_new_from_files (path, path, &error);
|
||||||
g_assert_error (error, G_TLS_ERROR, G_TLS_ERROR_BAD_CERTIFICATE);
|
g_assert_error (error, G_TLS_ERROR, G_TLS_ERROR_BAD_CERTIFICATE);
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
@ -213,7 +211,7 @@ from_files (const Reference *ref)
|
|||||||
/* Using this method twice with a file containing both private key and
|
/* 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
|
* 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);
|
cert = g_tls_certificate_new_from_files (path, path, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (cert);
|
g_assert (cert);
|
||||||
@ -231,8 +229,8 @@ from_files_pkcs8 (const Reference *ref)
|
|||||||
gchar *path, *path2;
|
gchar *path, *path2;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
path = g_build_filename (datapath, "cert1.pem", NULL);
|
path = g_test_build_filename (G_TEST_DISTED, "cert-tests", "cert1.pem", NULL);
|
||||||
path2 = g_build_filename (datapath, "key8.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);
|
cert = g_tls_certificate_new_from_files (path, path2, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (cert);
|
g_assert (cert);
|
||||||
@ -260,7 +258,7 @@ list_from_file (const Reference *ref)
|
|||||||
gchar *path;
|
gchar *path;
|
||||||
int i;
|
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);
|
list = g_tls_certificate_list_new_from_file (path, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert_cmpint (g_list_length (list), ==, 3);
|
g_assert_cmpint (g_list_length (list), ==, 3);
|
||||||
@ -282,7 +280,7 @@ list_from_file (const Reference *ref)
|
|||||||
g_list_free_full (list, g_object_unref);
|
g_list_free_full (list, g_object_unref);
|
||||||
|
|
||||||
/* Empty list is not an error */
|
/* 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);
|
list = g_tls_certificate_list_new_from_file (path, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert_cmpint (g_list_length (list), ==, 0);
|
g_assert_cmpint (g_list_length (list), ==, 0);
|
||||||
@ -298,37 +296,32 @@ main (int argc,
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gchar *path;
|
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_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
_g_test_tls_backend_get_type ();
|
_g_test_tls_backend_get_type ();
|
||||||
|
|
||||||
/* Load reference PEM */
|
/* 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_file_get_contents (path, &ref.cert_pems[0], NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (ref.cert_pems[0]);
|
g_assert (ref.cert_pems[0]);
|
||||||
g_free (path);
|
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_file_get_contents (path, &ref.cert_pems[1], NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (ref.cert_pems[1]);
|
g_assert (ref.cert_pems[1]);
|
||||||
g_free (path);
|
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_file_get_contents (path, &ref.cert_pems[2], NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (ref.cert_pems[2]);
|
g_assert (ref.cert_pems[2]);
|
||||||
g_free (path);
|
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_file_get_contents (path, &ref.key_pem, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (ref.key_pem);
|
g_assert (ref.key_pem);
|
||||||
g_free (path);
|
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_file_get_contents (path, &ref.key8_pem, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (ref.key8_pem);
|
g_assert (ref.key8_pem);
|
||||||
|
@ -268,7 +268,6 @@ main (int argc, char *argv[])
|
|||||||
GError *error;
|
GError *error;
|
||||||
const gchar *name;
|
const gchar *name;
|
||||||
gchar *path;
|
gchar *path;
|
||||||
const gchar *datapath;
|
|
||||||
|
|
||||||
g_test_init (&argc, &argv, NULL);
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
@ -279,18 +278,14 @@ main (int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
if (g_getenv ("G_TEST_DATA"))
|
path = g_test_build_filename (G_TEST_DISTED, "bookmarks", NULL);
|
||||||
datapath = g_getenv ("G_TEST_DATA");
|
|
||||||
else
|
|
||||||
datapath = SRCDIR;
|
|
||||||
path = g_build_filename (datapath, "bookmarks", NULL);
|
|
||||||
dir = g_dir_open (path, 0, &error);
|
dir = g_dir_open (path, 0, &error);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
while ((name = g_dir_read_name (dir)) != NULL)
|
while ((name = g_dir_read_name (dir)) != NULL)
|
||||||
{
|
{
|
||||||
path = g_strdup_printf ("/bookmarks/parse/%s", name);
|
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);
|
test_file, g_free);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
static const gchar *datapath;
|
|
||||||
|
|
||||||
static GKeyFile *
|
static GKeyFile *
|
||||||
load_data (const gchar *data,
|
load_data (const gchar *data,
|
||||||
GKeyFileFlags flags)
|
GKeyFileFlags flags)
|
||||||
@ -1343,7 +1341,7 @@ test_load_fail (void)
|
|||||||
|
|
||||||
file = g_key_file_new ();
|
file = g_key_file_new ();
|
||||||
error = NULL;
|
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_assert (!g_key_file_load_from_file (file, path, 0, &error));
|
||||||
g_free (path);
|
g_free (path);
|
||||||
g_assert_error (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_PARSE);
|
g_assert_error (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_PARSE);
|
||||||
@ -1413,7 +1411,7 @@ test_page_boundary (void)
|
|||||||
file = g_key_file_new ();
|
file = g_key_file_new ();
|
||||||
|
|
||||||
error = NULL;
|
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_key_file_load_from_file (file, path, G_KEY_FILE_NONE, &error);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
@ -1577,16 +1575,12 @@ test_roundtrip (void)
|
|||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (g_getenv ("G_TEST_DATA"))
|
g_test_init (&argc, &argv, NULL);
|
||||||
datapath = g_getenv ("G_TEST_DATA");
|
|
||||||
else
|
|
||||||
datapath = SRCDIR;
|
|
||||||
|
|
||||||
#ifdef G_OS_UNIX
|
#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
|
#endif
|
||||||
|
|
||||||
g_test_init (&argc, &argv, NULL);
|
|
||||||
g_test_bug_base ("http://bugzilla.gnome.org/");
|
g_test_bug_base ("http://bugzilla.gnome.org/");
|
||||||
|
|
||||||
g_test_add_func ("/keyfile/line-ends", test_line_ends);
|
g_test_add_func ("/keyfile/line-ends", test_line_ends);
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
static const gchar *datapath;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_basic (void)
|
test_basic (void)
|
||||||
{
|
{
|
||||||
@ -21,7 +19,7 @@ test_basic (void)
|
|||||||
gchar *path;
|
gchar *path;
|
||||||
|
|
||||||
error = NULL;
|
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);
|
file = g_mapped_file_new (path, FALSE, &error);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
@ -40,7 +38,7 @@ test_empty (void)
|
|||||||
gchar *path;
|
gchar *path;
|
||||||
|
|
||||||
error = NULL;
|
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);
|
file = g_mapped_file_new (path, FALSE, &error);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
@ -90,7 +88,7 @@ test_writable (void)
|
|||||||
char *srcpath;
|
char *srcpath;
|
||||||
gchar *tmp_copy_path;
|
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);
|
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);
|
g_file_get_contents (srcpath, &contents, &len, &error);
|
||||||
@ -137,7 +135,7 @@ test_writable_fd (void)
|
|||||||
char *srcpath;
|
char *srcpath;
|
||||||
gchar *tmp_copy_path;
|
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);
|
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);
|
g_file_get_contents (srcpath, &contents, &len, &error);
|
||||||
@ -185,7 +183,7 @@ test_gbytes (void)
|
|||||||
gchar *path;
|
gchar *path;
|
||||||
|
|
||||||
error = NULL;
|
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);
|
file = g_mapped_file_new (path, FALSE, &error);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
@ -200,11 +198,6 @@ test_gbytes (void)
|
|||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
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_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
g_test_add_func ("/mappedfile/basic", test_basic);
|
g_test_add_func ("/mappedfile/basic", test_basic);
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
static int depth = 0;
|
static int depth = 0;
|
||||||
static GString *string;
|
static GString *string;
|
||||||
static const gchar *datapath;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
indent (int extra)
|
indent (int extra)
|
||||||
@ -278,11 +277,6 @@ main (int argc, char *argv[])
|
|||||||
const gchar *name;
|
const gchar *name;
|
||||||
gchar *path;
|
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);
|
g_setenv ("LANG", "en_US.utf-8", TRUE);
|
||||||
setlocale (LC_ALL, "");
|
setlocale (LC_ALL, "");
|
||||||
|
|
||||||
@ -298,7 +292,7 @@ main (int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
error = NULL;
|
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);
|
dir = g_dir_open (path, 0, &error);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
@ -308,7 +302,7 @@ main (int argc, char *argv[])
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
path = g_strdup_printf ("/markup/parse/%s", name);
|
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);
|
test_parse, g_free);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user