[PATCH 3/3] yq: add ptest support


Yu, Mingli
 

From: Mingli Yu <mingli.yu@...>

# ./run-ptest
PASS: acceptance.sh
PASS: bad_args.sh
PASS: basic.sh
PASS: bump-version.sh
PASS: check.sh
PASS: completion.sh
PASS: copy-docs.sh
PASS: coverage.sh
PASS: devtools.sh
PASS: empty.sh
PASS: extract-checksum.sh
PASS: format.sh
PASS: front-matter.sh
PASS: generate-man-page-md.sh
PASS: generate-man-page.sh
PASS: header-processing-off.sh
PASS: inputs-format.sh
PASS: install-man-page.sh
PASS: leading-seperator.sh
PASS: load-file.sh
PASS: output-format.sh
PASS: pipe.sh
PASS: pretty-print.sh
PASS: release-deb.sh
PASS: secure.sh
PASS: setup.sh
PASS: split-printer.sh
PASS: test-docker.sh
PASS: test.sh
PASS: xcompile.sh

Signed-off-by: Mingli Yu <mingli.yu@...>
---
recipes-devtools/yq/files/run-ptest | 10 ++++++++++
recipes-devtools/yq/yq_git.bb | 14 +++++++++++++-
2 files changed, 23 insertions(+), 1 deletion(-)
create mode 100755 recipes-devtools/yq/files/run-ptest

diff --git a/recipes-devtools/yq/files/run-ptest b/recipes-devtools/yq/files/run-ptest
new file mode 100755
index 00000000..3a6876b3
--- /dev/null
+++ b/recipes-devtools/yq/files/run-ptest
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+cd tests
+for i in `ls *.sh`; do
+ if [ ./$i ] ; then
+ echo "PASS: $i"
+ else
+ echo "FAIL: $i"
+ fi
+done
diff --git a/recipes-devtools/yq/yq_git.bb b/recipes-devtools/yq/yq_git.bb
index 867bfccf..755a6982 100644
--- a/recipes-devtools/yq/yq_git.bb
+++ b/recipes-devtools/yq/yq_git.bb
@@ -42,12 +42,13 @@ SRC_URI = "git://${GO_IMPORT};name=yq;branch=master;protocol=https \
git://github.com/golang/net;name=net;destsuffix=build/vendor/src/golang.org/x/net;branch=master;protocol=https \
git://github.com/golang/text;name=text;destsuffix=build/vendor/src/golang.org/x/text;branch=master;protocol=https \
git://github.com/pkg/diff;name=diff;destsuffix=build/vendor/src/github.com/pkg/diff;branch=main;protocol=https \
+ file://run-ptest \
"

PV = "4.30.8+git${SRCREV_yq}"
GO_IMPORT = "github.com/mikefarah/yq"

-inherit go
+inherit go ptest

do_compile:prepend() {
# arrange for some of the golang built ins to be found
@@ -69,4 +70,15 @@ do_install:append() {
rm -rf ${D}/${libdir}/go/src/${GO_IMPORT}/acceptance_tests
}

+do_install_ptest() {
+ install -d ${D}${PTEST_PATH}/tests
+ cp -r ${S}/src/github.com/mikefarah/yq/scripts/* ${D}${PTEST_PATH}/tests
+ cp -r ${S}/src/github.com/mikefarah/yq/acceptance_tests/* ${D}${PTEST_PATH}/tests
+ cp -r ${S}/src/github.com/mikefarah/yq/examples ${D}${PTEST_PATH}/tests
+}
+
+RDEPENDS:${PN}-ptest += " \
+ bash \
+"
+
BBCLASSEXTEND = "native"
--
2.25.1