run_qemu.sh: add 20m timeout and print qemu log on failure
This commit is contained in:
parent
126c399d30
commit
d947f765df
1 changed files with 9 additions and 2 deletions
11
run_qemu.sh
11
run_qemu.sh
|
@ -9,6 +9,7 @@ tmpdir="$(mktemp -d)"
|
||||||
cleanup() {
|
cleanup() {
|
||||||
rv=$?
|
rv=$?
|
||||||
rm -f "$tmpdir/debian-$DEFAULT_DIST-overlay.qcow"
|
rm -f "$tmpdir/debian-$DEFAULT_DIST-overlay.qcow"
|
||||||
|
rm -f "$tmpdir/log"
|
||||||
[ -e "$tmpdir" ] && rmdir "$tmpdir"
|
[ -e "$tmpdir" ] && rmdir "$tmpdir"
|
||||||
if [ -e shared/result.txt ]; then
|
if [ -e shared/result.txt ]; then
|
||||||
head --lines=-1 shared/result.txt
|
head --lines=-1 shared/result.txt
|
||||||
|
@ -29,7 +30,8 @@ trap cleanup INT TERM EXIT
|
||||||
qemu-img create -f qcow2 -b "$(realpath $cachedir)/debian-$DEFAULT_DIST.qcow" -F qcow2 "$tmpdir/debian-$DEFAULT_DIST-overlay.qcow"
|
qemu-img create -f qcow2 -b "$(realpath $cachedir)/debian-$DEFAULT_DIST.qcow" -F qcow2 "$tmpdir/debian-$DEFAULT_DIST-overlay.qcow"
|
||||||
# to connect to serial use:
|
# to connect to serial use:
|
||||||
# minicom -D 'unix#/tmp/ttyS0'
|
# minicom -D 'unix#/tmp/ttyS0'
|
||||||
qemu-system-x86_64 \
|
ret=0
|
||||||
|
timeout 20m qemu-system-x86_64 \
|
||||||
-no-user-config \
|
-no-user-config \
|
||||||
-M accel=kvm:tcg -m 1G -nographic \
|
-M accel=kvm:tcg -m 1G -nographic \
|
||||||
-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 \
|
-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 \
|
||||||
|
@ -38,4 +40,9 @@ qemu-system-x86_64 \
|
||||||
-serial unix:/tmp/ttyS1,server,nowait \
|
-serial unix:/tmp/ttyS1,server,nowait \
|
||||||
-net nic,model=virtio -net user \
|
-net nic,model=virtio -net user \
|
||||||
-virtfs local,id=mmdebstrap,path="$(pwd)/shared",security_model=none,mount_tag=mmdebstrap \
|
-virtfs local,id=mmdebstrap,path="$(pwd)/shared",security_model=none,mount_tag=mmdebstrap \
|
||||||
-drive file="$tmpdir/debian-$DEFAULT_DIST-overlay.qcow",cache=unsafe,index=0,if=virtio
|
-drive file="$tmpdir/debian-$DEFAULT_DIST-overlay.qcow",cache=unsafe,index=0,if=virtio \
|
||||||
|
>"$tmpdir/log" 2>&1 || ret=$?
|
||||||
|
if [ "$ret" -ne 0 ]; then
|
||||||
|
cat "$tmpdir/log"
|
||||||
|
exit $ret
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue