diff mbox series

[yocto-autobuilder-helper] patchtest: add selftest runner

Message ID 20231114160646.20143-1-tgamblin@baylibre.com
State New
Headers show
Series [yocto-autobuilder-helper] patchtest: add selftest runner | expand

Commit Message

Trevor Gamblin Nov. 14, 2023, 4:06 p.m. UTC
Add a runner that installs the patchtest dependencies in a Python venv
and then starts patchtest's selftests.

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
---
 config.json                    |  7 +++++++
 scripts/run-patchtest-selftest | 18 ++++++++++++++++++
 2 files changed, 25 insertions(+)
 create mode 100755 scripts/run-patchtest-selftest
diff mbox series

Patch

diff --git a/config.json b/config.json
index 0c581d1..e049a95 100644
--- a/config.json
+++ b/config.json
@@ -1676,6 +1676,13 @@ 
                 "BBTARGETS" : "core-image-patchtest"
             }
         },
+	"patchtest-selftest" : {
+	    "NEEDREPOS" : ["poky"],
+	    "EXTRACMDS" : ["${SCRIPTSDIR}/run-patchtest-selftest ${HELPERBUILDDIR}/.."],
+	    "ADDLAYER" : [
+	        "${BUILDDIR}/../meta-selftest"
+	    ]
+	},
         "toaster" : {
             "EXTRACMDS" : ["${SCRIPTSDIR}/run-toaster-tests ${HELPERBUILDDIR} ${HELPERBUILDDIR}/.."]
         }
diff --git a/scripts/run-patchtest-selftest b/scripts/run-patchtest-selftest
new file mode 100755
index 0000000..58edb0e
--- /dev/null
+++ b/scripts/run-patchtest-selftest
@@ -0,0 +1,18 @@ 
+#!/bin/bash
+#
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Called with $1 as the path to poky
+
+set -e
+set -u
+set -o pipefail
+set -x
+
+pokydir=$(realpath "$1")
+
+python3 -m venv venv --without-pip --system-site-packages
+source venv/bin/activate
+python3 -m pip install -r $pokydir/meta/lib/patchtest/requirements.txt
+
+$pokydir/meta/lib/patchtest/selftest/selftest