From 981988c72926e2da2e11a69772fc4838d3e4ddaa Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Wed, 8 Sep 2010 14:51:27 -0400 Subject: [PATCH] Don't mix up stdout and stderr Repeated runs of the test suite, like this $ while `/bin/true` ; do ./udisks-test || break ; done actually triggered this error. Signed-off-by: David Zeuthen --- src/tests/helper.c | 2 ++ src/tests/test.c | 8 ++++---- src/udisksspawnedjob.c | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/tests/helper.c b/src/tests/helper.c index 84b3e8e..5cd9e64 100644 --- a/src/tests/helper.c +++ b/src/tests/helper.c @@ -32,6 +32,8 @@ main (int argc, char *argv[]) { gint ret; + g_type_init (); + ret = 1; g_assert_cmpint (argc, ==, 2); diff --git a/src/tests/test.c b/src/tests/test.c index bf5a4c1..d347245 100644 --- a/src/tests/test.c +++ b/src/tests/test.c @@ -191,7 +191,7 @@ read_stdout_on_spawned_job_completed (UDisksSpawnedJob *job, GString *standard_error, gpointer user_data) { - g_assert (error == NULL); + g_assert_no_error (error); g_assert_cmpstr (standard_output->str, ==, "Hello Stdout\n" "Line 2\n"); @@ -224,7 +224,7 @@ read_stderr_on_spawned_job_completed (UDisksSpawnedJob *job, GString *standard_error, gpointer user_data) { - g_assert (error == NULL); + g_assert_no_error (error); g_assert_cmpstr (standard_output->str, ==, ""); g_assert_cmpstr (standard_error->str, ==, "Hello Stderr\n" @@ -257,7 +257,7 @@ exit_status_on_spawned_job_completed (UDisksSpawnedJob *job, GString *standard_error, gpointer user_data) { - g_assert (error == NULL); + g_assert_no_error (error); g_assert_cmpstr (standard_output->str, ==, ""); g_assert_cmpstr (standard_error->str, ==, ""); g_assert (WIFEXITED (status)); @@ -327,7 +327,7 @@ binary_output_on_spawned_job_completed (UDisksSpawnedJob *job, { guint n; - g_assert (error == NULL); + g_assert_no_error (error); g_assert_cmpstr (standard_error->str, ==, ""); g_assert (WIFEXITED (status)); g_assert (WEXITSTATUS (status) == 0); diff --git a/src/udisksspawnedjob.c b/src/udisksspawnedjob.c index 241f892..21705d9 100644 --- a/src/udisksspawnedjob.c +++ b/src/udisksspawnedjob.c @@ -276,12 +276,12 @@ child_watch_cb (GPid pid, gsize buf_size; gboolean ret; - if (g_io_channel_read_to_end (job->child_stderr_channel, &buf, &buf_size, NULL) == G_IO_STATUS_NORMAL) + if (g_io_channel_read_to_end (job->child_stdout_channel, &buf, &buf_size, NULL) == G_IO_STATUS_NORMAL) { g_string_append_len (job->child_stdout, buf, buf_size); g_free (buf); } - if (g_io_channel_read_to_end (job->child_stdout_channel, &buf, &buf_size, NULL) == G_IO_STATUS_NORMAL) + if (g_io_channel_read_to_end (job->child_stderr_channel, &buf, &buf_size, NULL) == G_IO_STATUS_NORMAL) { g_string_append_len (job->child_stderr, buf, buf_size); g_free (buf); -- 2.7.4