adamwill / rpms / openscap

Forked from rpms/openscap 3 years ago
Clone

Blame SOURCES/openscap-1.3.3-remove-useless-warnings-tests.patch

0b628f
From b2b00e2316439d6517c8b763f542db637ebcf0b0 Mon Sep 17 00:00:00 2001
0b628f
From: Matus Marhefka <mmarhefk@redhat.com>
0b628f
Date: Tue, 3 Mar 2020 14:12:39 +0100
0b628f
Subject: [PATCH] tests/probes/environmentvariable58: add test to cover
0b628f
 7c78b84dd
0b628f
0b628f
---
0b628f
 .../test_probes_environmentvariable58.sh               | 10 +++++++++-
0b628f
 1 file changed, 9 insertions(+), 1 deletion(-)
0b628f
0b628f
diff --git a/tests/probes/environmentvariable58/test_probes_environmentvariable58.sh b/tests/probes/environmentvariable58/test_probes_environmentvariable58.sh
0b628f
index 786ea528a..7679c3495 100755
0b628f
--- a/tests/probes/environmentvariable58/test_probes_environmentvariable58.sh
0b628f
+++ b/tests/probes/environmentvariable58/test_probes_environmentvariable58.sh
0b628f
@@ -24,13 +24,16 @@ function test_probes_environmentvariable58 {
0b628f
     local ret_val=0;
0b628f
     local DF="$1.xml"
0b628f
     local RF="$1.results.xml"
0b628f
+    echo "result file: $RF"
0b628f
+    local stderr=$(mktemp $1.err.XXXXXX)
0b628f
+    echo "stderr file: $stderr"
0b628f
 
0b628f
     [ -f $RF ] && rm -f $RF
0b628f
 
0b628f
     bash ${srcdir}/$1.xml.sh > $DF
0b628f
     LINES=$?
0b628f
 
0b628f
-    $OSCAP oval eval --results $RF $DF
0b628f
+    $OSCAP oval eval --results $RF $DF 2> $stderr
0b628f
 
0b628f
     if [ -f $RF ]; then
0b628f
 	verify_results "def" $DF $RF 1 && verify_results "tst" $DF $RF $LINES
0b628f
@@ -39,6 +42,11 @@ function test_probes_environmentvariable58 {
0b628f
 	ret_val=1
0b628f
     fi
0b628f
 
0b628f
+    # Test fails if there are any warnings or "Entity has no value" on stderr.
0b628f
+    echo "Verify that there are no warnings on stderr"
0b628f
+    grep -Ei "(W:|Entity has no value)" $stderr && ret_val=1
0b628f
+
0b628f
+    rm $stderr
0b628f
     return $ret_val
0b628f
 }
0b628f