All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] meta-skeleton: add a ptest example
@ 2021-06-03 17:21 Adrian Freihofer
  2021-06-03 17:21 ` [PATCH 2/3] testimage: support additional reports for ptests Adrian Freihofer
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Adrian Freihofer @ 2021-06-03 17:21 UTC (permalink / raw)
  To: openembedded-core; +Cc: Adrian Freihofer

---
 .../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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-06-05 19:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 17:21 [PATCH 1/3] meta-skeleton: add a ptest example 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 ` [OE-core] [PATCH 1/3] meta-skeleton: add a ptest example Alexander Kanavin
2021-06-03 19:53   ` Adrian Freihofer
2021-06-03 20:00     ` Alexander Kanavin
2021-06-05  8:38       ` Adrian Freihofer
2021-06-05 19:47         ` Alexander Kanavin

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.