mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Fix test.sh on shells without echo -n
Some systems have a version of /bin/sh whose builtin echo doesn't support the -n option used in test/test.sh. /bin/echo, however, usually does. This patch makes us use /bin/echo for echo -n whenever it is present. Also, our use of echo -n really only made sense when suppressing all test output. Since test output isn't suppressed when logging to a file, this pach makes us stop using echo -n when logging to a file.
This commit is contained in:
parent
b9f43b231f
commit
94131e92b8
22
test/test.sh
22
test/test.sh
@ -5,6 +5,14 @@ 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
|
||||
then
|
||||
ECHO=/bin/echo
|
||||
else
|
||||
ECHO=echo
|
||||
fi
|
||||
|
||||
touch "$TEST_OUTPUT_FILE" || exit 1
|
||||
|
||||
TEST_DIR=.
|
||||
@ -29,6 +37,12 @@ announce () {
|
||||
echo $@ >>"$TEST_OUTPUT_FILE"
|
||||
}
|
||||
|
||||
announce_n () {
|
||||
$ECHO -n $@
|
||||
echo $@ >>"$TEST_OUTPUT_FILE"
|
||||
}
|
||||
|
||||
|
||||
run_tests () {
|
||||
if $TEST_DIR/test-init 2>>"$TEST_OUTPUT_FILE" ;
|
||||
then
|
||||
@ -38,28 +52,28 @@ run_tests () {
|
||||
return
|
||||
fi
|
||||
|
||||
announce -n " test-eof: "
|
||||
announce_n " test-eof: "
|
||||
if $TEST_DIR/test-eof >>"$TEST_OUTPUT_FILE" ;
|
||||
then
|
||||
announce OKAY ;
|
||||
else
|
||||
announce FAILED ;
|
||||
fi
|
||||
announce -n " test-weof: "
|
||||
announce_n " test-weof: "
|
||||
if $TEST_DIR/test-weof >>"$TEST_OUTPUT_FILE" ;
|
||||
then
|
||||
announce OKAY ;
|
||||
else
|
||||
announce FAILED ;
|
||||
fi
|
||||
announce -n " test-time: "
|
||||
announce_n " test-time: "
|
||||
if $TEST_DIR/test-time >>"$TEST_OUTPUT_FILE" ;
|
||||
then
|
||||
announce OKAY ;
|
||||
else
|
||||
announce FAILED ;
|
||||
fi
|
||||
announce -n " regress: "
|
||||
announce_n " regress: "
|
||||
if $TEST_DIR/regress >>"$TEST_OUTPUT_FILE" ;
|
||||
then
|
||||
announce OKAY ;
|
||||
|
Loading…
x
Reference in New Issue
Block a user