]> granicus.if.org Git - libevent/commitdiff
Fix test.sh output on solaris
authorDave Hart <hart@ntp.org>
Tue, 1 Feb 2011 06:15:48 +0000 (01:15 -0500)
committerNick Mathewson <nickm@torproject.org>
Tue, 1 Feb 2011 07:09:49 +0000 (02:09 -0500)
Solaris echo -n doesn't omit newlines, but printf omits newlines in
more places.

test/test.sh

index 48deb9b1f94f1c961728c20b92d389547ee6c31a..0054faee5ea5ed7cd2f956f71ea6bdf10e6c1587 100755 (executable)
@@ -7,12 +7,18 @@ then
        TEST_OUTPUT_FILE=/dev/null
 fi
 
-# /bin/echo is a little more likely to support -n than sh's builtin echo.
-if test -x /bin/echo
+# /bin/echo is a little more likely to support -n than sh's builtin echo,
+# printf is even more likely
+if test "`printf hello 2>&1`" = "hello"
 then
-       ECHO=/bin/echo
+       ECHO_N="printf"
 else
-       ECHO=echo
+       if test -x /bin/echo
+       then
+               ECHO_N="/bin/echo -n"
+       else
+               ECHO_N="echo -n"
+       fi
 fi
 
 if test "$TEST_OUTPUT_FILE" != "/dev/null"
@@ -45,7 +51,7 @@ announce () {
 }
 
 announce_n () {
-       $ECHO -n "$@"
+       $ECHO_N "$@"
        echo "$@" >>"$TEST_OUTPUT_FILE"
 }