All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexander Kanavin" <alex.kanavin@gmail.com>
To: Adrian Freihofer <adrian.freihofer@gmail.com>
Cc: OE-core <openembedded-core@lists.openembedded.org>,
	 Adrian Freihofer <adrian.freihofer@siemens.com>
Subject: Re: [OE-core] [PATCH 1/3] meta-skeleton: add a ptest example
Date: Thu, 3 Jun 2021 19:46:05 +0200	[thread overview]
Message-ID: <CANNYZj9HDXbUm=3LJ3tio4JMKQ56vrMGiYVkHBy9hCNOf=a4Lw@mail.gmail.com> (raw)
In-Reply-To: <20210603172149.100248-1-adrian.freihofer@siemens.com>

[-- Attachment #1: Type: text/plain, Size: 3571 bytes --]

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 <adrian.freihofer@gmail.com>
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
> +<?xml version="1.0" encoding="UTF-8"?>
> +<testsuites tests="1" failures="0" disabled="0" errors="0" time="0.010"
> timestamp="2020-09-20T10:44:23" name="AllTests">
> +  <testsuite name="ConfigurationTest" tests="1" failures="0" disabled="0"
> errors="0" time="0.010" timestamp="2020-09-20T10:44:23">
> +    <testcase name="readConfiguration" status="run" result="completed"
> time="0.010" timestamp="2020-09-20T10:44:23" classname="ConfigurationTest"
> />
> +  </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
> @@ -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
>
>
> 
>
>

[-- Attachment #2: Type: text/html, Size: 4743 bytes --]

  parent reply	other threads:[~2021-06-03 17:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-03 17:21 Adrian Freihofer
2021-06-03 17:21 ` [PATCH 2/3] testimage: support additional reports for ptests Adrian Freihofer
2021-06-03 17:43   ` [OE-core] " Alexander Kanavin
2021-06-03 17:21 ` [PATCH 3/3] runtime_test.py: add new testimage ptest test case Adrian Freihofer
2021-06-03 17:46 ` Alexander Kanavin [this message]
2021-06-03 19:53   ` [OE-core] [PATCH 1/3] meta-skeleton: add a ptest example Adrian Freihofer
2021-06-03 20:00     ` Alexander Kanavin
2021-06-05  8:38       ` Adrian Freihofer
2021-06-05 19:47         ` Alexander Kanavin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANNYZj9HDXbUm=3LJ3tio4JMKQ56vrMGiYVkHBy9hCNOf=a4Lw@mail.gmail.com' \
    --to=alex.kanavin@gmail.com \
    --cc=adrian.freihofer@gmail.com \
    --cc=adrian.freihofer@siemens.com \
    --cc=openembedded-core@lists.openembedded.org \
    --subject='Re: [OE-core] [PATCH 1/3] meta-skeleton: add a ptest example' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.