Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo Alt (http://www.linux-archive.org/gentoo-alt/)
-   -   test.sh: add feature for testing the output of a grubby command (http://www.linux-archive.org/gentoo-alt/601293-test-sh-add-feature-testing-output-grubby-command.html)

Cleber Rosa 11-22-2011 01:34 PM

test.sh: add feature for testing the output of a grubby command
 
Instead of comparing the configuration file that gets generated by
a grubby command

Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 12:02 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.