[elbe-devel] [RFC PATCH 1/3] schema dbsfed: Add schema definitions for check-img

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


The <check-img> tag can be set at the top of the XML, alongs with
<project> and <target>.

It allows to validate an image by emulating it in QEMU and
communicating with a serial line.

The <name> node must be provided.  It specifies which image to test.
This can be a raw image or a .tgz image.

The <interpreter-name> node must be provided.  It is the name of the QEMU
executable for interpreting the image.

The <interpreter-opts> node must be provided.  It is the options
passed to the interpreter.  You can safely assume that the image that
you want to emulated is in the path contained in the environment
variable ELBE_IMG.  Word expansion is done only on options passed to
the interpreter.

The <serial> node is optional.  It describes a sequence of
interactions between the host and the guest using a serial line.  It
is composed of a sequence of <serial-action> group nodes.  Possible
values are <expect>, <sendline> and <EOF>.

The <expect> node describes a regular expression that the host is
expected to receive from the guest on the serial line.

The <sendline> node is used to send a string terminated by a
newline ('\r\n') from the host to the guest.

The <EOF> node is used to tell the host to expect the connection from
the guest to end.

Signed-off-by: Olivier Dion <dion at linutronix.de>
---
 schema/dbsfed.xsd | 101 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 101 insertions(+)

diff --git a/schema/dbsfed.xsd b/schema/dbsfed.xsd
index 86ddcacb..28b6066c 100644
--- a/schema/dbsfed.xsd
+++ b/schema/dbsfed.xsd
@@ -41,6 +41,14 @@
           </documentation>
         </annotation>
       </element>
+      <element name="check-img" type="rfs:check-img" minOccurs="0">
+        <annotation>
+          <documentation>
+            Check an image by emulating it and communicating with it
+            through a serial connection.
+          </documentation>
+        </annotation>
+      </element>
       <element name="target" type="rfs:target" minOccurs="0">
         <annotation>
           <documentation>
@@ -497,6 +505,99 @@
     <attribute ref="xml:base"/>
   </complexType>
 
+  <complexType name="check-img">
+    <annotation>
+      <documentation>
+        Describes an image to validate with an emulator by
+        communicating via a serial line.
+      </documentation>
+    </annotation>
+    <all>
+      <element name="name" type="rfs:string" minOccurs="1" maxOccurs="1">
+        <annotation>
+          <documentation>
+            Name of the image in the final build to emulate.  Image
+            that were .tgz are also accepted.
+          </documentation>
+        </annotation>
+      </element>
+      <element name="interpreter-name" type="rfs:string" minOccurs="1" maxOccurs="1">
+        <annotation>
+          <documentation>
+            Name of the interpreter to use for the emulation.  e.g.,
+            qemu-system-x86_64 or qemu-system-ppc.
+          </documentation>
+        </annotation>
+      </element>
+      <element name="interpreter-opts" type="rfs:string" minOccurs="1" maxOccurs="1">
+        <annotation>
+          <documentation>
+            Options to pass to the interpreter. e.g., -enable-kvm or
+            -drive format=raw,file=$ELBE_IMG or -hda $ELBE_IMG
+
+            Word expansion is done before passing it to the
+            interpreter.  You can safely assume that the environment
+            variable ELBE_IMG contains the path to the image that you
+            want to emulated.
+          </documentation>
+        </annotation>
+      </element>
+      <element name="serial" type="rfs:serial" minOccurs="0" maxOccurs="1">
+        <annotation>
+          <documentation>
+            Serial communication to do with the interpreter.  This
+            implies '-serial stdio' for QEMU' interpreters.
+          </documentation>
+        </annotation>
+      </element>
+    </all>
+  </complexType>
+
+  <complexType name="serial">
+    <annotation>
+      <documentation>
+        Describes a communication to do over a serial line.  The
+        communication is done sequentially as it.
+      </documentation>
+    </annotation>
+    <sequence>
+      <group ref="rfs:serial-action" minOccurs="0" maxOccurs="unbounded" />
+    </sequence>
+  </complexType>
+
+  <group name="serial-action">
+    <annotation>
+      <documentation>
+        Definition of possible action on serial communication.
+      </documentation>
+    </annotation>
+    <choice>
+        <element name="expect" type="rfs:string" minOccurs="0" maxOccurs="unbounded">
+        <annotation>
+          <documentation>
+            A regular expression to expect to receive on the line.
+          </documentation>
+        </annotation>
+      </element>
+      <element name="sendline" type="rfs:string" minOccurs="0" maxOccurs="unbounded">
+        <annotation>
+          <documentation>
+            Send a string terminated with a newline character on the
+            line.
+          </documentation>
+        </annotation>
+      </element>
+      <element name="EOF" type="rfs:string" minOccurs="0" maxOccurs="1">
+        <annotation>
+          <documentation>
+            Expect the connecion to be closed.  This should only be
+            the last item in the sequence.
+          </documentation>
+        </annotation>
+      </element>
+    </choice>
+  </group>
+
   <simpleType name="suite-initvm">
     <restriction base="string">
       <enumeration value="bullseye" />
-- 
2.26.2




More information about the elbe-devel mailing list