[elbe-devel] [PATCH 1/6] Add XML schema definition for Junit test suites/cases.

Torben Hohn torben.hohn at linutronix.de
Wed Aug 7 10:56:26 CEST 2019


On Thu, Jul 18, 2019 at 02:02:41PM +0200, dion at linutronix.de wrote:
> From: Olivier Dion <dion at linutronix.de>
> 
> It's now possible to execute test suites and generate a compatible
> JUnit XML file for a project.
> 
> * <test-suites>

lets call this <unit-tests>, and lets hardcode the filename to elbe-junit.xml
this reduces confusion with <test-suite> and also reduces potential
confusion when the xml file needs to be picked up by jenkins or whatever
drives the test later on.

i am not sure, if we want to allow more than one test suite per elbe
project. 

it might make sense to merge the unit test results of several
elbe builds in the master test...

what do you think ?


> 
>   The <test-suites> node is an _unique_ children to the <target> node
>   and accepts an unbounded sequence of <test-suite> nodes.
> 
>   It has a mandatory attribute 'dst' which is the name of the file,
>   relative to the project build directory, where to write the result
>   of the test suites.
> 
> * <test-suite>
> 
>   The <test-suite> nodes are children to the <test-suites> node.  They
>   accept an unbounded sequence of nodes of _type_ <test-case>.
> 
>   PITFALL!  <test-suites> _with_ an 's' _is_ under <target> and
>   <test-suite> _without_ an 's' _are_ under <test-suites>.
> 
>   Is has a mandatory attribute 'name' which is an human readable
>   identifier for the suite.
> 
> * <test-case>
> 
>   The <test-case> nodes are children of a <test-suite> node.  They
>   _are not identified_ by the <test-case> tag.  This is because
>   <test-case> is actually a group type and thus the actual tag has to
>   be within the group's choices.
> 
>   As for now, only the <file-exists> node is a valid choice.
> 
> ** <file-exists>
> 
>    The <file-exists> node is a choice of the <test-case> group.  It
>    verifies that a file exists in the target filesystem.
> 
> * Example
> 
>   My project's XML file:
>   --------------------------------------------------------------------
>   ...
>   <target>
>     ...
>     <project-finetuning>
>       <test-suites dst="junit.xml">
> 
>         <test-suite name="Suite A">
> 	  <file-exists>/etc/fstab></file-exists>
> 	  <file-exists>/bin/clang</file-exists>
> 	</test-suite>
> 
> 	<test-suite name="Suite B">
> 	  <file-exists>/home/notroot</file-exists>
> 	</test-suite>
> 
>       </test-suites>
>     </project-finetuning>
>     ...
>   </target>
>   ...
>   --------------------------------------------------------------------
> 
> Signed-off-by: Olivier Dion <dion at linutronix.de>
> ---
>  schema/dbsfed.xsd | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 54 insertions(+)
> 
> diff --git a/schema/dbsfed.xsd b/schema/dbsfed.xsd
> index fbed8e98..a46ccc5e 100644
> --- a/schema/dbsfed.xsd
> +++ b/schema/dbsfed.xsd
> @@ -1940,6 +1940,13 @@
>            </documentation>
>          </annotation>
>        </element>
> +      <element name="test-suites" type="rfs:test-suites" minOccurs="0" maxOccurs="1">
> +        <annotation>
> +          <documentation>
> +	    Allows to generate test suites for the project.
> +          </documentation>
> +        </annotation>
> +      </element>
>      </choice>
>    </group>
>  
> @@ -2431,4 +2438,51 @@
>      </simpleContent>
>    </complexType>
>  
> +  <complexType name="test-suites">
> +    <annotation>
> +      <documentation>
> +	Sequence of test suites.  The require attribute 'dst' is the
> +	name of the file where the Junit XML file will be dump
> +	relative to the project directory.
> +      </documentation>
> +    </annotation>
> +    <sequence>
> +      <element name="test-suite" type="rfs:test-suite" minOccurs="0" maxOccurs="unbounded">
> +      </element>
> +    </sequence>
> +    <attribute name="dst" type="string" use="required" />
> +  </complexType>
> +
> +  <complexType name="test-suite">
> +    <annotation>
> +      <documentation>
> +	A test suite is a sequence of test cases.  The required
> +	attribute name is the an human readable identifier for the
> +	test suite.
> +      </documentation>
> +    </annotation>
> +    <sequence>
> +      <group ref="rfs:test-case" minOccurs="0" maxOccurs="unbounded" >
> +      </group>
> +    </sequence>
> +    <attribute name="name" type="string" use="required" />
> +  </complexType>
> +
> +  <group name="test-case">
> +    <annotation>
> +      <documentation>
> +	A test-case is a choice of a test to make on the target fs.
> +      </documentation>
> +    </annotation>
> +    <choice>
> +      <element name="file-exists" type="rfs:string" minOccurs="0">
> +	<annotation>
> +          <documentation>
> +	    Verify that a file exists.
> +          </documentation>
> +        </annotation>
> +      </element>
> +    </choice>
> +  </group>
> +
>  </schema>
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner



More information about the elbe-devel mailing list