Commit Graph

1318 Commits

Author SHA1 Message Date
Milan Crha
ca0add4b8a gnetworkmonitor: Fix use-after-free when using from another thread
When using g_network_monitor_get_default() from another thread, it’s
possible for network-changed events to be processed after an instance of
GNetworkMonitor has been disposed, causing use-after-free problems.

Fix that by moving some of the initialisation into the GInitable.init()
chain, rather than in a main context idle callback.

This includes a unit test which probabilistically reproduces the bug
(but can’t do so deterministically due to it being a race condition).

Commit amended by Philip Withnall <withnall@endlessm.com> before
pushing.

https://bugzilla.gnome.org/show_bug.cgi?id=793727
2018-04-11 15:03:43 +01:00
Christophe Fergeau
fbbad525a5 gsettings: Fix leaks and assertion on range binding failures
When using g_settings_bind(), if a range binding triggers a range check
failure, g_settings_binding_property_changed() will return early, but it
won't cleanup properly causing some leaks. The binding will also still
be marked as 'running', which causes an assertion failure when trying to
free it:
"g_settings_binding_free: assertion failed: (!binding->running)"

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=794805
2018-04-11 10:42:54 +01:00
Iain Lane
ec20cb4402 tests/network-monitor: Always use the dummy proxy resolver
If glib-networking is installed and built with libproxy support, this
test will use it. If a proxy is set in the environment, we might get
correctly told to go through it for certain accesses. However, this isn't
going to work, because the testsuite monkeys with the network monitor to
tell it that all addresses - including the proxy - aren't reachable.

We're trying to check if adding networks to a GNetworkMonitor works in
general. Proxies just get in the way here, so let's use the built in
dummy proxy resolver which just tells us that all URLs are directly
accessible.

https://bugzilla.gnome.org/show_bug.cgi?id=794801
2018-04-10 10:35:45 +01:00
Emmanuele Bassi
ac42183c33 Initialize variable
The `mount_monitor` variable is only set if the boolean
`with_mount_monitor` variable is set to TRUE, but the compiler does not
know that, so it'll warn when calling `g_clear_object()` even if the
clearing operation is gated with the same boolean.

Initializing with NULL does not cost us anything, and eliminates a
conditional branch.

https://bugzilla.gnome.org/show_bug.cgi?id=794732
2018-03-28 11:49:59 +01:00
Philip Withnall
7c1f38b1c9 gapplication: Tighten up application ID validation
Tighten up the validation of application IDs so they are always exactly
D-Bus well-known names. This is a slight change to the accepted format,
but since anyone using the API with an application ID which was
previously valid, but which was not a valid D-Bus well-known name, would
have received an error from D-Bus when their application tried to
register on the bus, I think this break is acceptable.

It will affect any applications which have application IDs which are not
valid D-Bus well-known names, and which use the G_APPLICATION_NON_UNIQUE
flag. From a quick search in Debian Codesearch, no C applications use
that flag.

Update the documentation to use the rules from the D-Bus specification,
including the latest advice discouraging use of hyphens:

https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus

Update the tests:
 • Add the examples from the documentation to validate them.
 • Especially the venerable 7-zip.org example.
 • Move a couple of tests from expected-failure to expected-success:
   they are valid D-Bus well-known names even if they’re a bit weird.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=793400
2018-03-13 12:45:13 +00:00
Philip Withnall
b046c5b772 tests: Use modern test assertions in GApplication test
This will make the assertion failure messages a little more useful, and
prevent the assertions being compiled out with G_DISABLE_ASSERT.
Introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=793400
2018-03-13 12:45:13 +00:00
Ernestas Kulik
03e86d000f Remove HAVE_CONFIG_H defs and uses
Since GLib files are only meant to be built as part of GLib, config.h
always exists, so the checks are more or less pointless.

https://bugzilla.gnome.org/show_bug.cgi?id=793399
2018-02-21 13:57:10 +00:00
Ernestas Kulik
4f942122b7 gio: tests: modules: declare _get_type prototype
GCC complains about non-static functions being defined without a
previous prototype, even if they themselves provide one.

https://bugzilla.gnome.org/show_bug.cgi?id=793399
2018-02-21 10:56:31 +00:00
Emmanuele Bassi
d8a3492fce Allow running gdbus-peer inside a container
The /etc/machine-id inside a Docker container is allowed to be empty, so
we need to check for that case.

https://bugzilla.gnome.org/show_bug.cgi?id=793635
2018-02-20 13:49:21 +00:00
Philip Withnall
22b224862c tests: Add a debug message to gdbus-peer test
This might help diagnose the CI test failure here:
https://gitlab.gnome.org/GNOME/glib/-/jobs/8222

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-02-19 11:11:36 +00:00
Ernestas Kulik
c01c255895 tests: data-input-stream: fix -Wduplicated-branches
The fix makes things a bit awkward, but it seems to work just fine.

https://bugzilla.gnome.org/show_bug.cgi?id=793399
2018-02-16 17:38:26 +00:00
Philip Withnall
66ab836f5a gsubprocess: Fix a critical calling communicate() with no pipes
If calling g_subprocess_communicate() on a GSubprocess with no
stdout/stderr pipe, a critical warning would be emitted from
g_memory_output_stream_steal_as_bytes(), as it would be called on a NULL
output stream.

Fix that, improve the relevant GIR annotations, and expand the unit
tests to cover it (and various other combinations of flags).

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=793331
2018-02-13 16:27:32 +00:00
Philip Withnall
5ed77c1104 gdatainputstream: Deprecate read_until() in favour of read_upto()
g_data_input_stream_read_upto() was introduced in 2.26; now it’s GLib
2.56, we can probably deprecate the old versions (since the handling of
consuming the stop character differs between the sync and async versions
of it).

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=584284
2018-02-02 10:05:55 +01:00
Bastien Nocera
88366621ee GSimpleProxyResolver: Add test case for broken hostname
https://bugzilla.gnome.org/show_bug.cgi?id=772989
2018-02-01 14:58:28 +00:00
Colin Walters
4808a957b5 GFile: Add g_file_peek_path()
This is a variant of g_file_get_path() which returns a const string to
the caller, rather than transferring ownership.

I've been carrying `gs_file_get_path_cached()` in libgsystem and it
has seen a lot of use in the ostree and flatpak codebases.  There are
probably others too.

