aboutsummaryrefslogtreecommitdiffstats
path: root/mtest.sh
diff options
context:
space:
mode:
authorMichał Łyszczek <michal.lyszczek@bofc.pl>2020-04-29 11:34:29 +0200
committerMichał Łyszczek <michal.lyszczek@bofc.pl>2020-04-29 11:52:51 +0200
commitfe58973929143af72662078ad6ff1d6a4ea66222 (patch)
tree063bf78ad50ebae948699d877b8547a133cd7029 /mtest.sh
parent864dd863bf59d3182fc98fcf353dd730801af261 (diff)
downloadmtest-fe58973929143af72662078ad6ff1d6a4ea66222.tar.gz
mtest-fe58973929143af72662078ad6ff1d6a4ea66222.tar.bz2
mtest-fe58973929143af72662078ad6ff1d6a4ea66222.zip
mtest.sh: redirect evaluated output to stderr
Output of test expression and asserts should go to stderr, and only test results should be printed to stdout. This allows doing ./tests.sh >results 2>errors This might be usefull when tests prints tons of diagnostic messages and test results are lost within output. Also, it helps parser to quickly get info about ok/nok tests. Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
Diffstat (limited to 'mtest.sh')
-rwxr-xr-xmtest.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/mtest.sh b/mtest.sh
index 5f3d685..a87b753 100755
--- a/mtest.sh
+++ b/mtest.sh
@@ -137,8 +137,8 @@ mt_fail()
err_msg="$2"
fi
mt_total_checks=$(( mt_total_checks + 1 ))
- if ! eval $1; then
- echo "# assert $mt_current_test, '$err_msg'"
+ if ! eval $1 >&2; then
+ echo "# assert $mt_current_test, '$err_msg'" >&2
mt_test_status=1
mt_checks_failed=$(( mt_checks_failed + 1 ))
fi
@@ -156,8 +156,8 @@ mt_fail()
mt_dfail()
{
mt_total_checks=$(( mt_total_checks + 1 ))
- if ! $@; then
- echo "# assert $mt_current_test, '$@'"
+ if ! $@ >&2; then
+ echo "# assert $mt_current_test, '$@'" >&2
mt_test_status=1
mt_checks_failed=$(( mt_checks_failed + 1 ))
fi