Commit Graph

799 Commits

Author SHA1 Message Date
Dan Winship
e3d1869ee3 tests: port from g_test_trap_subprocess() to g_test_trap_fork()
https://bugzilla.gnome.org/show_bug.cgi?id=679683
2013-05-13 12:10:52 -04:00
Dan Winship
f4a1882341 GProxyAddressEnumerator: add default-port property
Although none of the in-tree GSocketConnectable types need it, other
types (like SoupAddress) may find it useful to be able to pass a URI
and a default-port to GProxyAddressEnumerator separately (the same way
you can with GNetworkAddress). So add a default-port property.

https://bugzilla.gnome.org/show_bug.cgi?id=698877
2013-05-05 16:50:43 -04:00
Mike Ruprecht
c027e88a30 gio/tests: Find "true" in PATH opposed to hardcoding the location
Not all systems have /usr/bin/true. Some have it in /bin/true.
Instead of trying to guess a hardcoded path to find it, let
g_app_info_create_from_commandline() internally search PATH
to find the program.

https://bugzilla.gnome.org/show_bug.cgi?id=698655
2013-04-25 02:54:14 -05:00
Ryan Lortie
c91af2ab44 Test GUnixSocketAddress construction
This test fails without the previous fix and works properly with it.

https://bugzilla.gnome.org/show_bug.cgi?id=698686
2013-04-23 14:36:07 -04:00
Jasper St. Pierre
63a0cc3f8d tests: Fix appinfo test 2013-04-22 13:12:20 -04:00
Ryan Lortie
c16f914b40 GIcon: add g_icon_[de]serialize()
Add support for serialising a GIcon to a GVariant and deserialising the
result back to a GIcon.

This solves a number of problems suffered by the existing to_string()
API, primarily these:

 - not forcing the icon to be a utf8 string means that we can
   efficiently encode a PNG (ie: just give the array of bytes)

 - there is no need to ensure that proper types are loaded before using
   the deserialisation interface.  'Foreign' icon types will probably
   emit a serialised format the deserialises to a GBytesIcon.

We additionally clearly document what is required for being a consumer
or implementation of #GIcon.

Further patches will be required to GdkPixbuf and GVfsIcon to bring
their implementations in line with the new rules (essentially: introduce
implementations of the new serialize() API).

https://bugzilla.gnome.org/show_bug.cgi?id=688820
2013-04-21 16:31:14 -04:00
Sebastian Dröge
bcbaf1bef0 Fix compilation on Android with the bionic C library
https://bugzilla.gnome.org/show_bug.cgi?id=689223
2013-04-16 13:24:26 +02:00
Lars Uebernickel
00f6d78125 g_dbus_connection_signal_subscribe: add path and namespace matching
https://bugzilla.gnome.org/show_bug.cgi?id=695156
2013-04-08 15:59:39 +02:00
Ryan Lortie
8cddb54659 gaction: add parser for detailed action names
Expand and formalise the syntax for detailed action names, adding a
well-documented (and tested) public parser API for them.

Port the only GLib-based user of detailed action names to the new API:
g_menu_item_set_detailed_action().  The users in Gtk+ will also be
ported soon.

https://bugzilla.gnome.org/show_bug.cgi?id=688954
2013-04-01 16:53:54 -04:00
Colin Walters
978571d854 g_file_copy(): Ensure G_FILE_COPY_OVERWRITE preserves permissions
We need to close the stream *before* applying the file modes, because
g_file_replace() allocates a temporary file.  At the moment we're
applying the modes to the extant file, then immediately rename()ing
over it with the default perms.

This regressed with commit 166766a89f.

The real fix here is to have g_file_create_with_info() so that we can
atomically create a file with the permissions we want.

https://bugzilla.gnome.org/show_bug.cgi?id=696014
2013-03-25 16:32:39 -04:00
Tristan Van Berkom
dd0ea5dcc2 Added examples to GTestDBus documentation 2013-03-21 16:37:21 +09:00
Emilio Pozuelo Monfort
605c4ca24e live-g-file: test hidden files
We test for traditional Unix dot-leading files as well as
for files listed in the .hidden file.

