From 6e63a66e306979e13f08fdb08351d87c038682c9 Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei.gherzan@huawei.com>
Date: Wed, 7 Sep 2022 10:59:12 +0200
Subject: [PATCH] podman: Add ptest support for system tests

The recipe was proposed for meta-virtualization kirkstone[1] but it
might not be deemed resonable[2] for a stable branch.

[1] https://lists.yoctoproject.org/g/meta-virtualization/message/7598
[2] https://lists.yoctoproject.org/g/meta-virtualization/message/7603

Fixes: https://gitlab.eclipse.org/eclipse/oniro-core/oniro/-/issues/21

Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
---
 .../podman/podman/run-ptest                   | 13 ++++++++
 .../podman/podman_git.bbappend                | 33 +++++++++++++++++++
 2 files changed, 46 insertions(+)
 create mode 100644 meta-oniro-staging/recipes-containers/podman/podman/run-ptest
 create mode 100644 meta-oniro-staging/recipes-containers/podman/podman_git.bbappend

diff --git a/meta-oniro-staging/recipes-containers/podman/podman/run-ptest b/meta-oniro-staging/recipes-containers/podman/podman/run-ptest
new file mode 100644
index 00000000..108ff451
--- /dev/null
+++ b/meta-oniro-staging/recipes-containers/podman/podman/run-ptest
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# SPDX-FileCopyrightText: Huawei Inc.
+#
+# SPDX-License-Identifier: MIT
+
+#
+# Podman system tests
+#
+
+# The system tests don't need any go related variables. Dummy-define them to
+# avoid useless warnings/errors.
+GOOS=undefined GO=true BUILDTAGS= make localsystem
diff --git a/meta-oniro-staging/recipes-containers/podman/podman_git.bbappend b/meta-oniro-staging/recipes-containers/podman/podman_git.bbappend
new file mode 100644
index 00000000..9646b9fa
--- /dev/null
+++ b/meta-oniro-staging/recipes-containers/podman/podman_git.bbappend
@@ -0,0 +1,33 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+#
+# SPDX-License-Identifier: MIT
+
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+SRC_URI += "file://run-ptest"
+
+inherit ptest
+
+do_install_ptest () {
+	cp ${S}/src/import/Makefile ${D}${PTEST_PATH}
+	install -d ${D}${PTEST_PATH}/test
+	cp -r ${S}/src/import/test/system ${D}${PTEST_PATH}/test
+
+	# Some compatibility links for the Makefile assumptions.
+	install -d ${D}${PTEST_PATH}/bin
+	ln -s ${bindir}/podman ${D}${PTEST_PATH}/bin/podman
+	ln -s ${bindir}/podman-remote ${D}${PTEST_PATH}/bin/podman-remote
+}
+
+RDEPENDS:${PN}-ptest += " \
+	bash \
+	bats \
+	buildah \
+	catatonit \
+	coreutils \
+	file \
+	gnupg \
+	jq \
+	make \
+	tar \
+"
-- 
GitLab