Commit Graph

783 Commits

Author SHA1 Message Date
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
Emilio Pozuelo Monfort
edf94ba263 Fix race condition in gapplication/basic test
The three processes this test creates need to be executed
in order, and g_usleep was used to guarantee that.
However, under heavy load, that is not enough. Instead,
wait until the children start by making sure they have
written to stdout before proceeding any further.

https://bugzilla.gnome.org/show_bug.cgi?id=664627
2012-11-30 00:07:58 +01:00
Sebastian Dröge
c9affa778e Revert "Fix compilation on Android with the bionic C library"
This reverts commit cb0ed84d40.

It wasn't meant to be pushed yet.
2012-11-28 16:55:12 +01:00
Sebastian Dröge
cb0ed84d40 Fix compilation on Android with the bionic C library 2012-11-28 16:32:48 +01:00
Colin Walters
ed5c17e11f GMemoryOutputStream: Add new _resizable() constructor usable from bindings
Really, the memory output stream API is too warped around the model
where it's a fixed size buffer that you've already allocated.  Even in
C, I find myself always wanting to use it to just accumulate data into
an arbitrary-sized buffer it allocates.

Unfortunately, it's also not usable from bindings because it's not
common to bind g_free() and g_realloc(), but if you just pass NULL, you
get the default of a fixed size, which is useless as per above.

I am going to use this from a gjs test case, and the GSubprocess test
cases also will use it.

https://bugzilla.gnome.org/show_bug.cgi?id=688931
2012-11-27 20:45:21 -05:00
Paolo Borelli
ee8080cc0b Add GApplication local_command_line test
Assert that startup and shutdown are not called if we return TRUE from
local_command_line
2012-11-24 19:21:54 +01:00
Matthias Clasen
4ffa472438 Add a test for the GAppLaunchContext::launched signal 2012-11-21 21:20:25 -05:00
Matthias Clasen
ace7b0fd86 Add a test for new GDesktopAppInfo getters 2012-11-21 21:13:01 -05:00
Dan Winship
d9e8feae7c win32: make gio/tests/gdbus-proxy.c compile
win32 doesn't have kill(), so this won't even compile on Windows
unless that is ifdeffed out. The test probably still doesn't *work*,
but...

https://bugzilla.gnome.org/show_bug.cgi?id=688109
2012-11-15 14:19:06 -05:00
Dan Winship
f248c86b0a win32: move some code into #ifdef G_OS_UNIX
Fix various bits of code/declarations that are only used by G_OS_UNIX
but were still visible to G_OS_WIN32.

https://bugzilla.gnome.org/show_bug.cgi?id=688109
2012-11-15 14:19:05 -05:00
Dan Winship
9fb3082070 Revert "Return correct value for g_socket_get_available_bytes() on Windows and OSX"
This neither compiles nor does what it's supposed to on Windows.

This reverts commit 1e598600a1.
2012-11-11 14:14:04 -05:00
Sebastian Dröge
1e598600a1 Return correct value for g_socket_get_available_bytes() on Windows and OSX
https://bugzilla.gnome.org/show_bug.cgi?id=686786
2012-11-09 21:57:50 -05:00
John Ralls
b65dac802e Fix poll able streams for Darwin (and probably BSD)
Darwin's poll doesn't change revents if there are no available events, though it returns 0. Initialize the fd.revents to 0 so that the test passes.

That reveals a test failure, though, because with socket streams it takes time for an event to pass through the socket. Provide an 80-usec delay to allow time for the propagation.
2012-11-09 09:23:01 -08:00
Colin Walters
753494a25e tests/buffered-input-stream: Fix size of parameter passed
buffer-size is guint, but the public API is gsize for some reason.

Tested-By: gustavold@linux.vnet.ibm.com

https://bugzilla.gnome.org/show_bug.cgi?id=687801
2012-11-07 09:51:20 -05:00
Dan Winship
7b1f8c582a gtask: bump the max thread pool size up to 100 to avoid stalls/deadlocks
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=686810 for now.
https://bugzilla.gnome.org/show_bug.cgi?id=687223 discusses a nicer
fix for later.
2012-11-02 10:19:06 -04:00
Colin Walters
dc4922af21 test-pipe-unix: Add missing include
Fixes the build with -Werror=missing-prototypes.

https://bugzilla.gnome.org/show_bug.cgi?id=687385
2012-11-02 09:03:52 -04:00
Colin Walters
84475e4320 build: Prototype GType accessors for private classes
Otherwise we fail to build with -Werror=missing-prototypes.

https://bugzilla.gnome.org/show_bug.cgi?id=687385
2012-11-01 20:12:02 -04:00