https://bugzilla.gnome.org/show_bug.cgi?id=695147
2013-03-13 09:41:09 -04:00
Martin Pitt
97050e503f Fix /appinfo/mime tests
Commit f641699 (for bug 675333) introduced a check whether the Exec= program in
a .desktop actually exists. This broke the /appinfo/mime/* test cases which use
executable names like "my_app".

Use real ones instead (like "echo" and "sleep"), and add a new
/appinfo/mime/ignore-nonexisting test case which verifies that
g_desktop_app_info_new() indeed ignores nonexisting executables.

https://bugzilla.gnome.org/show_bug.cgi?id=695191
2013-03-12 07:07:07 +01:00
Jasper St. Pierre
155f599b20 tests/appinfo: Fix a typo
The environment variable name is BLA, not BAR, so if BAR is
set for some strange reason, the test fails.
2013-03-06 20:32:53 -05:00
Colin Walters
156b14cde5 build: Add --disable-compile-warnings
Some (broken) toolchains for example trip up
-Werror=missing-prototypes in system headers.  This patch allows
people to skip the formerly hardcoded "baseline" warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=694757
2013-02-27 08:34:01 -05:00
Dan Winship
8a77f7bb18 gnetworkaddress: preserve IPv6 scope ID in IP literals
If a GNetworkAddress is created with a hostname like "fe80::xxx%em1",
make sure that the scope_id corresponding to "em1" is present in the
GSocketAddresses it returns when used as a GSocketConnectable.

https://bugzilla.gnome.org/show_bug.cgi?id=684404
2013-02-15 09:10:00 -05:00
Dan Winship
ee17a54c28 GSimpleProxyResolver: new simple GProxyResolver class
Add GSimpleProxyResolver, for letting people do static proxy
resolution, and to use as a base class for other resolvers (such as
GProxyResolverGnome).

https://bugzilla.gnome.org/show_bug.cgi?id=691105
2013-02-14 10:24:14 -05:00
Dan Winship
7c49869eae GSocketClient: add proxy-resolver property
Add a proxy-resolver property to GSocketClient, to allow overriding
proxy resolution in situations where you need to force a particular
proxy rather than using the system defaults.

https://bugzilla.gnome.org/show_bug.cgi?id=691105
2013-02-14 10:24:14 -05:00
Simon McVittie
d200208d2b g_dbus_address_escape_value: add
This is a GLib reimplementation of dbus_address_escape_value().
It's useful if you want to construct a D-Bus address from pieces:
for instance, if you have a listening Unix socket whose path is known,
and you want to connect a D-Bus peer to it.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=693673
Reviewed-by: Colin Walters <walters@verbum.org>
[amended to add Since: 2.36 as per review]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-02-13 20:42:58 +00:00
Matthias Clasen
50850cdf98 Use g_timeout_add_seconds for some long timeouts
https://bugzilla.gnome.org/show_bug.cgi?id=692618
2013-02-03 10:21:20 -05:00
Matthias Clasen
ab328469f5 Silence automake
automake doesn't like INCLUDES anymore.
2013-02-02 22:54:15 -05:00
Руслан Ижбулатов
b1e02c7e32 Fix gio tests makefile for W32
While compiling, libtool will say that undefined symbols are not allowed, and
will refuse to make you a dll. This is only one line, easy to miss. And it
doesn't prevent `make' from completing successfully.

The code this patch adds is from other Makefile.am files that use
$(no_undefined). It's absence in gio is, most likely, an oversight.

Fixes #692058
2013-02-02 00:25:27 -05:00
Dan Winship
a60014f1b6 GInetSocketAddress: fix the byte order of flowinfo and scope_id
The flowinfo and scope_id fields of struct sockaddr_in6 are in host
byte order, but the code previously assumed they were in network byte
order. Fix that.

This is an ABI-breaking change (since before you would have had to use
g_ntohl() and g_htonl() with them to get the correct values, and now
that would give the wrong values), but the previous behavior was
clearly wrong, and no one ever reported it, so it is likely that no
one was actually using it.

https://bugzilla.gnome.org/show_bug.cgi?id=684404
2013-01-30 16:46:02 -05:00
Dan Winship
82f2ee90fe .gitignore updates 2013-01-26 10:09:33 -05:00
Matthias Clasen
1eb5c7cedd Plug a small memleak in gdbus-export test 2013-01-25 20:09:26 -05:00
Dan Winship
578b657f95 gio/tests: add some more async stream tests
Add read_async() and skip_async() tests to buffered-input-stream.

Fix and re-enable filter-streams's existing close_async() tests, and
add read_async(), skip_async(), and write_async() tests as well. Also,
redo the tests to use dummy GFilterInputStream and GFilterOutputStream
subclasses rather than GBufferedInput/OutputStream, so that we're
testing the base filter stream implementations of everything (since
the buffered stream overrides are already getting tested in the
buffered-input-stream and buffered-output-stream tests anyway).

Add a skip_async() test to unix-streams. (This one would crash without
the bugfix in the previous commit.)
2013-01-16 10:17:15 -05:00
Ryan Lortie
5d42fdd068 visibility: Use a separate CFLAGS variable
We only want to control the default visibility for our five main
installable libraries: libglib, libgthread, libgmodule, libgobject,
libgio.  We should therefore only set -fvisibility=hidden when building
those.

Use a separate substitution variable for this purpose.

Using CFLAGS directly leads to some modules built in testcases not
exporting their symbols (and then the tests fail).  It also affects the
fam file monitoring module.

Colin had originally done it this way in his visibility patch series but
I failed to understand why so I didn't copy it.  Now I do.

Also: revert changes made to two testcases in an attempt to work around
this issue.

https://bugzilla.gnome.org/show_bug.cgi?id=691756
2013-01-14 23:31:59 -05:00
Matthias Clasen
d4f0ae2c69 Fix distcheck
With gdbus-testserver now being a compiled program, it no longer
lives in SRCDIR.
2013-01-14 22:22:41 -05:00
Matthias Clasen
ba4a3849c6 Remove an unused function 2013-01-14 16:14:28 -05:00
Ryan Lortie
2c13657b0f tests: introduce a small hack for visibility
One of our testcases builds a small giomodule for testing the loading of
modules containing resources.  Unfortunately, this module gets built
using the same CFLAGS as the rest of GLib, including the visibility
flags (defaulting to hidden).

Use "config.h" to get a declaration of _GLIB_EXTERN that will export
symbols properly and use it to annotate the necessary APIs.
2013-01-14 00:13:00 -05:00
Antoine Jacoutot
cb1876b4a7 ipv6_v4mapped: force pass even if we don't speak IPv4
Some OS (e.g. OpenBSD) do not implement IP v4-mapped addresses. When
this is the case, then we get a "Connection refused", so force the test
to pass to that further tests can run.

https://bugzilla.gnome.org/show_bug.cgi?id=686058
2013-01-09 16:29:29 +01:00
Dan Winship
1d0687aa81 gio/tests: fix a few more gdbus-testserver.py references
that got missed in Matthias's earlier patch
2013-01-06 17:13:11 -05:00
Dan Winship
f42347d82e GMemoryInputStream: fix skip_async()
a5876e5f made GMemoryInputStream subclassable, but accidentally broke
read_async() and skip_async() in the process. The immediately
following e7983495 fixed read_async() (and added a test for it), but
skip_async() accidentally got... skipped.

Fix it now and add a test for it.

Also, GMemoryInputStream's skip_async() was assuming that skip() could
never fail, which is true of its own implementation, but might not be
true of a subclass's, so do proper GError handling too.
2013-01-05 13:29:01 -05:00
Rico Tzschichholz
330c6c116e gio/tests: Drop superfluous dbus-1 dependencies of gdbus-auth 2013-01-04 21:36:37 +01:00
Rico Tzschichholz
125833d427 gio/tests: Fix make dist
Missing bit of 32c9254277
2013-01-04 20:37:27 +01:00
David Zeuthen
101ddfe22f In gdbus-auth test, use g_unsetenv(), not g_setenv() with a NULL value
Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2013-01-03 13:35:10 -05:00
Matthias Clasen
361fe28fb9 Drop gdbus-testserver.py
The tests are using the C version of gdbus-testserver now.
This means we no longer rely on dbus-python for 'make check'.
https://bugzilla.gnome.org/show_bug.cgi?id=675856
2013-01-03 13:16:22 -05:00
Matthias Clasen
663ed23bc5 Use the C gdbus-testserver in tests 2013-01-03 13:15:15 -05:00
Matthias Clasen
416fa3b9ef Add a C version of gdbus-testserver.py
This will let us drop the dbus-python dependency.
The C version does not 100% reproduce all the hash table
and array manipulation of the python version, but the tests
do not rely on it anyway.
2013-01-03 13:14:26 -05:00
David Zeuthen
2652dc1357 GDBus: Avoid use of libdbus-1 in authentication tests
This greatly simplifies the test since everything is now in a single
process and possible bugs / quirks in libdbus-1 will not interfere
with the tests. On the other hand, we no longer test interoperability
with libdbus-1. This is somewhat moot, however, since other tests that
involve a message bus (e.g. GTestDBus users which include most of the
GDBus test suite itself) will test this.

Also ensure that we don't pollute existing D-Bus keyrings for the
DBUS_COOKIE_SHA1 authentication method (e.g. files in the
~/.dbus-keyrings directory) by setting the environment variables
G_DBUS_COOKIE_SHA1_KEYRING_DIR and
G_DBUS_COOKIE_SHA1_KEYRING_DIR_IGNORE_PERMISSION.

All in all, this change avoids some thorny issues where the GDBus and
libdbus-1 implementations disagree on whether an item in the D-Bus
keyring is still valid (items have an age etc.). In reality, since the
DBUS_COOKIE_SHA1 authentication method is never used in production,
this is never hit in production. This bug was, however, frequently hit
if you just ran the test suite repeatedly for 15 minutes or so.

Also add TODO items to mention that we currently don't test corner
cases involving

 - DBUS_COOKIE_SHA1 timeouts
 - libdbus-1 interoperability

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2013-01-03 12:12:55 -05:00
Matthias Clasen
12ad403a43 Remove a failing test
Since we stripped g_credentials_set_pid(), the test for
g_credentials_get_pid() can't succeed anymore, so remove it.
2012-12-29 00:03:09 -05:00
Tristan Van Berkom
32c9254277 Adding test coverage for GTestDBus activating in-tree services.
https://bugzilla.gnome.org/show_bug.cgi?id=690543
2012-12-28 21:28:28 -05:00
Matthias Clasen
0178402c6d Revert "tests: port from g_test_trap_subprocess() to g_test_trap_fork()"
This reverts commit ea06ec8063.
2012-12-19 15:20:37 -05:00
Simon McVittie
2fe36a2238 Check that credentials pass through D-Bus on supported platforms
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=687920
2012-12-19 15:14:35 -05:00
Simon McVittie
32bfd46c7b GCredentials: add a regression test
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=687920
2012-12-19 15:14:27 -05:00
Dan Winship
ea06ec8063 tests: port from g_test_trap_subprocess() to g_test_trap_fork()
(or, in a few cases, to g_test_expect_message())

https://bugzilla.gnome.org/show_bug.cgi?id=679683
2012-12-19 14:35:10 -05:00
Dan Winship
07bb8097e5 gtask: don't deadlock when tasks block on other tasks
If tasks block waiting for other tasks to complete then the system can
end up starved for threads. Avoid this by bumping up max-threads in
that case.

This also reverts 7b1f8c58 and reverts max-threads for GTask's
GThreadPool back to 10.

https://bugzilla.gnome.org/show_bug.cgi?id=687223
2012-12-18 13:19:08 -05:00
Jasper St. Pierre
3c87ab97ff gfileenumerator: Add a g_file_enumerator_get_child method
This is a new convenience method designed to simplify some use
cases of GFileEnumerator, by making it easy to get the next file
from a file enumerator.

https://bugzilla.gnome.org/show_bug.cgi?id=690083
2012-12-13 21:38:18 -05:00
Dan Winship
b377e69685 Add gnetworking.h
Install a public "gnetworking.h" header that can be used to include
the relevant OS-dependent networking headers. This does not really
abstract away unix-vs-windows however; error codes, in particular,
are incompatible.

gnetworkingprivate.h now contains just a few internal URI-related
functions

Also add a g_networking_init() function to gnetworking.h, which can be
used to explicitly initialize OS-level networking, rather than having
that happen as a side-effect of registering GInetAddress.

https://bugzilla.gnome.org/show_bug.cgi?id=623187
2012-12-12 15:20:22 +01:00
Dan Winship
afdb2abb13 gio: Don't leak the temp file when g_file_replace() fails or is cancelled
If the temp file still exists at the end of the close operation,
unlink it.

https://bugzilla.gnome.org/show_bug.cgi?id=629301
2012-12-10 17:04:05 +01:00