summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-ximages.py50
-rwxr-xr-xqemu-boot-test29
2 files changed, 79 insertions, 0 deletions
diff --git a/images.py b/images.py
new file mode 100755
index 0000000..1bd09c5
--- /dev/null
+++ b/images.py
@@ -0,0 +1,50 @@
+#!/usr/bin/python
+
+import os
+import pexpect
+import sys
+
+class QemuTest(object):
+ bootcmd = None
+ shellprompt = None
+
+ @classmethod
+ def boot(self):
+ print "QEMU command: %s" % self.bootcmd
+ self.proc = pexpect.spawn(self.bootcmd, timeout=600, logfile=sys.stdout)
+ id = self.proc.expect([self.shellprompt, pexpect.TIMEOUT])
+ if id == 0:
+ return
+ if id == 1:
+ self.proc.terminate(force=True)
+ raise RuntimeError, "QEMU boot took longer than 10 min, something went wrong"
+
+ @classmethod
+ def shutdown(self):
+ self.proc.sendline("reboot")
+ self.proc.expect([pexpect.EOF, pexpect.TIMEOUT])
+ if id == 0:
+ return
+ if id == 1:
+ self.proc.terminate(force=True)
+ raise RuntimeError, "ERROR: QEMU boot took longer than 10 min to shut down"
+
+class LinaroImage(QemuTest):
+ qemupath = "/var/lib/jenkins/jobs/qemu-build/workspace/arm-softmmu/qemu-system-arm"
+ testimage = "/linaro/ci/qemu/linaro-20101215/qemu.img"
+ bootcmd = ("%s -M beagle -m 256 -sd %s -clock unix -nographic "
+ "-no-reboot" % (qemupath, testimage))
+ shellprompt = "root@localhost:~#"
+
+class DebianVersatile(QemuTest):
+ #This image was obtained from: http://people.debian.org/~aurel32/qemu/arm/
+ qemupath = "/var/lib/jenkins/jobs/qemu-build/workspace/arm-softmmu/qemu-system-arm"
+ basepath = "/linaro/ci/qemu/debian-versatile"
+ kernel = os.path.join(basepath, "vmlinuz-2.6.26-2-versatile")
+ initrd = os.path.join(basepath, "initrd.img-2.6.26-2-versatile")
+ rootfs = os.path.join(basepath, "debian_lenny_arm_small.qcow2")
+ bootcmd = ("%s -M versatilepb -kernel %s -initrd %s -hda %s -append "
+ "'root=/dev/sda1 console=ttyAMA0' -nographic -no-reboot" % (
+ qemupath, kernel, initrd, rootfs))
+ shellprompt = "debian-arm:~#"
+
diff --git a/qemu-boot-test b/qemu-boot-test
new file mode 100755
index 0000000..e6187b5
--- /dev/null
+++ b/qemu-boot-test
@@ -0,0 +1,29 @@
+#!/usr/bin/python
+
+import images
+import sys
+
+if len(sys.argv) != 2:
+ print "Usage: qemu-boot-test <image type>"
+ print "Currently supported image types are:"
+ print "\tLinaroImage"
+ print "\tDebianVersatile"
+ sys.exit(1)
+
+test_image = sys.argv[1]
+qemu_test = getattr(images, test_image)
+try:
+ print "Testing: %s" % test_image
+ print "Booting image"
+ qemu_test.boot()
+ print "Shutting down image"
+ qemu_test.shutdown()
+ print '-'*70
+ print 'PASS: %s' % test_image
+ print '-'*70
+except:
+ print "Error: %s" % sys.exc_info()[1]
+ print '-'*70
+ print 'FAIL: %s' % test_image
+ print '-'*70
+ sys.exit(-1)