Commit Graph

19916 Commits

Author SHA1 Message Date
Iain Lane
07a1a8031d
installed tests: Allow tests to set environment variables
It's necessary sometimes for installed tests to be able to run with a
custom environment. For example, the gsocketclient-slow test requires an
LD_PRELOADed library to provide a slow connect() (this is to be added in
a followup commit).

Introduce a variable `@env@` into the installed test template, which we
can override as necessary when generating `.test` files, to run tests
prefixed with `/usr/bin/env <LIST OF VARIABLES>`.

As the only test that requires this currently lives in `gio/tests/`, we
are only hooking this up for that directory right now. If other tests in
future require this treatment, then the support can be extended at that
point.
2019-02-13 09:43:49 +00:00
Руслан Ижбулатов
1cc78bf082 GSubprocess test: Adjust the cwd test to pass on Windows
There's no /tmp directory on Windows.
Use g_get_tmp_dir(), and adjust the test to work with that.
The test *still* checks the basename of the new CWD, it just
doesn't need to be "tmp" anymore.
2019-02-13 08:52:59 +00:00
Руслан Ижбулатов
4bc1aa23a9 GSubprocess test: Add PATH to the envtable that is passed to child
envp in spawn() functions is the *whole* environment table
for the child process. Including PATH. Thus, unless PATH is explicitly
put into that table, the process will be spawned without PATH.
Since on Windows binaries are found via PATH instead of LD_LIBRARY_PATH
or whatever, almost no program (unless installed in WINDIR, maybe)
can run without a PATH. Certainly not test programs - meson
adds bld subdirs to the PATH to make sure that test programs
use uninstalled glib at runtime.
So make sure that PATH is passed along.
2019-02-13 08:52:58 +00:00
Руслан Ижбулатов
01642d6db5 GSubprocess test: Use LINEEND more
Windows \r\n EOLs strike again. The test already knows about LINEEND,
so make it use LINEEND more (instead of swithcing pipes
to binary mode). This also applies to counting the bytes
read.
2019-02-13 08:52:58 +00:00
Руслан Ижбулатов
f150de2139 socket test: Bind Windows UDP sockets before calling recv()
Winsock can't recv() on unbound UDP sockets. Bind the socket
to loopback before trying to receive data on it.
2019-02-13 08:51:31 +00:00
Руслан Ижбулатов
1f5d7eeaa7 socket test: Adjust for Windows-specific sendto() error
With winsock sending messages to NULL results in G_IO_ERROR_NOT_CONNECTED
instead of G_IO_ERROR_FAILED.
MSDN says:
  WSAENOTCONN
  10057
  Socket is not connected.
  A request to send or receive data was disallowed because the socket is not connected
  and (when sending on a datagram socket using sendto) no address was supplied.
