[PATCH 3/5] test.sh: add feature for testing the output of a grubby command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Instead of comparing the configuration file that gets generated by
a grubby command

Signed-off-by: Cleber Rosa <crosa@xxxxxxxxxx>
---
 test.sh |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/test.sh b/test.sh
index 1fd4d85..95d552b 100755
--- a/test.sh
+++ b/test.sh
@@ -69,10 +69,38 @@ oneTest() {
     fi 
 }
 
+# Test feature that display some information, checking that output instead of
+# the generated configuration file
+oneDisplayTest() {
+    typeset mode=$1 cfg=test/$2 correct=test/results/$3
+    shift 3
+
+    echo "$testing ... $mode $cfg $correct"
+    runme=( ./grubby "$mode" --bad-image-okay -c "$cfg" "$@" )
+    if "${runme[@]}" | cmp "$correct" > /dev/null; then
+	(( pass++ ))
+	if $opt_verbose; then
+	    echo -------------------------------------------------------------
+	    echo -n "PASS: "
+	    printf "%q " "${runme[@]}"; echo
+	    "${runme[@]}" | diff -U30 "$cfg" -
+	    echo
+	fi
+    else
+	(( fail++ ))
+	echo -------------------------------------------------------------
+	echo -n "FAIL: "
+	printf "%q " "${runme[@]}"; echo
+	"${runme[@]}" | diff -U30 "$correct" -
+	echo
+    fi
+}
+
 # generate convenience functions
 for b in $(./grubby --help | \
 	sed -n 's/^.*--\([^ ]*\) *configure \1 bootloader$/\1/p'); do
     eval "${b}Test() { [[ \"$b\" == \$opt_bootloader ]] && oneTest --$b \"\$@\"; }"
+    eval "${b}DisplayTest() { [[ \"$b\" == \$opt_bootloader ]] && oneDisplayTest --$b \"\$@\"; }"
 done
 
 #----------------------------------------------------------------------
-- 
1.7.6.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux