From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ua1-f44.google.com (mail-ua1-f44.google.com [209.85.222.44]) by mx.groups.io with SMTP id smtpd.web11.162.1622742377562353636 for ; Thu, 03 Jun 2021 10:46:17 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NyR9S5We; spf=pass (domain: gmail.com, ip: 209.85.222.44, mailfrom: alex.kanavin@gmail.com) Received: by mail-ua1-f44.google.com with SMTP id d13so3072659uav.5 for ; Thu, 03 Jun 2021 10:46:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TaMmsa1DIEFnL9hrhnLxLBKaJ/hpHe4exNTkICj5bv8=; b=NyR9S5WevKTy3lZqO8IKmhOfNqVbBCmunJUE7krCIxhAvrnOLoqv8mG07sJop8r/BF MKzskFM+J6ifAqw/IzIs99JHE8UuAmHly7/Kn4Z1FjAIoBamNhTlnBCznFE6twJ8fPZX eV4SdpUYQYrwyiBRLrF/c2WTyBqO7dr+BSlQUlF0h8p+hkft6Cv15KfsfAC7tLCdayHV AohKl66VvkYTzfKF+rOg72m9Pw+tI0BWSGc+iyn9ypHOh6ldggOtj6PlXt1Qn3eZqrYj sstTkc1SPXdVjjJfpJhV9o/tiNMEECN7LJe2a3keylT2Vz01n+a1dwwp6kaJHR0YRsrG drbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TaMmsa1DIEFnL9hrhnLxLBKaJ/hpHe4exNTkICj5bv8=; b=LgFgpTKFjnLcvstf+H0TH/x8C1WLiokfKUnmiAXWphl8nlDoVKkgTsqsViGYBgmQlr OS6M6aZCBtmUit/PoMM/2gUqVrotW6PMTWtC9tPvUlQ/KvDxkA+Pm5CMLYyHFmWhdV2I O2ret2q6fUbLHzt2i14HT+LhdUKsend2RMPKF4I5WxNCSQuNPosaqnf7BY2YDZlDa6Ol hweFdRPttkVuuzt5N3Ex9o8zG1ClVPHduKW2mnIIrKSViLokWMCYcE+e0vNOZbZhHajC 5Z8ngccNTOpu40OuKTEoIEEDCuS/64GC5s8fxC1zDxI3xYe2dEBfkkGu+bjO/DrW0bRg RZFw== X-Gm-Message-State: AOAM532w/k2LJSA74BpfRpfz0z0pAj81U5puMyAuihSWz7AwLYFKTmIL pDrop9FYDozV2NvaM3kv8HTClhJ+h4SoDEIopBQ= X-Google-Smtp-Source: ABdhPJymG9idPTgUfFAoXR/4ZiNOD20YMBLMKPUZ/Pnx6zVdrFI9cC4O89fQMiNwE4LOWOptUV1bkJRtGipn5EraSPs= X-Received: by 2002:a1f:b217:: with SMTP id b23mr616313vkf.16.1622742376649; Thu, 03 Jun 2021 10:46:16 -0700 (PDT) MIME-Version: 1.0 References: <20210603172149.100248-1-adrian.freihofer@siemens.com> In-Reply-To: <20210603172149.100248-1-adrian.freihofer@siemens.com> From: "Alexander Kanavin" Date: Thu, 3 Jun 2021 19:46:05 +0200 Message-ID: Subject: Re: [OE-core] [PATCH 1/3] meta-skeleton: add a ptest example To: Adrian Freihofer Cc: OE-core , Adrian Freihofer Content-Type: multipart/alternative; boundary="000000000000ec168a05c3e02669" --000000000000ec168a05c3e02669 Content-Type: text/plain; charset="UTF-8" Rather than construct an artificial example, is there an actual existing ptest in oe-core that can be extended to do this junit xml stuff? Alex On Thu, 3 Jun 2021 at 19:22, Adrian Freihofer wrote: > --- > .../ptest-example/files/run-ptest | 26 +++++++++++++++++++ > .../ptest-example/ptest-example_0.1.bb | 16 ++++++++++++ > 2 files changed, 42 insertions(+) > create mode 100644 > meta-skeleton/recipes-skeleton/ptest-example/files/run-ptest > create mode 100644 meta-skeleton/recipes-skeleton/ptest-example/ > ptest-example_0.1.bb > > diff --git a/meta-skeleton/recipes-skeleton/ptest-example/files/run-ptest > b/meta-skeleton/recipes-skeleton/ptest-example/files/run-ptest > new file mode 100644 > index 0000000000..7c80306475 > --- /dev/null > +++ b/meta-skeleton/recipes-skeleton/ptest-example/files/run-ptest > @@ -0,0 +1,26 @@ > +#!/bin/sh > + > +# The result should be PASS, FAIL, or SKIP, and the testname can be any > identifying string. > +# The ptest-runner does not evaluate stdout or stderr. The output format > is a recommended convention. > +# A real ptest would call the unit-test executable instead of echo. > +echo "PASS: dummy test passing always" > + > +# Optional a ptest might provide a JUnit like XML report. Reports are > collected by the ptest imagetest if > +# the TESTIMAGE_PTEST_REPORT_DIR variable is configured for the tested > image. > +# Example to fetch a xml report to > ${TEST_LOG_DIR}/reports-xml/ptest-example.xml: > +# TESTIMAGE_PTEST_REPORT_DIR ?= "/tmp/ptest-xml/*.xml:reports-xml" > +# The following shell heredoc is as a placeholder e.g. for something more > useful such as > +# my-gtest --gtest_output="xml:/tmp/ptest-xml/" > +mkdir -p /tmp/ptest-xml > +cat << xxxEOFxxx > /tmp/ptest-xml/ptest-example.xml > + > + timestamp="2020-09-20T10:44:23" name="AllTests"> > + errors="0" time="0.010" timestamp="2020-09-20T10:44:23"> > + time="0.010" timestamp="2020-09-20T10:44:23" classname="ConfigurationTest" > /> > + > + > +xxxEOFxxx > + > +# The ptest-runner evaluates the exit value of a test case: 0 means pass, > 1 means fail. > +# This minimal example passes always. > +exit 0 > diff --git a/meta-skeleton/recipes-skeleton/ptest-example/ > ptest-example_0.1.bb b/meta-skeleton/recipes-skeleton/ptest-example/ > ptest-example_0.1.bb > new file mode 100644 > index 0000000000..02bc9bcfa2 > --- /dev/null > +++ b/meta-skeleton/recipes-skeleton/ptest-example/ptest-example_0.1.bb > @@ -0,0 +1,16 @@ > +SUMMARY = "A very basic ptest enabled recipe" > +DESCRIPTION = "This recipe provides a minimalistic ptest package" > +SECTION = "examples" > +LICENSE = "MIT" > +LIC_FILES_CHKSUM = > "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" > + > +# A recipe is "ptest-enabled" if it inherits the ptest class > +inherit ptest > + > +# Usually a ptest contains at least two items: the actual test, > +# and a shell script (run-ptest) that starts the test. > +# For this minimized example there is just the script. > +SRC_URI = "file://run-ptest" > + > +# This minimalistic example provides nothing more than a ptest package. > +ALLOW_EMPTY_${PN} = "1" > -- > 2.31.1 > > > > > --000000000000ec168a05c3e02669 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Rather than construct an artificial example, is there= an actual existing ptest in oe-core that can be extended to do this junit = xml stuff?

Alex

On Thu, 3 Jun 2021 at 19:= 22, Adrian Freihofer <adri= an.freihofer@gmail.com> wrote:
---
=C2=A0.../ptest-example/files/run-ptest=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0| 26 +++++++++++++++++++
=C2=A0.../ptest-example/ptest-example_0.1.bb=C2=A0 =C2=A0 =C2=A0 =C2= = =A0 | 16 ++++++++++++
=C2=A02 files changed, 42 insertions(+)
=C2=A0create mode 100644 meta-skeleton/recipes-skeleton/ptest-example/file= s/run-ptest
=C2=A0create mode 100644 meta-skeleton/recipes-skeleton/ptest-example/pt= est-example_0.1.bb

diff --git a/meta-skeleton/recipes-skeleton/ptest-example/files/run-ptest = b/meta-skeleton/recipes-skeleton/ptest-example/files/run-ptest
new file mode 100644
index 0000000000..7c80306475
--- /dev/null
+++ b/meta-skeleton/recipes-skeleton/ptest-example/files/run-ptest
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# The result should be PASS, FAIL, or SKIP, and the testname can be any i= dentifying string.
+# The ptest-runner does not evaluate stdout or stderr. The output format = is a recommended convention.
+# A real ptest would call the unit-test executable instead of echo.
+echo "PASS:=C2=A0 dummy test passing always"
+
+# Optional a ptest might provide a JUnit like XML report. Reports are col= lected by the ptest imagetest if
+# the TESTIMAGE_PTEST_REPORT_DIR variable is configured for the tested im= age.
+# Example to fetch a xml report to ${TEST_LOG_DIR}/reports-xml/ptest-exam= ple.xml:
+#=C2=A0 =C2=A0TESTIMAGE_PTEST_REPORT_DIR ?=3D "/tmp/ptest-xml/*.xml:= reports-xml"
+# The following shell heredoc is as a placeholder e.g. for something more= useful such as
+# my-gtest --gtest_output=3D"xml:/tmp/ptest-xml/"
+mkdir -p /tmp/ptest-xml
+cat << xxxEOFxxx > /tmp/ptest-xml/ptest-example.xml
+<?xml version=3D"1.0" encoding=3D"UTF-8"?>
+<testsuites tests=3D"1" failures=3D"0" disabled=3D= "0" errors=3D"0" time=3D"0.010" timestamp=3D&= quot;2020-09-20T10:44:23" name=3D"AllTests">
+=C2=A0 <testsuite name=3D"ConfigurationTest" tests=3D"1= " failures=3D"0" disabled=3D"0" errors=3D"0&q= uot; time=3D"0.010" timestamp=3D"2020-09-20T10:44:23"&g= t;
+=C2=A0 =C2=A0 <testcase name=3D"readConfiguration" status=3D= "run" result=3D"completed" time=3D"0.010" tim= estamp=3D"2020-09-20T10:44:23" classname=3D"ConfigurationTes= t" />
+=C2=A0 </testsuite>
+</testsuites>
+xxxEOFxxx
+
+# The ptest-runner evaluates the exit value of a test case: 0 means pass,= 1 means fail.
+# This minimal example passes always.
+exit 0
diff --git a/meta-skeleton/recipes-skeleton/ptest-example/ptest-example_= 0.1.bb b/meta-skeleton/recipes-skeleton/ptest-example/ptest-example_0= .1.bb
new file mode 100644
index 0000000000..02bc9bcfa2
--- /dev/null
+++ b/meta-skeleton/recipes-skeleton/ptest-example/ptest-example_0.1.bb<= /a>
@@ -0,0 +1,16 @@
+SUMMARY =3D "A very basic ptest enabled recipe"
+DESCRIPTION =3D "This recipe provides a minimalistic ptest package&q= uot;
+SECTION =3D "examples"
+LICENSE =3D "MIT"
+LIC_FILES_CHKSUM =3D "file://${COREBASE}/meta/COPYING.MIT;md5=3D3da9= cfbcb788c80a0384361b4de20420"
+
+# A recipe is "ptest-enabled" if it inherits the ptest class +inherit ptest
+
+# Usually a ptest contains at least two items: the actual test,
+# and a shell script (run-ptest) that starts the test.
+# For this minimized example there is just the script.
+SRC_URI =3D "file://run-ptest"
+
+# This minimalistic example provides nothing more than a ptest package. +ALLOW_EMPTY_${PN} =3D "1"
--
2.31.1




--000000000000ec168a05c3e02669--