00db10
commit c5c13355132e73578bbc0c612ddff964e6199747
00db10
Author: Will Newton <will.newton@linaro.org>
00db10
Date:   Fri Apr 11 15:21:23 2014 +0100
00db10
00db10
    test-skeleton.c: Use stdout for error messages
00db10
    
00db10
    At the moment the test skeleton uses a mixture of stdout and
00db10
    stderr for error message output. Using stdout for all test output
00db10
    keeps all output correctly ordered and properly redirected to the
00db10
    output file. The suggestion to use stdout is also made on the wiki:
00db10
    
00db10
    https://sourceware.org/glibc/wiki/Testing/Testsuite#Writing_a_test_case
00db10
    
00db10
    ChangeLog:
00db10
    
00db10
    2014-06-23  Will Newton  <will.newton@linaro.org>
00db10
    
00db10
            * test-skeleton.c (signal_handler): Use printf and %m
00db10
            rather than perror.  Use printf rather than fprintf to
00db10
            stderr.  Use puts rather than fputs to stderr.
00db10
            (main): Likewise.
00db10
00db10
Index: b/test-skeleton.c
00db10
===================================================================
00db10
--- a/test-skeleton.c
00db10
+++ b/test-skeleton.c
00db10
@@ -188,7 +188,7 @@ signal_handler (int sig __attribute__ ((
00db10
     }
00db10
   if (killed != 0 && killed != pid)
00db10
     {
00db10
-      perror ("Failed to kill test process");
00db10
+      printf ("Failed to kill test process: %m\n");
00db10
       exit (1);
00db10
     }
00db10
 
00db10
@@ -209,16 +209,16 @@ signal_handler (int sig __attribute__ ((
00db10
 #endif
00db10
 
00db10
   if (killed == 0 || (WIFSIGNALED (status) && WTERMSIG (status) == SIGKILL))
00db10
-    fputs ("Timed out: killed the child process\n", stderr);
00db10
+    puts ("Timed out: killed the child process");
00db10
   else if (WIFSTOPPED (status))
00db10
-    fprintf (stderr, "Timed out: the child process was %s\n",
00db10
-	     strsignal (WSTOPSIG (status)));
00db10
+    printf ("Timed out: the child process was %s\n",
00db10
+	    strsignal (WSTOPSIG (status)));
00db10
   else if (WIFSIGNALED (status))
00db10
-    fprintf (stderr, "Timed out: the child process got signal %s\n",
00db10
-	     strsignal (WTERMSIG (status)));
00db10
+    printf ("Timed out: the child process got signal %s\n",
00db10
+	    strsignal (WTERMSIG (status)));
00db10
   else
00db10
-    fprintf (stderr, "Timed out: killed the child process but it exited %d\n",
00db10
-	     WEXITSTATUS (status));
00db10
+    printf ("Timed out: killed the child process but it exited %d\n",
00db10
+	    WEXITSTATUS (status));
00db10
 
00db10
   /* Exit with an error.  */
00db10
   exit (1);
00db10
@@ -308,7 +308,7 @@ main (int argc, char *argv[])
00db10
 
00db10
       if (chdir (test_dir) < 0)
00db10
 	{
00db10
-	  perror ("chdir");
00db10
+	  printf ("chdir: %m\n");
00db10
 	  exit (1);
00db10
 	}
00db10
     }
00db10
@@ -367,10 +367,10 @@ main (int argc, char *argv[])
00db10
 	    data_limit.rlim_cur = MIN ((rlim_t) TEST_DATA_LIMIT,
00db10
 				       data_limit.rlim_max);
00db10
 	  if (setrlimit (RLIMIT_DATA, &data_limit) < 0)
00db10
-	    perror ("setrlimit: RLIMIT_DATA");
00db10
+	    printf ("setrlimit: RLIMIT_DATA: %m\n");
00db10
 	}
00db10
       else
00db10
-	perror ("getrlimit: RLIMIT_DATA");
00db10
+	printf ("getrlimit: RLIMIT_DATA: %m\n");
00db10
 #endif
00db10
 
00db10
       /* We put the test process in its own pgrp so that if it bogusly
00db10
@@ -382,7 +382,7 @@ main (int argc, char *argv[])
00db10
     }
00db10
   else if (pid < 0)
00db10
     {
00db10
-      perror ("Cannot fork test program");
00db10
+      printf ("Cannot fork test program: %m\n");
00db10
       exit (1);
00db10
     }
00db10
 
00db10
@@ -420,18 +420,16 @@ main (int argc, char *argv[])
00db10
       if (EXPECTED_SIGNAL != 0)
00db10
 	{
00db10
 	  if (WTERMSIG (status) == 0)
00db10
-	    fprintf (stderr,
00db10
-		     "Expected signal '%s' from child, got none\n",
00db10
-		     strsignal (EXPECTED_SIGNAL));
00db10
+	    printf ("Expected signal '%s' from child, got none\n",
00db10
+		    strsignal (EXPECTED_SIGNAL));
00db10
 	  else
00db10
-	    fprintf (stderr,
00db10
-		     "Incorrect signal from child: got `%s', need `%s'\n",
00db10
-		     strsignal (WTERMSIG (status)),
00db10
-		     strsignal (EXPECTED_SIGNAL));
00db10
+	    printf ("Incorrect signal from child: got `%s', need `%s'\n",
00db10
+		    strsignal (WTERMSIG (status)),
00db10
+		    strsignal (EXPECTED_SIGNAL));
00db10
 	}
00db10
       else
00db10
-	fprintf (stderr, "Didn't expect signal from child: got `%s'\n",
00db10
-		 strsignal (WTERMSIG (status)));
00db10
+	printf ("Didn't expect signal from child: got `%s'\n",
00db10
+		strsignal (WTERMSIG (status)));
00db10
       exit (1);
00db10
     }
00db10
 
00db10
@@ -441,8 +439,8 @@ main (int argc, char *argv[])
00db10
 #else
00db10
   if (WEXITSTATUS (status) != EXPECTED_STATUS)
00db10
     {
00db10
-      fprintf (stderr, "Expected status %d, got %d\n",
00db10
-	       EXPECTED_STATUS, WEXITSTATUS (status));
00db10
+      printf ("Expected status %d, got %d\n",
00db10
+	      EXPECTED_STATUS, WEXITSTATUS (status));
00db10
       exit (1);
00db10
     }
00db10