summaryrefslogtreecommitdiff
path: root/images.py
diff options
context:
space:
mode:
Diffstat (limited to 'images.py')
-rwxr-xr-ximages.py50
1 files changed, 50 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:~#"
+