diff mbox

[kvm-unit-tests,08/12] scripts/mkstandalone: refactor check for test kernel

Message ID 1453209851-27760-9-git-send-email-rkrcmar@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Radim Krčmář Jan. 19, 2016, 1:24 p.m. UTC
We can return early and it was practically a failure, so non-zero code
would be better. (We probably shouldn't generate a useless test, but
that's for later.)

Indentation will be fixed later.

Signed-off-by: Radim Kr?má? <rkrcmar@redhat.com>
---
 scripts/mkstandalone.sh | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh
index b2bc2f7d6c2e..70efe64af243 100755
--- a/scripts/mkstandalone.sh
+++ b/scripts/mkstandalone.sh
@@ -76,12 +76,12 @@  done
 
 EOF
 fi
-if [ ! -f $kernel ]; then
-	cat <<EOF
-echo "skip $testname (test kernel not present)" 1>&2
-exit 1
-EOF
-else
+	if [ ! -f $kernel ]; then
+		echo 'echo "skip '"$testname"' (test kernel not present)" 1>&2'
+		echo 'exit 1'
+	else
+	# XXX: bad indentation
+
 	echo "trap 'rm -f \$cleanup' EXIT"
 
 	temp_file bin "$kernel"
@@ -110,7 +110,8 @@  else
 fi
 exit 0
 EOF
-fi
+	fi
+
 	exec 1<&$tmpfd {tmpfd}<&-
 	chmod +x $standalone