I think language bindings like Python/Gjs could also use this to avoid
an extra malloc (i.e. we could transparently replace
`g_file_get_path()` with `g_file_peek_path()`.

(Originally by Colin Walters. Tweaked by Philip Withnall to update to
2.56, change the function name and drop the locking.)

https://bugzilla.gnome.org/show_bug.cgi?id=767976
2018-01-15 18:26:56 +00:00
Simon McVittie
2685a533af gdbus-threading test: Allow even longer for test_method_calls_in_thread
This should take 4 seconds + overhead, but on a slow or heavily
loaded system, there's no guarantee that it won't take significantly
longer.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=792364
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=884660
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-01-09 13:10:38 +00:00
Florian Müllner
a55bfeee41 gdesktopappinfo: Add g_desktop_app_info_get_locale_string()
Custom desktop file fields may be translated, but there is currently
no non-hacky way to look up the localized value; fill get gap with
a small wrapper around g_key_file_get_locale_string().

https://bugzilla.gnome.org/show_bug.cgi?id=779413
2018-01-08 16:28:34 +01:00
Philip Withnall
eba53aa07e build: Add missing test GSchema XML file to dist list
This was introduced in bug #742997, but not added to the Makefile.am, so
it’s missing from tarballs.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody

https://bugzilla.gnome.org/show_bug.cgi?id=792322
2018-01-08 12:05:21 +00:00
Christoph Reiter
cf93b27ceb meson: fix static build under Windows
Properly define GLIB/GOBJECT_STATIC_COMPILATION when static build is enabled.
Use library() instead of shared_library() to allow selecting static builds.

https://bugzilla.gnome.org/show_bug.cgi?id=784995
2018-01-04 22:21:40 +01:00
howetuft
0e22d19a11 Bug-790839 GApplication command line --help enhancements
In order to enrich information displayed by GApplication command line
handling when --help is invoked, 3 new methods are proposed:
. g_application_set_option_context_parameter_string
. g_application_set_option_context_summary
. g_application_set_option_context_description
Those methods interact with the GApplication's internal GOptionContext
which is created for command line parsing in g_application_parse_command_line.
(please refer to the GOptionContext class for more information about option
context, parameter string, summary and description.)

To illustrate the 3 methods, an example is provided:
. gapplication-example-cmdline4.c
2018-01-03 11:08:37 +00:00
Daniel Boles
b441c21a09 gdbus-test-codegen: Cast to void* to printf "%p"
to suppress a compiler error with stricter warnings enabled (GCC):

gdbus-test-codegen.c: In function ‘on_handle_get_self’:
gdbus-test-codegen.c:403:26: error: format ‘%p’ expects argument of type
 ‘void *’, but argument 2 has type ‘GThread * {aka struct _GThread *}’
 [-Werror=format=]
   s = g_strdup_printf ("%p", g_thread_self ());

https://bugzilla.gnome.org/show_bug.cgi?id=792099
2018-01-01 17:23:23 +00:00
Simon McVittie
8fef0a9cd3 gmenumodel test: Wait for the expected events to happen
Previously, we waited an arbitrary 100ms or 200ms and then asserted
that the events had happened, but that might fail if the machine is
slow or heavily loaded.

We still wait for an arbitrary time for negative tests (asserting
that no more signals are received) because we don't have any way
to do better here.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=884661

https://bugzilla.gnome.org/show_bug.cgi?id=791744
2017-12-18 18:56:35 +00:00
Simon McVittie
ea159a9e1a gmenumodel test: If something goes wrong, don't wait forever
I'm about to add some loops that would otherwise wait indefinitely.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=884661

https://bugzilla.gnome.org/show_bug.cgi?id=791744
2017-12-18 18:56:35 +00:00
Havard Graff
db7c1180b3 meson: add libintl when linking gio-tests on OSX
https://bugzilla.gnome.org/show_bug.cgi?id=791460
2017-12-14 16:21:46 +05:30
Mario Sanchez Prada
637a298960 gio/tests/appinfo: New test for launch with "appId-less" applications
New test to make sure we exercise the code paths in gdesktopappinfo.c
that get triggered when g_desktop_app_info_launch_uris_with_spawn()
is used (i.e. unknown app ID, no session bus), both for when either
a single URI or multiple ones are expected by the application.

https://bugzilla.gnome.org/show_bug.cgi?id=791337
2017-12-08 13:47:23 +00:00
Philip Withnall
06719a86b2 docs: Drop unnecessary <!-- -->s from gtk-doc comments
Putting a <!-- --> in plural<!-- -->s was an old hack used to fix
linking the symbol with gtk-doc when gtk-doc didn’t know about plural
forms. gtk-doc does now know about plural forms, so the hack can be
removed.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-29 17:50:27 +00:00
Philip Withnall
a2a4a10299 tests: Fix some minor memory leaks in gdbus-test-codegen
It’s not entirely leak-free, but it’s better than before.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=741167
2017-11-28 14:28:50 +00:00
Tim Waugh
d35d9b7911 codegen: fix array out-param annotations
When using gdbus-codegen to produce generated code for a method with
an out parameter with a signature like 'as', make sure to include
an "(array)" annotation for that parameter.

(Reworked by Philip Withnall to improve code formatting.)

https://bugzilla.gnome.org/show_bug.cgi?id=741167
2017-11-28 14:28:49 +00:00
Daniel Macks
deeacce18a Do not load systemwide giomodules during self-test
$libdir/gio/modules/*.so on the live build machine are supplied by
third parties, so we should not look there while testing ourselves.

https://bugzilla.gnome.org/show_bug.cgi?id=780309
2017-11-20 10:23:23 +00:00
Daiki Ueno
c71098ddab tests/gmenumodel: Add test cases using peer-to-peer D-Bus connection
https://bugzilla.gnome.org/show_bug.cgi?id=720380
2017-11-17 11:28:43 +00:00
Christian Hergert
ed78f30c5e file: add tests for g_file_load_bytes()
This adds a test for both g_file_load_bytes() and the
asynchronous form g_file_load_bytes_async().

https://bugzilla.gnome.org/show_bug.cgi?id=790272
2017-11-15 04:10:23 -08:00
Christian Hergert
5464461e4c gresource: avoid allocations in enumerate_children()
In the vast majority of cases, we can avoid temporary
allocations for paths in g_resources_enumerate_children().

In the case we need to add a suffix "/", we can usually just
build the path on the stack. In other cases, we can completely
avoid the strdup, which appears to only have been added for
readability. If the path is really long, we fallback to doing
what we did before, and use g_strconcat().

In the case of Builder, this saved 5.3mb of temporary
allocations in the process of showing the first application
window.

https://bugzilla.gnome.org/show_bug.cgi?id=790275
2017-11-15 03:24:29 -08:00
Christian Hergert
38ffcd298c gresourcefile: simplify path canonicalization
Previously, the path canonicalization for resources had liberal use of
strlen() and memmove() while walking through the path. This patch avoids
any secondary strlen() and removes all use of memmove().

A single allocation is created up front as we should only ever need one
additional byte more than then length of the incoming path string.

To keep the implementation readable, the mechanics are kept in external
functions. memrchr() was not used due to its lack of portability.

This is faster in every test case I've tested. Paths that contain
relative ../ have the most speedup.

https://bugzilla.gnome.org/show_bug.cgi?id=790310
2017-11-14 15:13:44 -08:00
Sebastian Dröge
7b60708204 GResource – Create an internal copy of the GBytes if it is not pointer aligned
https://bugzilla.gnome.org/show_bug.cgi?id=790030
2017-11-14 10:39:45 +02:00
Cosimo Cecchi
44d6052584 gfile: add g_file_new_build_filename()
This is a convenience C API that combines g_build_filename() with
g_file_new_for_path().

https://bugzilla.gnome.org/show_bug.cgi?id=788488
2017-11-07 08:25:28 -08:00
Daniel Macks
d88d90c3c8 Exec=true (seach via PATH) instead of hardcoding /bin/true
...otherwise this .desktop is omitted on platforms that have it
elsewhere.

https://bugzilla.gnome.org/show_bug.cgi?id=731705
2017-11-03 20:16:52 +00:00
Jiří Techet
6acaca8831 gio: Show icons based on file's mime type on OS X
The patch basically just grabs the implementation of g_content_type_get_icon_internal()
from gcontenttype.c - the only difference is that it first converts UTI to MIME using
g_content_type_get_mime_type() and at the end frees this temporary MIME type.

https://bugzilla.gnome.org/show_bug.cgi?id=788936
2017-11-03 12:04:33 +00:00
Руслан Ижбулатов
53bd6a359f W32: Add a stat() implementation for private use
This commit adds new W32-only functions to gstdio.c,
and a new header file, gstdioprivate.h.
These functions are:
g_win32_stat_utf8()
g_win32_lstat_utf8()
g_win32_fstat()
and they fill a private structure, GWin32PrivateStat,
which has all the fields that normal stat has, as well as some
extras.

These functions are then used throughout glib and gio to get better
data about the system. Specifically:
* Full, 64-bit size, guaranteed (g_stat() is forced to use 32-bit st_size)
* Full, 64-bit file identifier (st_ino is 0 when normal stat() is used, and still is)
* W32 File attributes (which stat() doesn't report); in particular, this allows
  symlinks to be correctly identified
* Full, 64-bit time, guaranteed (g_stat() uses 32-bit st_*time on 32-bit Windows)
* Allocated file size (as a W32 replacement for the missing st_blocks)

st_mode remains unchanged (thus, no S_ISLNK), so when these are given back to
glib users (via g_stat(), for example, which is now implemented by calling g_win32_stat_utf8),
this field does not contain anything unexpected.

g_lstat() now calls g_win32_lstat_utf8(), which works on symlinks the way it's supposed to.

Also adds the g_win32_readlink_utf8() function, which behaves like readlink()
(including its inability to return 0-terminated strings and inability to say how large
the output buffer should be; these limitations are purely for compatibility with
existing glib code).

Thus, symlink support should now be much better, although far from being complete.

A new W32-only test in gio/tests/file.c highlights the following features:
* allocated size
* 64-bit time
* unique file IDs

https://bugzilla.gnome.org/show_bug.cgi?id=788180
2017-11-01 12:46:38 +00:00
Stef Walter
0f82ff12ea gdbus-proxy: Fix erroneous timeout during following tests
Modified by Philip Withnall to amend a second instance in the same
file.

https://bugzilla.gnome.org/show_bug.cgi?id=711809
2017-10-26 12:01:05 +01:00
Philip Withnall
1e4221a3f7 gio: Add API for identifying system FS types and device paths
This is needed by gnome-control-center and gnome-settings-daemon; it
makes existing checks from gunixmounts.c public.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=788927
2017-10-26 00:19:23 +01:00
Michael Catanzaro
c5202bc5e9 Add socket postmortem test
Checks that after a GSocket is closed, a source created off it
with g_socket_create_source() will dispatch exactly once with
G_IO_NVAL.

Based on a patch by Mikhail Zabaluev

https://bugzilla.gnome.org/show_bug.cgi?id=723655
2017-10-24 09:02:02 -05:00
Emmanuele Bassi
5c13bf9bcf build: Use subdir-objects with Autotools
We're eventually going to drop Autotools, but in the meantime we should
probably use idiomatic options and reduce warnings.

GLib is pretty much already safe for subdir-objects to be enabled,
except in the GIO tests, where the build references files that are
generated in a different level. For that, we can use the same solution
employed by GTK+, and link the appropriate file in the right
sub-directory.

https://bugzilla.gnome.org/show_bug.cgi?id=788989
2017-10-24 13:30:41 +01:00
Friedrich Beckmann
2bd423c54c MacOS: create_cstr_from_cfstring uses safe conversion - use CFStringGetCString
During testing with gdk-pixbuf I noticed failures during content type
to mime conversion. The root reason was the unsafe conversion used
in create_cstr_from_cfstring. The problem was addressed in commit
c60226e0a1 but that was reverted. I noticed the commit only
when I had fixed the problem. In addition I added a test to check
the content type to mime conversion on MacOS. This problem is
discussed in Bug #788936.

See: https://bugzilla.gnome.org/show_bug.cgi?id=788936
2017-10-17 14:10:31 +01:00
Friedrich Beckmann
e55efa35e3 OSX: Use xdgmime system to guess content type from data
Closes: Bug #788401

The problem is described here:

https://bugzilla.gnome.org/show_bug.cgi?id=788401

This patch introduces the use of the xdgmime system to guess
the content type from data. So you can guess for example the
type public.svg-image from the file content of a svg file.
This patch only applies to MacOS. A test for the regression
is also included.
2017-10-14 09:11:01 +01:00
Philip Withnall
3d8296940a tests: Fix case of a string comparison
Fixup to commit 12e32e96a3.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-10-11 14:05:21 +01:00
Simon McVittie
331f73c26d gio/tests/gdbus-proxy: sleep longer when testing that we time out
On slow ARM machines doing parallel builds, there's no guarantee that
we'll get scheduled in a window between (100ms|250ms) and 500ms.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=769674
2017-10-11 13:32:48 +01:00
Simon McVittie
7d5c738dba gio/tests/file: increase an arbitrary timeout
On slow ARM machines doing parallel builds, there's no guarantee that
we'll get through this in 5 seconds.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=769674
2017-10-11 13:32:41 +01:00
Руслан Ижбулатов
4a77eb16ce Replace all instances of ssize_t with gssize
ssize_t is supported widely, but not universally, so use gssize instead.
Currently only one piece of code actually *needs* this change to be compilable
with MSVC, the rest are mostly in *nix parts of the code, but these are changed
too, for symmetry.

https://bugzilla.gnome.org/show_bug.cgi?id=788180
2017-10-11 12:56:11 +01:00
Nirbheek Chauhan
b444ae0de2 meson: Improve gdbus-codegen custom target dependencies
Ensure that the custom targets that use gdbus-codegen get rebuilt when
any of the gdbus-codegen files are changed.

https://bugzilla.gnome.org/show_bug.cgi?id=752239
2017-10-11 16:55:39 +05:30
Maks Naumov
12e32e96a3 Don't skip invalid enum values in schemas
Signed-off-by: Maks Naumov <maksqwe1@ukr.net>

https://bugzilla.gnome.org/show_bug.cgi?id=742997
2017-10-11 10:22:23 +01:00
Nelson Benítez León
32a9b88b20 gio/tests: Add testcase for bug 787731
Add testcase for function g_file_query_filesystem_info()
reporting outdated info for "filesystem::readonly" attribute
when said attribute was different in a previous mounted
partition in the same device (as GIO maintains a mounts cache
per 'st_dev' stat() member).

To trigger a mount operation, testcase uses program 'bindfs'
instead of 'mount --bind' as bindfs does not require root
privileges. And 'fusermount -u' command is used to unmount said
bindfs mount.

As a reference in Fedora, 'bindfs' is installed from 'bindfs'
package and 'fusermount' from 'fuse' package (this one is installed
by default as being part of 'System Tools' group).

The test creates a directory with a file in it, then mounts it
readonly over another directory (the mountpoint), it then checks
that g_file_query_filesystem_info() for the file in it indeed reports
"filesystem::readonly" as TRUE. Then unmounts and mounts again this
time rw (not readonly), it then checks again if g_file_query_filesystem_info()
is reporting "filesystem::readonly" as TRUE, if that's the case, it
confirms the bug by opening said file in write mode.

Testcase is only added for Unix builds.

https://bugzilla.gnome.org/show_bug.cgi?id=787731
2017-09-22 20:28:44 +05:00
Daniel Macks
190f64a0fb Avoid setting unused variables (-Wself-assign)
Setting a variable and then assigning it to itself avoids
-Wunused-but-set-variable but this specific trick is now caught by
-Wself-assign. Instead, actually use the value or don't bother
assigning it at all:

gdbusauth.c: call g_data_input_stream_read_byte() in void context
gdbusauthmechanismsha1.c: value is actually used
gdbusmessage.c: use consistent preprocessor-token protection
gthreadedresolver.c: skip over bytes in data blob
httpd.c: do something useful with the value

https://bugzilla.gnome.org/show_bug.cgi?id=745723
2017-09-11 22:14:18 +01:00
Philip Withnall
73eee8d64e tests: Fix some leaks and double-frees in the GSubprocess tests
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=786456
2017-08-23 11:37:32 +01:00
Will Thompson
65a95a5a2d gio: failing cases for subprocess cancellable bug
https://bugzilla.gnome.org/show_bug.cgi?id=786456
2017-08-23 11:37:32 +01:00
Philip Withnall
a60359aee2 tests: Add temporary working directory for monitor test
Similarly to the previous commit, move the temporary directory for the
monitor test from $(cwd) to the system temporary directory.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=785260
2017-08-23 11:26:57 +01:00
Philip Withnall
0f5b523fac tests: Add temporary working directory for appmonitor test
Rather than creating a temporary directory in the current directory
(typically the builddir), then never deleting it; create one in the
system /tmp directory, and clean it up properly afterwards.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=785260
2017-08-23 11:26:57 +01:00
Philip Withnall
3ce00b29ec tests: Fix leak in appmonitor test
Spotted by Daniel Macks.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=785260
2017-08-23 11:26:57 +01:00
Chun-wei Fan
32d6a76b98 build: Use Meson's find_library() for MSVC builds as needed
Some of the dependencies' build systems for Visual Studio do not provide a
pkg-config file upon build, so we use find_library() for them when the
corresponding pkg-config files are not found during Visual Studio builds,
so that one will not need to make up pkg-config files for them, which
could be error-prone.  These .lib names match the names that are built
with the officially supported build system that is used by their
respective Visual Studio support.

For ZLib, this will make gio-2.0.pc reflect on the zlib .lib based on
what is found, or whether we use the fallback/bundled ZLib, when we
don't have a pkg-config file for ZLib on MSVC.  We still need to depend
on Meson to be updated to put the correct link argument for linking ZLib
in the pkg-config case.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-08-17 17:17:59 +08:00
Philip Withnall
ad9d5a11f2 tests: Fix gschema-compile test for translatable string changes
Little did I know when making commit
c257757cf6 that a lot of the output of
glib-compile-schemas is string matched in some of the unit tests. Fix
them to match the updated strings.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=695573
2017-08-03 16:32:42 +01:00
Daniel Macks
f7a14fece4 Use "-module" when compiling loadable modules
Some platforms use different extensions for compile-time linkable
libraries vs runtime-loadable modules. Need to use special libtool
flag in the latter case for consistency with what gmodule expects.

https://bugzilla.gnome.org/show_bug.cgi?id=731703
2017-08-03 12:28:10 +01:00
Philip Withnall
5cddde1fb2 Consistently save errno immediately after the operation setting it
Prevent the situation where errno is set by function A, then function B
is called (which is typically _(), but could be anything else) and it
overwrites errno, then errno is checked by the caller.

errno is a horrific API, and we need to be careful to save its value as
soon as a function call (which might set it) returns. i.e. Follow the
pattern:
  int errsv, ret;
  ret = some_call_which_might_set_errno ();
  errsv = errno;

  if (ret < 0)
    puts (strerror (errsv));

This patch implements that pattern throughout GLib. There might be a few
places in the test code which still use errno directly. They should be
ported as necessary. It doesn’t modify all the call sites like this:
  if (some_call_which_might_set_errno () && errno == ESOMETHING)
since the refactoring involved is probably more harmful than beneficial
there. It does, however, refactor other call sites regardless of whether
they were originally buggy.

https://bugzilla.gnome.org/show_bug.cgi?id=785577
2017-08-03 10:21:13 +01:00
Matthias Clasen
9424facde2 2.53.4 2017-07-17 16:20:52 -04:00
Thibault Saunier
be8820128f meson: fix remaining wrong #include's for gdbus_codegen files
This is a follow up on 266bc1e510
to fix building tests and examples when using GLib as a meson
subproject.
2017-07-13 22:22:16 -04:00
Tim-Philipp Müller
10ae386727 meson: gio tests need to link against gobject as well
With meson from git dependencies of dependencies are no
longer added automatically and recursively to the linker
lines. Meaning dependencies that are used have to be
passed directly and explicitly or we'll get linker errors.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
42705b57f7 meson add missing gio/tests subdirectory/file 2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
03eac5fac5 meson: rebase on top of master ~2.53.1
From 2.51.2
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
6af4f1752a meson: gio/tests: remove some leftover rubbish 2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
613e00826e meson: gio/tests: add more gio tests
Need to fix up some of the tests a little, because the
test binary will not necessarily be run from the current
build sub-directory, and the build directory structure
might not always be a mirror of the source directory
structure, so pass location of glib-mkenums and
glib-compile-scheme and such directly.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
192cd652d4 tests: gio/tests: add gdbus tests 2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
4e0ef7655d meson: gio/tests: add more gresource tests 2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
34e4e25d53 meson: gio/tests: add more missing tests 2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
f438c04fac gio: tests: rename generated giotypefunc.c to giotypefuncs.inc
This is needed for the Meson port, a file name .c that's included
and shouldn't be compiled into an object is difficult to manage
otherwise.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
9fdcb2bf37 meson: Add a comment about the gdbus-peer gio test
So that it's not forgotten later.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
3c62619930 tests: autoptr test can be run on gcc, clang, intel
The only place where it won't work, is MSVC and maybe Sun Studio, but
we'd need someone to test Sun Studio first.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
122f4c051d meson: Add tls-interaction test, and fix giomodule test
giomodule test needed symbol visibility pragmas added. This is needed on
Windows anyway, so it's better to do it this way rather than disabling
-fvisibility=hidden for the test modules.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
fe2a9887a8 meson: Improve MSVC and MinGW support and fix dependencies everywhere
Disable gio tests on Windows, fix .gitignore to not ignore
config.h.meson, and add more things to it.

Rename the library file naming and versioning to match what Autotools
outputs, e.g., libglib-2.0.so.0.5000.2 on Linux, libglib-2.0-0.dll  and
glib-2.0-0.dll on Windows with MSVC.

Several more tiny fixes, more executables built and installed, install
pkg-config and m4 files, fix building of gobject tests.

Changes to gdbus-codegen to support out-of-tree builds without
environment variables set (which you can't in Meson). We now add the
build directory to the Python module search path.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
213957970e meson: Fix glib, add gobject, gio, gthread, gmodule, etc
Several small fixes to the build files.

Lots of tests have also been added, and glib tests pass now.
2017-07-13 19:03:39 -04:00
Philip Withnall
18f8b77c04 gio: Use g_strerror() instead of strerror()
This marginally improves thread safety, and marginally improves
consistency.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=733821
2017-06-21 11:20:29 +01:00
Philip Withnall
e1e73dafa6 gsubprocess: Copy parent process’ environ when clearing subprocess’
Previously, this was done at the time of spawning the subprocess, which
meant the g_subprocess_launcher_*_environ() functions could not be used
to modify the parent process’ environment.

Change the code to copy the parent process’ environment when
g_subprocess_launcher_set_environ(NULL) is called. Document the change
and add a unit test.

https://bugzilla.gnome.org/show_bug.cgi?id=778422
2017-05-31 12:07:31 +01:00
Sébastien Wilmet
d9a44b66af gio/tests/: LGPLv2+ -> LGPLv2.1+
A lot of tests in gio/tests/ don't have a license header.

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Ryan Hendrickson
151d3b01e6 gsettings: check $XDG_DATA_HOME for schemas
Add $XDG_DATA_HOME/glib-2.0/schemas as a schema source, after (higher
priority than) $XDG_DATA_DIRS/glib-2.0/schemas but before
$GSETTINGS_SCHEMA_DIR. This is per the XDG Base Directory Specification,
which states that user specific versions of data in $XDG_DATA_DIRS can
be created in $XDG_DATA_HOME.

https://bugzilla.gnome.org/show_bug.cgi?id=741335
2017-05-22 09:18:25 +01:00
Alexandru Pandelea
eb7b796bd2 xdgmime: fix special case for mime_type_subclass
Currently, all mime types are considered subclasses of
application/octet-stream, but according to the freedesktop
standard, everything but the inode/* types is a subclass of
application/octet-stream.

Update the special case for application/octet-stream so that all
types but inode/* will match with it and add unit test for it.

https://bugzilla.gnome.org/show_bug.cgi?id=782311
2017-05-16 11:16:41 +01:00
Patrick Griffis
cbcf10411c tests: Fix g_content_type_is_mime_type() test on OSX
It should be passed a mime type not a content type.

https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-04-29 03:47:54 -04:00
Daniel Macks
ecc27a0cba Add test-case for g_content_type_is_mime_type()
Verify presence of new interface.

https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-04-28 06:30:11 -04:00
Patrick Griffis
d4bfee1e7a build: Don't build dbus-appinfo on OSX
https://bugzilla.gnome.org/show_bug.cgi?id=780309
2017-04-27 21:52:04 -04:00
Emmanuele Bassi
f952fdf3fc Drop trailing semi-colon from G_DEFINE_ macro
It's unnecessary, and only adds visual noise; we have been fairly
inconsistent in the past, but the semi-colon-less version clearly
dominates in the code base.

https://bugzilla.gnome.org/show_bug.cgi?id=669355
2017-04-10 10:38:31 +01:00
Philip Withnall
c11908ab7d gio: Fix deprecation warnings for g_object_newv() API 2017-03-31 11:00:23 +01:00
Patrick Griffis
206c54c80b gosxcontenttype: Fix various tests
https://bugzilla.gnome.org/show_bug.cgi?id=780384
2017-03-26 04:56:20 -04:00
Patrick Griffis
03c88daa73 build: Skip gdesktopappinfo tests on OSX
https://bugzilla.gnome.org/show_bug.cgi?id=780384
2017-03-26 04:51:15 -04:00
TingPing
90dfea2b61 Implement GAppInfo on OSX
This is an implementation of most of GAppInfo using the OS X
NSBundle APIs.

Missing at this point are things that don't have equivalents
in OS X, such as hidden desktop files, last-used, manual type
associations, and g_app_info_get_all().

https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-03-13 10:33:23 -04:00
Matthias Clasen
b56a95026c Add some more cases to the app-id unit tests
These came up on irc today.
2017-03-05 13:11:52 -05:00
Philip Withnall
d892cf6feb tests: Fix some memory leaks in the GSettings unit tests
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=779265
2017-02-28 16:11:06 +00:00
Philip Withnall
43fbb8652d tests: Fix a double-unref in the GSettings unit tests
g_settings_schema_source_get_default() is (transfer none), not (transfer
full).

Spotted by Marvin Schmidt.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=779265
2017-02-28 16:11:05 +00:00
Ingo Brückl
731e7fea17 tests: Don't run tests requiring DBUS unconditionally
The tests defaultvalue, gdbus-peer and gdbus-unix-addresses will fail
without DBUS, so only run them in case we HAVE_DBUS_DAEMON.

Signed-off-by: Ingo Brückl <ib@wupperonline.de>

https://bugzilla.gnome.org/show_bug.cgi?id=767609
2016-12-27 20:13:46 +01:00
Simon McVittie
663e12feca gdbus-serialization test: don't left-shift a negative number
-2LL<<34 is undefined, because left-shifting a negative number is
undefined (it was implementation-defined behaviour in C99, but
is formally undefined in C11). The undefined behaviour sanitizer
picks this up.

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=775510
Reviewed-by: Colin Walters
2016-12-02 19:10:41 +00:00
Christian Hergert
18a33f72db introspection: use (nullable) or (optional) instead of (allow-none)
If we have an input parameter (or return value) we need to use (nullable).
However, if it is an (inout) or (out) parameter, (optional) is sufficient.

It looks like (nullable) could be used for everything according to the
Annotation documentation, but (optional) is more specific.
2016-11-22 14:14:37 -08:00
Matthias Clasen
34751ad17a Add a test for dictionaries in settings
This should clarify the questions in
https://bugzilla.gnome.org/show_bug.cgi?id=771968
2016-09-26 06:27:12 -04:00
Simon McVittie
037719c27c gdbus-example-unix-fd-client: avoid strftime %c specifier
gcc 6 warns (fatally, by default) that %c only uses a 2-digit year
in some locales. The precise format does not seem to be important
for this sample code, so use ISO 8601 instead of suppressing the
warning with a pragma.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Colin Walters
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=768453
2016-08-15 14:04:43 +01:00
Philip Withnall
5cdf0efaab tests: Fix a typo on a dereferencing assignment
Otherwise the assignment is pointless. Spotted by cppcheck.
2016-08-13 10:24:23 +02:00
Emilio Pozuelo Monfort
38317cf746 Use a uint64 to unpack a 64 bit value
https://bugzilla.gnome.org/show_bug.cgi?id=769089
2016-07-22 19:20:30 +02:00
Dan Winship
6de5595570 Fix gio/tests/socket-listener
g_socket_listener_add_address() is synchronous; all of the events will
have been emitted before it returns and it doesn't queue any sources.
The test was unintentionally depending on the fact that
g_main_context_iterate(NULL, TRUE) would return anyway (at least the
first time it was called), but that's no longer true after e4ee307.

https://bugzilla.gnome.org/show_bug.cgi?id=768968
2016-07-19 17:22:07 -04:00
Aurélien Zanelli
b121a7916d gio/tests/gsettings: fix GSettings reference leaks in some tests
GSettings objects were not unreffed in test_flags, test_enums and
test_ranges tests and when we skip internationalization tests, ie
test_l10n(_context).

https://bugzilla.gnome.org/show_bug.cgi?id=768560
2016-07-16 20:57:20 -04:00
Dan Winship
79b7efada3 Fix gio/tests/inet-address on OS X
OS X apparently stringifies the IPv6 address "::80" as "::0.0.0.128",
which is bizarre, but that address *is* in a "reserved for future use"
range, so it's not unambiguously wrong I guess. Anyway, fix the text
to use an address everyone can agree on.

https://bugzilla.gnome.org/show_bug.cgi?id=768551
2016-07-11 17:42:41 -04:00
Florian Müllner
a42bdecf5c vfs: Fix return value of get_supported_uri_schemes()
The function is expected to return a %NULL-terminated array, but
commit 375b4ca65c dropped the sentinel when adding support for
additional custom schemes. Add it back.

https://bugzilla.gnome.org/show_bug.cgi?id=768119
2016-06-28 15:57:49 +02:00
Cosimo Cecchi
375b4ca65c vfs: add g_vfs_register_uri_scheme()
Add a new API to allow clients to register a custom GFile implementation
handling a particular URI scheme.
This can be useful for tests, but also for cases where a different URI
scheme is desired to be used with another custom GFile backend.

As an additional cleanup, we can use this to register the "resource" URI
scheme too.

Based on a patch by Jasper St. Pierre <jstpierre@mecheye.net>.

https://bugzilla.gnome.org/show_bug.cgi?id=767887
2016-06-25 06:58:19 +08:00
Allison Lortie
9bb2499c9c tests: fix uint64 argument to g_object_set() call
5cea1c861d introduced accessors for 64bit
ints to gsettings, at which point the testcases were expanded.

Unfortunately, the expanded tests contained a bug: integer constants
passed to g_object_set() for a 64-bit property need an up-cast.  Add
that now.

Problem found by Iain Lane.
2016-06-23 11:49:39 -04:00
Philip Withnall
b26b083aa2 gio: Support using GDBusObjectManagerServer at path ‘/’
Previously this would cause an assertion failure when checking the paths
of exported objects, as it would try to check that their paths started
with ‘//’ due to mishandling the root object case.

Includes a unit test.

https://bugzilla.gnome.org/show_bug.cgi?id=761810
2016-06-15 13:27:19 -04:00
Emmanuele Bassi
7d8e98ee09 Fix paths for non-srcdir builds
This fixes a build failure in Continuous that resulted in the error:

../../../gio/tests/test.gresource.xml: Failed to locate
'test-generated.txt' in any source directory.
Makefile:4676: recipe for target 'test.gresource' failed
make[6]: *** [test.gresource] Error 1
2016-06-04 13:49:46 +01:00
Georges Basile Stavracas Neto
5411a187a3 glib-compile-resources: correct resource compiler dependency for generated files
Don't require that files can be resolved when generating dependencies.

Original patch by Garret Regier.

https://bugzilla.gnome.org/show_bug.cgi?id=673101
2016-06-04 08:24:22 -04:00
Руслан Ижбулатов
2aa7338875 testsuite: override check-TESTS target in gio tests subdir
This prevents testsuite from trying to build any TESTS in that
subdirectory, which will fail, because there are no TESTS defined
in that Makefile.am.

This happens when user runs make check TESTS=...

https://bugzilla.gnome.org/show_bug.cgi?id=766407
2016-05-14 04:59:40 +00:00
Christian Hergert
c16a0b53fe socket: set fd field to -1 after closing socket
This ensures that g_socket_get_fd() will return -1 after the socket has
been closed.

https://bugzilla.gnome.org/show_bug.cgi?id=765959
2016-05-04 16:47:54 +03:00
Debarshi Ray
0cd3d5741b gio/tests/task: Ensure that g_task_had_error doesn't forget the error
https://bugzilla.gnome.org/show_bug.cgi?id=764163
2016-05-04 09:34:05 +02:00
Marc-Antoine Perennou
5cea1c861d gsettings: add get/set_{,u}int64
https://bugzilla.gnome.org/show_bug.cgi?id=755898

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2016-04-28 17:28:44 +02:00
Philip Chimento
f8f344923e tests: Fix appmonitor test
Commit f45ec47 fixed a race condition in this test, but one change was
omitted; maybe lost in a rebase.

https://bugzilla.gnome.org/show_bug.cgi?id=749606
2016-04-27 12:12:31 +08:00
Allison Ryan Lortie
75589956a4 GContextSpecificGroup: add testcase
Add a test case for unreffing an object from a GContextSpecificGroup
immediately after firing a signal, before allowing the mainloop to run.

https://bugzilla.gnome.org/show_bug.cgi?id=762994
2016-04-26 15:20:16 +02:00
Cosimo Cecchi
f45ec47be1 tests: always remove app.desktop
https://bugzilla.gnome.org/show_bug.cgi?id=749606
2016-04-03 12:23:21 -07:00
Iain Lane
a668ee8fe9 giotypefuncs.c: Sort _get_type functions in the 'C' locale
This ensures that the generated file is always the same (not dependent
on the build machine's environment), making the build reproducible.

Thanks to Jérémy Bobbio <lunar@debian.org> for the Debian bug report and
patch.

https://bugzilla.gnome.org/show_bug.cgi?id=763617
2016-03-21 13:44:38 +00:00
Руслан Ижбулатов
ce985f13f4 Enable contenttype test on W32, tweak it to pass (mostly)
* On W32 use a real directory (SYSTEMROOT) instead of '/etc/'
* Disable test_symbolic_icon() as it can't be passed (symbolic icons are not
  really supported)

* PowerPoint/Gettext test still fails, presumably because msvcrt qsort() moves
  the entires (both have the same priority)

https://bugzilla.gnome.org/show_bug.cgi?id=735696
2015-12-16 07:47:54 -05:00
Jussi Kukkonen
1c6e6671d1 gio/tests: Don't depend on a data file that's not built
data.gresource is not built when cross-compiling: Don't
add it to test_data in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=757628
2015-11-05 13:50:13 +02:00
Simon McVittie
236e8040b4 Build gdbus-example-objectmanager-server again
It was removed, apparently accidentally, in commit 5b48dc4.
This had the side-effect that it wasn't included in tarball releases,
which means that commit ab7b4be doesn't work when building a package.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=734469
Reviewed-by: Colin Walters <walters@verbum.org>
2015-11-02 20:36:42 +00:00
Lars Uebernickel
ee718d3526 gapplication: reject actions without names
https://bugzilla.gnome.org/show_bug.cgi?id=756134
2015-11-02 13:52:10 +01:00
Matthias Clasen
a036bd38a5 Try to fix the desktop-app-info test
This was broken in 2bb898c60f.
2015-10-26 13:52:47 -04:00
Dan Winship
263aac125e .gitignore updates 2015-10-23 11:28:03 -04:00
Philip Withnall
128c413261 gsocketconnectable: Add a to_string() virtual method
Add string serialisation functions for GNetworkAddress, GSocketAddress,
GUnixSocketAddress, GInetSocketAddress, GNetworkService and
GSocketConnectable. These are intended for use in debug output, not for
serialisation in network or disc protocols.

They are implemented as a new virtual method on GSocketConnectable:
g_socket_connectable_to_string().

GInetSocketAddress and GUnixSocketAddress now implement
GSocketConnectable directly to implement to_string(). Previously they
implemented it via their abstract parent class, GSocketAddress.

https://bugzilla.gnome.org/show_bug.cgi?id=737116
2015-10-13 15:42:14 +01:00
Philip Withnall
1086507e75 gsocket: Fix error behaviour of g_socket_send_messages()
If an error in the underlying sendmmsg() syscall occurs after
successfully sending one or more messages, g_socket_send_messages()
should return the number of messages successfully sent, rather than an
error. This mirrors the documented sendmmsg() behaviour.

This is a slight behaviour change for g_socket_send_messages(), but as
it relaxes the error reporting (reporting errors in fewer situations
than before), it should not cause problems.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-10-01 14:10:10 +01:00
Philip Withnall
f62cbfc022 gsocket: Add g_socket_receive_messages()
Add support for receiving multiple messages with a single system call,
using recvmmsg() if available. Otherwise, fall back to looping over
g_socket_receive_message().

This adds new API, g_socket_receive_messages(), and corresponding unit
tests.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-10-01 14:10:10 +01:00
Emmanuele Bassi
5ce70917df Drop binary checks when cross-compiling
We don't need to run binaries we just built in order to successfully
build GLib and friends any more.

Since commit b74e2a7, we don't need to run glib-genmarshal when building
GIO; since commit f9eb9eed, all our tests (including the ones that do
need to run binaries we just built) are only built when running "make
check", instead of unconditionally at every build.

This means that we don't need to check for existing, native binaries
when cross-compiling, and fail the configuration step if they are not
found — which also means that you don't need to natively build GLib for
your toolchain, in order to cross-compile GLib.

We can also use the cross-compilation conditional, and skip those tests
that require a binary we just built in order to build.

https://bugzilla.gnome.org/show_bug.cgi?id=753745
2015-09-01 10:40:24 -04:00
Dan Winship
9f2e3f6b72 gtestutils: add g_assert_cmpmem()
Add a test macro to compare two buffers (which are not already known
to be the same length) for equality.

https://bugzilla.gnome.org/show_bug.cgi?id=754283
2015-08-31 13:59:48 -04:00
Michael Catanzaro
516adb99c0 Add certificate chain construction test
Enhance GTestTlsBackend to allow setting the issuer property of
GTlsCertificates, and add a test to ensure certificate chain
construction with g_tls_certificate_new_from_pem() works as expected.

https://bugzilla.gnome.org/show_bug.cgi?id=754264
2015-08-29 08:43:29 -05:00
Matthias Clasen
fa17536598 Code cleanup 2015-08-21 00:43:54 -04:00
Matthias Clasen
b67dac56e3 Add a test for cross dir moves
This is a test that is described in

https://bugzilla.gnome.org/show_bug.cgi?id=742849
2015-08-21 00:41:09 -04:00
Matthias Clasen
3498f29b81 Test resource filesystem attributes 2015-08-21 00:08:57 -04:00
Matthias Clasen
d66e3f57cd Add more directory monitoring tests
These tests clear up a misunderstanding of mine: Monitoring
nonexisting files and directories *does* work with the inotify
implementation, it just has a very long timeout for scanning
for missing locations, so the test needs to take that into
account.
2015-08-20 22:30:19 -04:00
Matthias Clasen
4a076032cf More file monitor tests
Test regular writes and attribute changes with a file monitor,
as well as various file changes under a directory monitor.
2015-08-19 20:33:46 -04:00
Matthias Clasen
8c32f7c448 Add some file monitoring tests
Add a new test which checks that atomically replacing a file that
is being monitored by GFileMonitor produced the expected events.

The test can easily be expanded to cover other file monitoring
scenarios.
2015-08-19 14:57:53 -04:00
Janusz Lewandowski
5d014a802a Add a g_dbus_connection_register_object_with_closures function
This is a binding-friendly version of g_dbus_connection_register_object.
Based on a patch by Martin Pitt and the code of g_bus_watch_name_with_closures.

https://bugzilla.gnome.org/show_bug.cgi?id=656325
2015-08-18 16:41:12 -04:00
Dan Winship
ff3dee4bf6 gdbus: fix gdbus-exit-on-close for gdbusconnection change 2015-08-07 09:49:57 -04:00
Philip Withnall
6b652b1a2e gio: Fix application of GNetworkMonitor:network-metered patch
The wrong patch from https://bugzilla.gnome.org/show_bug.cgi?id=750282
was applied, causing test failures due to not implementing the property
on GNetworkMonitorBase (plus some other omissions).

Fix that by reverting commit a80e7db1a8
and re-applying the correct patch over the top.

https://bugzilla.gnome.org/show_bug.cgi?id=750282
2015-07-29 11:58:02 +01:00
Matthias Clasen
c885d42751 Add tests for GApplication::handle-local-options 2015-07-26 21:41:08 -04:00
TingPing
3cc349b04e win32: Replace usage of __wgetmainargs()
It was an internal function that has been removed with VS 2015

Use g_win32_get_command_line() or CommandLineToArgvW() directly.

https://bugzilla.gnome.org/show_bug.cgi?id=741822
2015-07-23 04:22:59 -04:00
Dan Winship
de1bd45fe9 gio/tests/task: fix for change to cancellation behavior
Multiple tasks cancelled at the same time now complete in the opposite
order from how they used to. Fix the test to not assume any particular
order.
2015-07-20 17:35:43 -04:00
Paolo Borelli
45e99833e3 Move a unit test to the right file
Move a test for threaded socket service to socket-service.c.
2015-07-20 00:00:42 +02:00
Paolo Borelli
e1d44799c0 socketservice: add an "active" property
We already have start, stop and is_active methods, but turning it
into a real property is useful for a few reasons:
 - it allows us to bind the property to an UI or a setting
 - it allows us to get notified when the state changes
 - it allows us to instantiate objects directly in the stopped state

https://bugzilla.gnome.org/show_bug.cgi?id=752089
2015-07-20 00:00:02 +02:00
Iain Lane
f2c1cfe8c7 gio/tests/appmonitor: Delete file before checking for changed event
In 4e7d22e268, deleting the file was moved
after the assertion which checks for the changed event that results from
it being deleted. This is the wrong way around and makes the assertion
fail.

Move the deletion back up before we check the condition. delete_app is
no longer an idle callback so it can be made void. The change
notification might come in when the loop isn't running now, so don't try
to quit if it isn't running. In this case we'll wait for the three
second timeout and the test will still pass.

https://bugzilla.gnome.org/show_bug.cgi?id=751737
2015-07-01 12:11:23 +02:00
Dan Winship
b25fa8feed gio/tests/socket.c: fix on OS X
The semantics of calling shutdown() on a dup()ed socket aren't
well-specified, so don't require any specific behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=747676
2015-06-29 14:40:56 -04:00
Dan Winship
b97d666b2f gio/tests/socket.c: clean up a test case a bit 2015-06-29 14:40:56 -04:00
Matthias Clasen
4e7d22e268 Fix distcheck
The appmonitor test was sometimes leaving files behind, causing
distcheck some heartburn.
2015-06-23 06:56:26 -04:00
Matthias Clasen
1102e6f9ca Allow property actions to invert booleans
This can be handy when you want to change the sense of a toggle
in the UI without rewriting the underlying logic. Currently, this
is just exposed as a construct-only property. We may add a
convenience wrapper or a special !property syntax for this later.

https://bugzilla.gnome.org/show_bug.cgi?id=728489
2015-06-10 21:59:28 -04:00
Simon McVittie
b701c3c608 Regression test for falling back to autolaunch: and XDG_RUNTIME_DIR/bus
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=747941
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
2015-06-09 18:17:25 +01:00
Ryan Lortie
6cf867fb2a gsettings tests: use g_settings_schema_list_keys()
Stop using g_settings_list_keys() because soon it will be deprecated.

https://bugzilla.gnome.org/show_bug.cgi?id=740308
2015-06-05 15:24:02 -04:00