Don't mix up stdout and stderr
authorDavid Zeuthen <davidz@redhat.com>
Wed, 8 Sep 2010 18:51:27 +0000 (14:51 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Wed, 8 Sep 2010 18:51:27 +0000 (14:51 -0400)
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 <davidz@redhat.com>
src/tests/helper.c
src/tests/test.c
src/udisksspawnedjob.c

index 84b3e8e..5cd9e64 100644 (file)
@@ -32,6 +32,8 @@ main (int argc, char *argv[])
 {
   gint ret;
 
+  g_type_init ();
+
   ret = 1;
 
   g_assert_cmpint (argc, ==, 2);
index bf5a4c1..d347245 100644 (file)
@@ -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);
index 241f892..21705d9 100644 (file)
@@ -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);