diff mbox

[kvm-unit-tests,05/12] scripts/mkstandalone: reuse $TEST_DIR/run

Message ID 1453209851-27760-6-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 now use bash, so there is no need to use DRYRUN when we can use
the functionality directly.  This also gets rid of minor bugs, like not
checking if QEMU on the host is actually supported.

Another pleasant side-effect is instant `make standalone`.

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

Patch

diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh
index 9ab4b1920e50..b2bc2f7d6c2e 100755
--- a/scripts/mkstandalone.sh
+++ b/scripts/mkstandalone.sh
@@ -55,13 +55,6 @@  function mkstandalone()
 	fi
 
 	standalone=tests/$testname
-	cmdline=$(DRYRUN=yes ACCEL=$accel ./$TEST_DIR-run $kernel)
-	if [ $? -ne 0 ]; then
-		echo $cmdline
-		exit 1
-	fi
-	qemu=$(cut -d' ' -f1 <<< "$cmdline")
-	cmdline=$(cut -d' ' -f2- <<< "$cmdline")
 
 	exec {tmpfd}<&1
 	exec > $standalone
@@ -92,31 +85,24 @@  else
 	echo "trap 'rm -f \$cleanup' EXIT"
 
 	temp_file bin "$kernel"
+	temp_file RUNTIME_arch_run "$TEST_DIR/run"
 
 	cat <<EOF
 
-qemu="$qemu"
-if [ "\$QEMU" ]; then
-	qemu="\$QEMU"
-fi
-
 MAX_SMP="MAX_SMP"
-echo \$qemu $cmdline -smp $smp $opts
+echo \$RUNTIME_arch_run \$bin -smp $smp $opts
 
-cmdline="\`echo '$cmdline' | sed s%$kernel%_NO_FILE_4Uhere_%\`"
-if \$qemu \$cmdline 2>&1 | grep 'No accelerator found'; then
+if \$RUNTIME_arch_run _NO_FILE_4Uhere_ 2>&1 | grep 'No accelerator found'; then
 	ret=2
 else
 	MAX_SMP=\`getconf _NPROCESSORS_CONF\`
-	while \$qemu \$cmdline -smp \$MAX_SMP 2>&1 | grep 'exceeds max cpus' > /dev/null; do
+	while \$RUNTIME_arch_run \$bin -smp \$MAX_SMP 2>&1 | grep 'exceeds max cpus' > /dev/null; do
 		MAX_SMP=\`expr \$MAX_SMP - 1\`
 	done
 
-	cmdline="\`echo '$cmdline' | sed s%$kernel%\$bin%\`"
-	\$qemu \$cmdline -smp $smp $opts
+	\$RUNTIME_arch_run \$bin -smp $smp $opts
 	ret=\$?
 fi
-echo Return value from qemu: \$ret
 if [ \$ret -le 1 ]; then
 	echo PASS $testname 1>&2
 else