So this is a direct mapping of the implementation error.
Covering it up in the wrapper (by converting it to G_IO_ERROR_FAILED)
doesn't seem feasible or needed (no one, except for the testsuite,
really cares which unrecoverable error is returned by sendto()).
2019-02-13 08:51:31 +00:00
Руслан Ижбулатов
1e74b5872e GLib test: Adjust to follow the implementation
Canonicalization converts slashes to backslashes on Windows (most
of the time). This is a horrible design decision, but that's what
it does, and it's too late to change that. The test shouldn't expect
anything else.
2019-02-13 08:49:42 +00:00
Руслан Ижбулатов
3ffa7ed0b6 GDate test: Disable Julian epoch test on Windows
Windows uses FILETIME, which starts counting from 1st Jan of year 1601 and,
unlike time_t, can't be negative, so Windows simply has no way
to do timestamp-math for dates before then. SYSTEMTIME (an equivalent
of struct tm) can, obviously, represent almost arbitrary date starting
from 1st Jan of year 0 (it's unsigned...), but GetDateFormatW() converts it
to FILETIME at some point in its implementation, and fails.
Unless the whole strftime() implementation of GDate is replaced by
something that doesn't rely on WinAPI, this part of the test will
never pass.
2019-02-13 08:49:42 +00:00
Руслан Ижбулатов
00908bc446 network-address test: Disable scope ID tests on Windows
getaddrinfo() in winsock can't understand scope IDs.
There's no obvious way to fix that, short of re-implementing
that function, so disable that part of the test on Windows.
2019-02-13 08:49:42 +00:00
Руслан Ижбулатов
14aae264d4 autoptr test: Use OS-dependent path separator
Since GFile canonicalizes the path it is given, expect the '\\' separator
on Windows.
2019-02-13 08:49:42 +00:00
Руслан Ижбулатов
294d818336 Use OS-dependent separator for G_RESOURCE_OVERLAYS
G_RESOURCE_OVERLAYS is a list of resource-path and filesystem-path pairs.
Since on Windows filesystem paths use ':', this list can't be ':'-separated
there. Fix that by making it ';'-separated on Windows. Make the parser
error clearer (we're not looking for a slash, we're looking for an absolute
path).
2019-02-13 08:49:42 +00:00
Руслан Ижбулатов
ccbadcfb04 GWinHTTPVfs: use URI parser for parsing URIs
If a URI can't be handled by by WinHTTPVfs, it should pass that URI
along to the URI parser of the wrapped Vfs, not to its generic parser.
Theoretically, generic parser should also be able to handle URIs,
but this is subject to Vfs semantics.

In case of Windows, the wrapped Vfs is GLocalVfs, which is *local* and
treats any generic names as either file:// URIs or as filesystem
paths. It only ever treats URIs as URIs when they are passed
to its URI parser. This breaks the testsuite when g-icon GIO test passes
unhandleable sftp:// URI, and expects it to come through unmolested,
yet GLocalVfs, getting that URI as a generic parse name, treats it as
a filesystem path, and then "canonicalizes" it by prepending CWD.

Fix this by making WinHTTPVfs pass any URIs it gets to the URI parser
of the wrapped Vfs. This way unknown URIs remain URI-ish. This seems
like a reasonable things to do, since the URI parser should not be
given anything other than URIs, so there's no reason to try generic
parsing with these strings.

Closes: #875
2019-02-13 08:49:42 +00:00
Руслан Ижбулатов
fb37239b20 testsuite: use binary mode for stdout on Windows
It's much easier than adjusting the test logic to account for the extra \r.
2019-02-13 08:49:42 +00:00
Emin Tufan Çetin
16dc979d0e Update Turkish translation 2019-02-12 14:26:16 +00:00
Serdar Sağlam
8a5228b7ae Update Turkish translation 2019-02-12 14:20:41 +00:00
Philip Withnall
b841c9a7a7 Merge branch 'gstring-docs' into 'master'
gstring: fully document semantics of @len for g_string_insert_len

See merge request GNOME/glib!650
2019-02-12 12:01:46 +00:00
Michael Catanzaro
df5592f28d Merge branch 'wip/tingping/network-address-fixes' into 'master'
gnetworkaddress: Never end enumeration before resolving completes

Closes #1680

See merge request GNOME/glib!646
2019-02-11 14:22:05 +00:00
Daniel P. Berrangé
9a6ec14b3b gstring: fully document semantics of @len for g_string_insert_len
The g_string_insert_len method accepts '-1' for its len parameter,
as a shorthand for strlen(val). Likewise the various convenience
wrappers around it also accept -1. This was not documented, leaving
developers to wonder why len is a gssize, instead of gsize.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-02-11 14:08:40 +00:00
Patrick Griffis
085081ea2c gnetworkaddress: Never end enumeration before resolving completes
Previously once the end of addresses was reached it would return
NULL even if it was waiting on a dns response. Now it will keep
waiting so all addresses are received.

Fixes #1680
2019-02-11 08:59:33 -05:00
Patrick Griffis
c83291049e gnetworkaddress: Factor out initializing address list into function 2019-02-11 08:59:31 -05:00
Philip Withnall
6199d8ba9f Merge branch 'wip/rishi/gtask-return-cancellation-test' into 'master'
gio/tests/task: Run the worker indefinitely until it's cancelled

See merge request GNOME/glib!648
2019-02-11 12:42:38 +00:00
Debarshi Ray
e13b3a9ee5 gio/tests/task: Add comments documenting how the test works
https://gitlab.gnome.org/GNOME/glib/issues/1608
2019-02-11 12:30:23 +01:00
Debarshi Ray
5d1aaf56bb gio/tests/task: Run the worker indefinitely until it's cancelled
Currently, the actual asynchronous work, represented by
asynchronous_cancellation_run_task, was over before the GCancellable
could be triggered. While that doesn't invalidate the purpose of the
test, since it's fundamentally about cancellation, it would be
nicer if the cancellation actually served some purpose instead of
being a mere formality.

https://gitlab.gnome.org/GNOME/glib/issues/1608
2019-02-11 12:12:47 +01:00
Philip Withnall
f773b3533a Merge branch 'test1-overlay' into 'master'
gio tests: Install test1.overlay file when building installed tests

See merge request GNOME/glib!649
2019-02-11 10:36:18 +00:00
Iain Lane
cc12f3f253
gio tests: Install test1.overlay file when building installed tests
This is used as a GResource overlay, so it must be available to the
test.
2019-02-11 10:21:13 +00:00
Philip Withnall
d3523dfd9a Merge branch 'gdbus-peer-fix-multiple-returns' into 'master'
gsocketlistener: Fix multiple returns of GTask when accepting sockets

See merge request GNOME/glib!645
2019-02-11 00:48:32 +00:00
Philip Withnall
30ccfac9cf gsocketlistener: Fix multiple returns of GTask when accepting sockets
When calling g_socket_listener_accept_socket_async() on a
GSocketListener with multiple sockets, the accept_ready() callback is
called for the first incoming connection on each socket. It will return
success/failure for the entire accept_socket_async() GTask, and then
free the GSources for listening for incoming connections on the other
sockets in the GSocketListener. The GSources are freed when the GTask is
finalised.

However, if incoming connections arrive for multiple sockets within the
same GMainContext iteration, accept_ready() will be called multiple
times, and will call g_task_return_*() multiple times, before the GTask
is finalised. Calling g_task_return_*() multiple times is not allowed.

Propagate the first success/failure, as before, but then ignore all
subsequent incoming connections until the GTask is finalised.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-11 00:25:48 +00:00
Jordi Mas
0f7839f0ff Update Catalan translation 2019-02-10 15:35:49 +01:00
Patrick Griffis
4dd1582625 gsocketclient: Ensure task is always returned on cancel
It was possible for the individual connection attempts to be
cancelled without the main task getting returned.

Fixes libsoup#132
2019-02-09 10:30:24 -05:00
Charles Monzat
97b41e10c7 Update French translation
(cherry picked from commit f7970e55c4)
2019-02-09 10:50:02 +00:00
Michael Catanzaro
6d8c8f509e Merge branch 'wip/tingping/network-address-errors' into 'master'
gnetworkaddress: Fix incorrect error propagation when resolving addresses

Closes #1644

See merge request GNOME/glib!642
2019-02-07 21:16:16 +00:00
Patrick Griffis
ed57faeeda tests: Use fewer magic numbers in network-address tests 2019-02-07 11:56:22 -05:00
Patrick Griffis
5827cef22d tests: Unmark network-address test as flaky 2019-02-07 11:56:22 -05:00
Patrick Griffis
5b0fdfda6d gnetworkaddress: Fix incorrect error propagation when resolving addresses
Previously this would always error if ipv6 errored after ipv4
succeeded which was incorrect.

This explicitly tests the order of erroring.

Fixes #1644
2019-02-07 11:56:22 -05:00
Philip Withnall
01cff0e9b8 Merge branch 'spawn-docs-typo-fix' into 'master'
Minor typo fixes to GSpawn documentation

See merge request GNOME/glib!641
2019-02-07 11:12:58 +00:00
Philip Withnall
47e8f521ba gspawn: Tiny improvement to formatting of documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-07 10:33:24 +00:00
Philip Withnall
5cef08977b gspawn: Fix minor typo in documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-07 10:30:49 +00:00
Philip Withnall
0af468e9c9 Merge branch 'wip/rishi/gtask-return-cancelled' into 'master'
gtask: Ensure that cancelled tasks are returned asynchronously

Closes #1608

See merge request GNOME/glib!509
2019-02-06 13:40:49 +00:00
Debarshi Ray
381af21072 gio/tests/task: Ensure that cancelled tasks are returned asynchronously
Closes https://gitlab.gnome.org/GNOME/glib/issues/1608
2019-02-06 13:30:01 +00:00
Debarshi Ray
6f3d57d2ee gtask: Return cancelled tasks asynchronously
Once cancelled, a GTask's callback should not only be invoked
asynchronously with respect to the creation of the task, but also with
respect to the GCancellable::cancelled handler. This is particularly
relevant in cases where the cancellation happened in the same thread
where the task is running.

Spotted by Dan Winship and Michael Catanzaro.

Closes https://gitlab.gnome.org/GNOME/glib/issues/1608
2019-02-06 13:30:01 +00:00
Will Thompson
0f8a4f61b0 Merge branch 'socket-service-flaky' into 'master'
tests: Tag socket-service test as ‘flaky’

See merge request GNOME/glib!640
2019-02-06 13:16:35 +00:00
Philip Withnall
cffed58737 tests: Tag socket-service test as ‘flaky’
It needs investigating and fixing properly, but let’s not let it disrupt
the CI in the meantime.

Follow-up in https://gitlab.gnome.org/GNOME/glib/issues/1679.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-06 12:50:38 +00:00
Philip Withnall
82c3e92855 Merge branch 'macos-user-dirs' into 'master'
Fix g_get_user_special_dir() on MacOS

Closes #1048

See merge request GNOME/glib!594
2019-02-05 15:54:05 +00:00
Philip Withnall
c927c59a84 gvariant-parser: Fix error handling when type coalescing fails
When parsing GVariant text format strings, we do a limited form of type
inference. The algorithm for type inference for nested array child types
is not complete, however (and making it complete, at least with a naive
implementation, would make it O(N^2), which is not worth it) and so some
text format arrays were triggering an assertion failure in the error
handling code.

Fix that by making the error handling code a little more relaxed, in the
knowledge that our type inference algorithm is not complete. See the
comment added to the code.

This includes a test case, provided by oss-fuzz.

oss-fuzz#11578

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-05 15:50:15 +00:00
Philip Withnall
0fcd5ac89d gvariant-parser: Fix parsing of G_MININT* values in GVariant text format
And add tests.

There wasn’t actually a bug on x86_64 before, but it was making use of
undefined behaviour, and hence triggering ubsan warnings. Make the code
more explicit, and avoid undefined behaviour.

oss-fuzz#12686

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-05 15:02:49 +00:00
Philip Withnall
2bcce9b2e0 Merge branch '535-strfunc' into 'master'
macros: Try to use the standard __func__ first in G_STRFUNC

Closes #535

See merge request GNOME/glib!635
2019-02-05 12:35:09 +00:00
Javier Jardón
9f75cc9edf macros: Try to use the standard __func__ first in G_STRFUNC
__func__ is part of the C99 standard.
__FUNCTION__ is another name for __func__. Older versions of GCC
recognize only this name. However, it is not standardized.
For maximum portability, Its recommended to use __func__.
__PRETTY_FUNCTION__ is yet another name for __func__. However, in C++,
__PRETTY_FUNCTION__ contains the type signature of the function as
well as its bare name

http://gcc.gnu.org/onlinedocs/gcc/Function-Names.html

https://gitlab.gnome.org/GNOME/glib/issues/535
2019-02-05 12:20:23 +00:00
Philip Withnall
f2d51adc13 Merge branch 'fix-protocol-test-win32' into 'master'
Use win32 io channel on windows for the protocol test

See merge request GNOME/glib!613
2019-02-05 11:31:36 +00:00
Philip Withnall
22c168d5b7 Merge branch 'socket.win32' into 'master'
Win32: gio/gsocket.c: Set WSAEWOULDBLOCK on G_POLLABLE_RETURN_WOULD_BLOCK

See merge request GNOME/glib!634
2019-02-05 11:25:52 +00:00
Chun-wei Fan
bb73a22448 Win32: gio/gsocket.c: Set WSAEWOULDBLOCK on G_POLLABLE_RETURN_WOULD_BLOCK
To make things consistent across the board as that is the WinSock2 error
code that is received by g_socket_send_message_with_timeout() when it
returns G_POLLABLE_RETURN_WOULD_BLOCK.
2019-02-05 11:15:50 +08:00