[PATCH 3/5] Fix detecting errors in groups-and-envs-1.ks.

Chris Lumens clumens at redhat.com
Thu Dec 18 16:55:39 UTC 2014


I was trying to compare the output of rpm to an error code, which is completely
wrong.  Instead, compare error codes to error codes.

While I'm at it, make the error output a little easier to find in the logs.
---
 tests/kickstart_tests/basic-ostree.sh      |  2 +-
 tests/kickstart_tests/groups-and-envs-1.ks | 14 +++++++++-----
 tests/kickstart_tests/groups-and-envs-1.sh |  2 +-
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/tests/kickstart_tests/basic-ostree.sh b/tests/kickstart_tests/basic-ostree.sh
index 4909709..349263d 100755
--- a/tests/kickstart_tests/basic-ostree.sh
+++ b/tests/kickstart_tests/basic-ostree.sh
@@ -52,7 +52,7 @@ validate() {
     result=$(virt-cat -a ${img} -m /dev/sda2 /ostree/deploy/fedora-atomic/var/roothome/RESULT)
     if [[ $? != 0 ]]; then
         status=1
-        echo /root/RESULT does not exist in VM image.
+        echo '*** /root/RESULT does not exist in VM image.'
     elif [[ "${result}" != "SUCCESS" ]]; then
         status=1
         echo ${result}
diff --git a/tests/kickstart_tests/groups-and-envs-1.ks b/tests/kickstart_tests/groups-and-envs-1.ks
index 500ea08..9e52295 100644
--- a/tests/kickstart_tests/groups-and-envs-1.ks
+++ b/tests/kickstart_tests/groups-and-envs-1.ks
@@ -37,12 +37,16 @@ cat <<EOF > /usr/bin/run-test.sh
 
 # We don't have a way of determining if a group/env is installed or not.
 # These sentinel packages will have to do.
-if [[ \$(rpm -q httpd) != 0 ]]; then
-    echo FAILURE > /root/RESULT
-elif [[ \$(rpm -q gcc) != 0 ]]; then
-    echo FAILURE > /root/RESULT
+rpm -q httpd
+if [[ \$? != 0 ]]; then
+    echo '*** web-server-environment was not installed' > /root/RESULT
 else
-    echo SUCCESS > /root/RESULT
+    rpm -q gcc
+    if [[ \$? != 0 ]]; then
+        echo '*** c-development was not installed' > /root/RESULT
+    else
+        echo SUCCESS > /root/RESULT
+    fi
 fi
 
 shutdown -h now
diff --git a/tests/kickstart_tests/groups-and-envs-1.sh b/tests/kickstart_tests/groups-and-envs-1.sh
index 389bcc5..9ebec79 100755
--- a/tests/kickstart_tests/groups-and-envs-1.sh
+++ b/tests/kickstart_tests/groups-and-envs-1.sh
@@ -45,7 +45,7 @@ validate() {
     result=$(virt-cat -a ${img} -m /dev/sda2 /root/RESULT)
     if [[ $? != 0 ]]; then
         status=1
-        echo /root/RESULT does not exist in VM image.
+        echo '*** /root/RESULT does not exist in VM image.'
     elif [[ "${result}" != "SUCCESS" ]]; then
         status=1
         echo ${result}
-- 
1.9.3



More information about the anaconda-patches mailing list