[PATCH 06/15] virt-aa-helper-test: Print errors to stderr

Michal Privoznik via Devel posted 15 patches 2 months, 4 weeks ago
[PATCH 06/15] virt-aa-helper-test: Print errors to stderr
Posted by Michal Privoznik via Devel 2 months, 4 weeks ago
From: Michal Privoznik <mprivozn@redhat.com>

When a test case fails, there are two echo-s executed: the first
one either prints the error message into /dev/null (default) or
onto stdout (when the test script is executed with -d). Then, the
second one prints the error message onto stdout. While this
technically works, there's nothing ever printed onto stderr which
is usually what's captured. Worse, if some command within the
script fails, it prints something onto stderr but then looking at
meson logs it's needlessly hard to match stderr and stdout lines.

Just print error messages onto stderr.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 tests/virt-aa-helper-test | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/virt-aa-helper-test b/tests/virt-aa-helper-test
index 4c8d31c9d7..8259c2679f 100755
--- a/tests/virt-aa-helper-test
+++ b/tests/virt-aa-helper-test
@@ -116,7 +116,7 @@ testme() {
         input="$4"
         if [ ! -e "$input" ]; then
             echo "FAIL: could not find $input" >$output
-            echo "FAIL: could not find $input"
+            echo "FAIL: could not find $input" >&2
             echo " '$extra_args $args': "
             errors=$(($errors + 1))
         fi
@@ -141,6 +141,7 @@ testme() {
     if [ -n "$checkrule" ]; then
         if ! grep "$checkrule" "$tmpout" >/dev/null; then
             echo "FAIL: missing rule '$checkrule'" >"$output"
+            echo "FAIL: missing rule '$checkrule'" >&2
             rule_missing=1
         fi
     fi
-- 
2.49.0