From: Wei Jiangang Date: Wed, 14 Oct 2015 10:39:13 +0000 (+0800) Subject: tests: make redirects happen in correct order X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=28a72d65ca7612621b3f9487c8989230881fd102;p=people%2Fliuw%2Flibxenctrl-split%2Flibvirt.git tests: make redirects happen in correct order It should redirect stdout to /dev/null first, then redirect stderr to whatever stdout currently points at. Signed-off-by: Wei Jiangang --- diff --git a/tests/test-lib.sh b/tests/test-lib.sh index e612f8f21..aff179c79 100644 --- a/tests/test-lib.sh +++ b/tests/test-lib.sh @@ -248,9 +248,9 @@ trap '(exit $?); exit $?' 1 2 13 15 cd "$t_" || error_ "failed to cd to $t_" -if ( diff --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then +if ( diff --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then compare() { diff -u "$@"; } -elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then +elif ( cmp --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then compare() { cmp -s "$@"; } else compare() { cmp "$@"; }