[PATCH] Check for unsubstituted strings before running a test.
David Shea
dshea at redhat.com
Mon Sep 14 20:19:00 UTC 2015
If the prepared kickstart still has any @STUFF@ substitution markers in
it, assume that something was missing while setting it up and fail the
test. Use a return code of 99 for setup failures in case we start doing
something with that.
---
tests/kickstart_tests/scripts/run_one_ks.sh | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/tests/kickstart_tests/scripts/run_one_ks.sh b/tests/kickstart_tests/scripts/run_one_ks.sh
index 1a5b44a..f0b43aa 100755
--- a/tests/kickstart_tests/scripts/run_one_ks.sh
+++ b/tests/kickstart_tests/scripts/run_one_ks.sh
@@ -21,8 +21,7 @@
# This script runs a single kickstart test on a single system. It takes
# command line arguments instead of environment variables because it is
# designed to be driven by run_kickstart_tests.sh via parallel. It is
-# not for direct use, though as long as you pass the right arguments there's
-# no reason it couldn't work.
+# not for direct use.
# Possible return values:
# 0 - Everything worked
@@ -75,9 +74,21 @@ runone() {
echo RESULT:${name}:FAILED:Test prep failed: ${ksfile}
cleanup ${tmpdir}
cleanup_tmp ${tmpdir}
- return 1
+ return 99
fi
+ # Check that the prepared kickstart is free of substitution markers. Normally
+ # the substitutions are run by run_kickstart_tests.sh, but prepare has a chance
+ # to run them too. If both of those left any @STUFF@ strings behind, fail.
+ unmatched="$(grep -o '@[^[:space:]]\+@' ${ks} | head -1)"
+ if [ -n "$unmatched" ]; then
+ echo "RESULT:${name}:FAILED:Unsubstituted pattern ${unmatched}"
+ cleanup ${tmpdir}
+ cleanup_tmp ${tmpdir}
+ return 99
+ fi
+
+
kargs=$(kernel_args)
if [[ "${kargs}" != "" ]]; then
kargs="--kernel-args \"$kargs\""
--
2.4.3
More information about the anaconda-patches
mailing list