diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-03-20 11:48:53 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-03-20 11:53:06 +0000 |
commit | ebf4d7a90dd9fcfbc9ff908da5b33f84df2de099 (patch) | |
tree | 08383d7c711a9d3eb9604f42e253f9772b45b383 /scripts/runqemu-internal | |
parent | 8207e3f48bed9ea1950dc545640abf0ea56426ce (diff) | |
download | poky-ebf4d7a90dd9fcfbc9ff908da5b33f84df2de099.tar.gz |
runqemu: Improve error handling/exit codes
runqemu-internal is sourced so should be returning with an error code in
case of errors. runqemu needs to deal with this.
This patch fixes up the various error paths so we're consistent and get
a sane exit status for runqemu which helps a lot in its use in the qemu
runtime testing on the autobuilder.
(From OE-Core rev: 753533b2f338ff2ef97eebd5eace7623404ae457)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/runqemu-internal')
-rwxr-xr-x | scripts/runqemu-internal | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal index 0e3dad0e13..e53e40c783 100755 --- a/scripts/runqemu-internal +++ b/scripts/runqemu-internal | |||
@@ -184,7 +184,7 @@ if [ "$TAP" = "" ]; then | |||
184 | if [ $? -ne 0 ]; then | 184 | if [ $? -ne 0 ]; then |
185 | # Re-run standalone to see verbose errors | 185 | # Re-run standalone to see verbose errors |
186 | sudo $QEMUIFUP $USERID $GROUPID $OECORE_NATIVE_SYSROOT | 186 | sudo $QEMUIFUP $USERID $GROUPID $OECORE_NATIVE_SYSROOT |
187 | return | 187 | return 1 |
188 | fi | 188 | fi |
189 | LOCKFILE="$LOCKDIR/$tap" | 189 | LOCKFILE="$LOCKDIR/$tap" |
190 | echo "Acquiring lockfile for $tap..." | 190 | echo "Acquiring lockfile for $tap..." |
@@ -256,20 +256,20 @@ case "$MACHINE" in | |||
256 | "spitz") ;; | 256 | "spitz") ;; |
257 | *) | 257 | *) |
258 | echo "Error: Unsupported machine type $MACHINE" | 258 | echo "Error: Unsupported machine type $MACHINE" |
259 | return | 259 | return 1 |
260 | ;; | 260 | ;; |
261 | esac | 261 | esac |
262 | 262 | ||
263 | if [ ! -f "$KERNEL" -a "x$FSTYPE" != "xvmdk" ]; then | 263 | if [ ! -f "$KERNEL" -a "x$FSTYPE" != "xvmdk" ]; then |
264 | echo "Error: Kernel image file $KERNEL doesn't exist" | 264 | echo "Error: Kernel image file $KERNEL doesn't exist" |
265 | cleanup | 265 | cleanup |
266 | return | 266 | return 1 |
267 | fi | 267 | fi |
268 | 268 | ||
269 | if [ "$FSTYPE" != "nfs" -a "$FSTYPE" != "vmdk" -a ! -f "$ROOTFS" ]; then | 269 | if [ "$FSTYPE" != "nfs" -a "$FSTYPE" != "vmdk" -a ! -f "$ROOTFS" ]; then |
270 | echo "Error: Image file $ROOTFS doesn't exist" | 270 | echo "Error: Image file $ROOTFS doesn't exist" |
271 | cleanup | 271 | cleanup |
272 | return | 272 | return 1 |
273 | fi | 273 | fi |
274 | 274 | ||
275 | if [ "$FSTYPE" = "nfs" ]; then | 275 | if [ "$FSTYPE" = "nfs" ]; then |
@@ -289,7 +289,7 @@ if [ "$FSTYPE" = "nfs" ]; then | |||
289 | runqemu-export-rootfs restart $ROOTFS | 289 | runqemu-export-rootfs restart $ROOTFS |
290 | if [ $? != 0 ]; then | 290 | if [ $? != 0 ]; then |
291 | cleanup | 291 | cleanup |
292 | return | 292 | return 1 |
293 | fi | 293 | fi |
294 | NFSRUNNING="true" | 294 | NFSRUNNING="true" |
295 | fi | 295 | fi |
@@ -313,7 +313,7 @@ if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv6" -o "$MACHINE" = "qemuarm | |||
313 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then | 313 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then |
314 | echo "Error: NFS mount point $ROOTFS doesn't exist" | 314 | echo "Error: NFS mount point $ROOTFS doesn't exist" |
315 | cleanup | 315 | cleanup |
316 | return | 316 | return 1 |
317 | fi | 317 | fi |
318 | KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" | 318 | KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
319 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M versatilepb --no-reboot $QEMU_UI_OPTIONS" | 319 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M versatilepb --no-reboot $QEMU_UI_OPTIONS" |
@@ -337,7 +337,7 @@ if [ "$MACHINE" = "qemux86" ]; then | |||
337 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then | 337 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then |
338 | echo "Error: NFS mount point $ROOTFS doesn't exist." | 338 | echo "Error: NFS mount point $ROOTFS doesn't exist." |
339 | cleanup | 339 | cleanup |
340 | return | 340 | return 1 |
341 | fi | 341 | fi |
342 | KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" | 342 | KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
343 | QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" | 343 | QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" |
@@ -364,7 +364,7 @@ if [ "$MACHINE" = "qemux86-64" ]; then | |||
364 | if [ ! -d "$ROOTFS" ]; then | 364 | if [ ! -d "$ROOTFS" ]; then |
365 | echo "Error: NFS mount point $ROOTFS doesn't exist." | 365 | echo "Error: NFS mount point $ROOTFS doesn't exist." |
366 | cleanup | 366 | cleanup |
367 | return | 367 | return 1 |
368 | fi | 368 | fi |
369 | KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" | 369 | KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
370 | QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" | 370 | QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" |
@@ -408,7 +408,7 @@ if [ "$MACHINE" = "qemumips" -o "$MACHINE" = "qemumipsel" -o "$MACHINE" = "qemum | |||
408 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then | 408 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then |
409 | echo "Error: NFS mount point $ROOTFS doesn't exist" | 409 | echo "Error: NFS mount point $ROOTFS doesn't exist" |
410 | cleanup | 410 | cleanup |
411 | return | 411 | return 1 |
412 | fi | 412 | fi |
413 | KERNCMDLINE="root=/dev/nfs console=ttyS0 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" | 413 | KERNCMDLINE="root=/dev/nfs console=ttyS0 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
414 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS" | 414 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS" |
@@ -429,7 +429,7 @@ if [ "$MACHINE" = "qemuppc" ]; then | |||
429 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then | 429 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then |
430 | echo "Error: NFS mount point $ROOTFS doesn't exist" | 430 | echo "Error: NFS mount point $ROOTFS doesn't exist" |
431 | cleanup | 431 | cleanup |
432 | return | 432 | return 1 |
433 | fi | 433 | fi |
434 | KERNCMDLINE="root=/dev/nfs console=ttyS0 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" | 434 | KERNCMDLINE="root=/dev/nfs console=ttyS0 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
435 | QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS" | 435 | QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS" |
@@ -450,7 +450,7 @@ if [ "$MACHINE" = "qemush4" ]; then | |||
450 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then | 450 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then |
451 | echo "Error: NFS mount point $ROOTFS doesn't exist" | 451 | echo "Error: NFS mount point $ROOTFS doesn't exist" |
452 | cleanup | 452 | cleanup |
453 | return | 453 | return 1 |
454 | fi | 454 | fi |
455 | KERNCMDLINE="root=/dev/nfs console=ttySC1 noiotrap earlyprintk=sh-sci.1 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" | 455 | KERNCMDLINE="root=/dev/nfs console=ttySC1 noiotrap earlyprintk=sh-sci.1 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
456 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS -monitor null -serial vc -serial stdio" | 456 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS -monitor null -serial vc -serial stdio" |
@@ -482,7 +482,7 @@ fi | |||
482 | if [ "x$QEMUOPTIONS" = "x" ]; then | 482 | if [ "x$QEMUOPTIONS" = "x" ]; then |
483 | echo "Error: Unable to support this combination of options" | 483 | echo "Error: Unable to support this combination of options" |
484 | cleanup | 484 | cleanup |
485 | return | 485 | return 1 |
486 | fi | 486 | fi |
487 | 487 | ||
488 | if [ "x$CROSSPATH" = "x" ]; then | 488 | if [ "x$CROSSPATH" = "x" ]; then |
@@ -495,7 +495,7 @@ QEMUBIN=`which $QEMU 2> /dev/null` | |||
495 | if [ ! -x "$QEMUBIN" ]; then | 495 | if [ ! -x "$QEMUBIN" ]; then |
496 | echo "Error: No QEMU binary '$QEMU' could be found." | 496 | echo "Error: No QEMU binary '$QEMU' could be found." |
497 | cleanup | 497 | cleanup |
498 | return | 498 | return 1 |
499 | fi | 499 | fi |
500 | 500 | ||
501 | NEED_GL=`ldd $QEMUBIN/$QEMU 2>&1 | grep libGLU` | 501 | NEED_GL=`ldd $QEMUBIN/$QEMU 2>&1 | grep libGLU` |
@@ -511,7 +511,7 @@ if [ "$NEED_GL" != "" ]; then | |||
511 | echo "You need libGL.so and libGLU.so to exist in your library path to run the QEMU emulator. | 511 | echo "You need libGL.so and libGLU.so to exist in your library path to run the QEMU emulator. |
512 | Ubuntu package names are: libgl1-mesa-dev and libglu1-mesa-dev. | 512 | Ubuntu package names are: libgl1-mesa-dev and libglu1-mesa-dev. |
513 | Fedora package names are: mesa-libGL-devel mesa-libGLU-devel." | 513 | Fedora package names are: mesa-libGL-devel mesa-libGLU-devel." |
514 | exit 1; | 514 | return 1; |
515 | fi | 515 | fi |
516 | fi | 516 | fi |
517 | 517 | ||
@@ -521,7 +521,7 @@ do_quit() { | |||
521 | kill `cat $PIDFILE` | 521 | kill `cat $PIDFILE` |
522 | fi | 522 | fi |
523 | cleanup | 523 | cleanup |
524 | return | 524 | return 1 |
525 | } | 525 | } |
526 | 526 | ||
527 | DISTCCD=`which distccd 2> /dev/null` | 527 | DISTCCD=`which distccd 2> /dev/null` |
@@ -588,9 +588,10 @@ else | |||
588 | echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"' | 588 | echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"' |
589 | LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" | 589 | LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" |
590 | fi | 590 | fi |
591 | 591 | ret=$? | |
592 | |||
593 | 592 | ||
594 | cleanup | 593 | cleanup |
595 | 594 | ||
596 | trap - INT TERM QUIT | 595 | trap - INT TERM QUIT |
596 | |||
597 | return $ret | ||