Commit Graph

20 Commits

Author SHA1 Message Date
Philip Withnall
99a325356d tests: Fix a compiler warning about string+int arithmetic
Clang warns about string+int not appending to the string (to try and
catch newbie mistakes). While this test didn’t expect that to happen, it
was substituting the same constant string in multiple places for no good
reason. Switch to a single static const string, which should also fix
the compiler warning.

We have to define the string length since it’s used in various
stack-allocated array lengths. This is the easiest fix without more
major refactoring of the test to be less 90s.

Also make things a bit more static.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-24 16:18:58 +00:00
Sebastian Dröge
b94940dfae Add test for blocking and non-blocking and async read/write(v) on UNIX streams 2019-01-24 16:26:05 +02:00
Philip Withnall
93b519b104 tests: Various minor leak fixes in the GIO tests
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-29 12:13:32 +01:00
Matthias Clasen
fc35c3487e Improve unix stream test coverage 2013-06-02 01:47:19 -04: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
1dc774a653 Remove g_type_init() calls
Very many testcases, some GLib tools (resource compiler, etc) and
GApplication were calling g_type_init().

Remove those uses, as they are no longer required.

https://bugzilla.gnome.org/show_bug.cgi?id=686161
2012-10-16 09:39:24 -04:00
Dan Winship
beb0f9c150 gio/tests: fix leaks
https://bugzilla.gnome.org/show_bug.cgi?id=682560
2012-09-03 08:41:23 -04:00
Matthias Clasen
b22f4a2dd2 Improve test coverage for unix streams 2012-08-19 02:25:02 -04:00
Dan Winship
74dad004d1 GUnixInput/OutputStream: fix blocking methods to always block
Previously, if you created a GUnixInputStream or GUnixOutputStream
from a non-blocking file descriptor, it might sometimes return
G_IO_ERROR_WOULD_BLOCK from g_input_stream_read/g_output_stream_write,
which is wrong. Fix that. (Use the GPollableInput/OutputStream methods
if you want non-blocking I/O.)

Also, add a test for this to gio/tests/unix-streams.

Also, fix the GError messages to say "Error reading from file
descriptor", etc instead of "Error reading from unix" (which was
presumably from a bad search and replace job).

https://bugzilla.gnome.org/show_bug.cgi?id=626866
2011-11-14 18:31:21 -05:00
Ryan Lortie
430c5635f2 g_thread_new: never fail
Remove the GError argument from g_thread_new() and abort on failure.
Introduce g_thread_try() for those who want to handle failure.
2011-10-13 01:00:57 -04:00
Ryan Lortie
015f4b4513 thread: nuke the concept of 'joinable'
And remove the 'joinable' argument from g_thread_new() and
g_thread_new_full().

Change the wording in the docs.  Clarify expectations for
(deprecated) g_thread_create().
2011-10-13 00:43:33 -04:00
Matthias Clasen
93e49aea1b Don't use deprecated GThread API in gio tests 2011-10-10 09:49:50 -04:00
Matthias Clasen
b2715bbc5e Fix a possible deadlock
the FdSource was calling g_cancellable_disconnect while holding the
main context lock, which is bad news if the ::cancelled handler is
trying to get that lock to wake up the mainloop...

Bug 586432
2010-08-03 10:41:21 -04:00
Matthias Clasen
620582e59c Remove redundant include 2010-07-30 19:51:20 -04:00
Matthias Clasen
04c7abba11 Work around deadlock in unix-streams test 2010-07-30 19:51:20 -04:00
Javier Jardón
ba0a6e1911 Fix compilation warning: Initialize the variable 2009-11-17 20:44:16 +01:00
Matthias Clasen
5694ab7642 Revert "Move gio tests from gio/tests/ to tests/gio/"
This reverts commit 2262d76b33.

Move GIO tests back to where they belong.
2009-07-05 22:49:24 -04:00
Benjamin Otte
2262d76b33 Move gio tests from gio/tests/ to tests/gio/
This avoids getting tests built every time when working on libgio and
running make in the gio/ directory.
2009-07-01 19:03:19 +02:00
Benjamin Otte
afd63c3281 fix warnings from gcc compilation with my mad CFLAGS 2009-06-29 18:25:02 +02:00
Dan Winship
7f4864e58d Bug 505361 - gunixinputstream.c assumes poll() available
Bug 509446 - portable blocking gio cancellation

	* gcancellable.c (g_cancellable_make_pollfd): New method to make a
	GPollFD for a cancellable (which is slightly more complicated on
	Windows than Unix).

	* gunixinputstream.c (g_unix_input_stream_read):
	* gunixoutputstream.c (g_unix_output_stream_write): Use
	g_cancellable_make_pollfd() and g_poll() rather than using poll()
	directly.

	* tests/unix-streams.c: test of GUnixInputStream,
	GUnixOutputStream, and GCancellable.

svn path=/trunk/; revision=7553
2008-09-26 16:19:35 +00:00