mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 02:32:11 +01:00
tests: Use a pipe rather than a socketpair in stream-rw_all test
The test only needs a unidirectional channel, and a pipe is sufficient for that. This may simplify things when running the test on Hurd; see https://gitlab.gnome.org/GNOME/glib/-/issues/3148#note_1874198. Additionally, set `O_NONBLOCK` on the pipe since the test seems to expect that partial writes will succeed and that writes to a full buffer will fail rather than block. Signed-off-by: Philip Withnall <philip@tecnocode.co.uk> Helps: #3148
This commit is contained in:
parent
aa936e12da
commit
a0de4963e8
@ -146,6 +146,7 @@ test_read_all_async_memory (void)
|
||||
|
||||
#ifdef G_OS_UNIX
|
||||
#include <errno.h>
|
||||
#include <glib-unix.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <gio/gunixinputstream.h>
|
||||
@ -165,13 +166,12 @@ test_read_write_all_async_pipe (void)
|
||||
|
||||
{
|
||||
gint sv[2];
|
||||
gint s;
|
||||
|
||||
s = socketpair (AF_UNIX, SOCK_STREAM, 0, sv);
|
||||
g_assert (s == 0);
|
||||
g_unix_open_pipe (sv, O_CLOEXEC | O_NONBLOCK, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
out = g_unix_output_stream_new (sv[0], TRUE);
|
||||
in = g_unix_input_stream_new (sv[1], TRUE);
|
||||
out = g_unix_output_stream_new (sv[1], TRUE);
|
||||
in = g_unix_input_stream_new (sv[0], TRUE);
|
||||
}
|
||||
|
||||
/* Try to fill up the buffer */
|
||||
|
Loading…
x
Reference in New Issue
Block a user