[elbe-devel] [RFC PATCH 3/3] examples minimal-grub-buster: Add an example of check-img

Olivier Dion dion at linutronix.de
Mon May 18 03:35:34 CEST 2020


This example shows how to use <check-img>.

Since the image generated in <target> was named 'sda.img', we're
expecting to find a 'sda.img.tar.gz' in the final build.  Thus, we
will test for the image 'sda.img.tar.gz'.

Let's use the i386 QEMU system interpreter, since this is the
buildtype of the project and let's avoid any graphic.  This option
implies '-serial stdio'.  If '-nographic' was not present, we would
need to pass '-serial stdio', otherwise the serial communication will
fail.

The serial communication shown here is probably what most of the time
we want to do.  i.e., login with root and shutdown the machine.
Optionnaly, doing some sanity check, e.g. here we're doing an ls on /.

Signed-off-by: Olivier Dion <dion at linutronix.de>
---
 examples/x86_32-pc-hdimg-minimal-grub-buster.xml | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/examples/x86_32-pc-hdimg-minimal-grub-buster.xml b/examples/x86_32-pc-hdimg-minimal-grub-buster.xml
index 8f69b2dc..93ebed08 100644
--- a/examples/x86_32-pc-hdimg-minimal-grub-buster.xml
+++ b/examples/x86_32-pc-hdimg-minimal-grub-buster.xml
@@ -11,6 +11,22 @@
 		</mirror>
 		<suite>buster</suite>
 	</project>
+	<check-img>
+	  <name>sda.img.tar.gz</name>
+	  <interpreter-name>qemu-system-i386</interpreter-name>
+	  <interpreter-opts>-m 1024 -nographic -machine pc -enable-kvm -drive format=raw,file=$ELBE_IMG</interpreter-opts>
+	  <serial>
+	    <expect>i386-buster login:</expect>
+	    <sendline>root</sendline>
+	    <expect>Password:</expect>
+	    <sendline>foo</sendline>
+	    <expect>root at i386-buster:~#</expect>
+	    <sendline>ls /</sendline>
+	    <expect>root at i386-buster:~#</expect>
+	    <sendline>shutdown -h now</sendline>
+	    <EOF/>
+	  </serial>
+	</check-img>
 	<target>
 		<hostname>i386-buster</hostname>
 		<domain>elbe-rfs.org</domain>
-- 
2.26.2




More information about the elbe-devel mailing list