From: Pratik Farkase <pratik.farkase@est.tech>
To: openembedded-core@lists.openembedded.org
Cc: pratik.farkase@ericsson.com, Pratik Farkase <pratik.farkase@est.tech>
Subject: [OE-core][PATCH v5] go: add ptest support
Date: Tue, 14 Apr 2026 00:29:43 +0200 [thread overview]
Message-ID: <20260413222943.26238-1-pratik.farkase@est.tech> (raw)
In-Reply-To: <20260305110200.17834-1-pratik.farkase@est.tech>
Add ptest infrastructure to test the Go standard library.
- Run 'go test -short std' via run-ptest script
- Install source tree and pkg/include headers
- Create VERSION file for architecture detection
- Exclude multi-arch binary testdata to avoid QA errors
Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
---
Changes in v5:
- Add QB_MEM:virtclass-mcextend-go = "-m 4096" in core-image-ptest.bb
- Add PTEST_RUNNER_TIMEOUT:virtclass-mcextend-go = "4800" for ~66min runtime
- Run full test suite (go list std) with skip list for problematic
packages in run-ptest
Changes in v4:
- Run only 17 curated packages that work within 1GB RAM constraint
- Test runtime reduced to ~6-7 minutes
Changes in v3:
- Move go from PTESTS_FAST to PTESTS_SLOW (~45min runtime)
inside ptest-packagelists.inc
Changes in v2:
- Exclude .elf* files to fix QA arch errors on all architectures
- Exclude *-x86-64* files to fix additional arch-specific test binaries
- Tested on x86-64, x86, aarch64, and arm builds
---
.../distro/include/ptest-packagelists.inc | 1 +
meta/recipes-core/images/core-image-ptest.bb | 5 +++
meta/recipes-devtools/go/go-1.26.0.inc | 1 +
meta/recipes-devtools/go/go/run-ptest | 32 +++++++++++++++++++
meta/recipes-devtools/go/go_1.26.0.bb | 27 +++++++++++++++-
5 files changed, 65 insertions(+), 1 deletion(-)
create mode 100755 meta/recipes-devtools/go/go/run-ptest
diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 1bb7458fc9..c7f79e96b5 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -118,6 +118,7 @@ PTESTS_SLOW = "\
gettext \
glib-2.0 \
gnutls \
+ go \
gstreamer1.0 \
less \
libevent \
diff --git a/meta/recipes-core/images/core-image-ptest.bb b/meta/recipes-core/images/core-image-ptest.bb
index c08561296f..166b4ded63 100644
--- a/meta/recipes-core/images/core-image-ptest.bb
+++ b/meta/recipes-core/images/core-image-ptest.bb
@@ -10,6 +10,7 @@ HOMEPAGE = "https://www.yoctoproject.org/"
PTESTS = "${PTESTS_SLOW} ${PTESTS_FAST}"
PTEST_RUNNER_TIMEOUT:virtclass-mcextend-python3-cffi = "600"
+PTEST_RUNNER_TIMEOUT:virtclass-mcextend-go = "4800"
IMAGE_INSTALL:append = " ${MCNAME}-ptest openssh"
@@ -32,6 +33,9 @@ IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-tar = "1524288"
# python3-numpy-ptest requires a lot of extra space
IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-python3-numpy = "3048576"
+# golang go-ptest requires extra space
+IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-go = "1524288"
+
# ptests need more memory than standard to avoid the OOM killer
QB_MEM = "-m 1024"
QB_MEM:virtclass-mcextend-lttng-tools = "-m 4096"
@@ -39,6 +43,7 @@ QB_MEM:virtclass-mcextend-python3 = "-m 2048"
QB_MEM:virtclass-mcextend-python3-cryptography = "-m 5100"
QB_MEM:virtclass-mcextend-python3-numpy = "-m 4096"
QB_MEM:virtclass-mcextend-tcl = "-m 5100"
+QB_MEM:virtclass-mcextend-go = "-m 4096"
TEST_SUITES = "ping ssh parselogs ptest"
diff --git a/meta/recipes-devtools/go/go-1.26.0.inc b/meta/recipes-devtools/go/go-1.26.0.inc
index 7d8a68e3b2..611f00aaab 100644
--- a/meta/recipes-devtools/go/go-1.26.0.inc
+++ b/meta/recipes-devtools/go/go-1.26.0.inc
@@ -16,5 +16,6 @@ SRC_URI += "\
file://0009-go-Filter-build-paths-on-staticly-linked-arches.patch \
file://0010-cmd-go-clear-GOROOT-for-func-ldShared-when-trimpath-.patch \
file://0011-cmd-link-stop-forcing-binutils-gold-dependency-on-aa.patch \
+ file://run-ptest \
"
SRC_URI[main.sha256sum] = "c9132a8a1f6bd2aa4aad1d74b8231d95274950483a4950657ee6c56e6e817790"
diff --git a/meta/recipes-devtools/go/go/run-ptest b/meta/recipes-devtools/go/go/run-ptest
new file mode 100755
index 0000000000..ac020de025
--- /dev/null
+++ b/meta/recipes-devtools/go/go/run-ptest
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+PTEST_DIR=/usr/lib/go/ptest
+GOROOT=/usr/lib/go
+
+export GOROOT
+export PATH=$GOROOT/bin:$PATH
+export ZONEINFO=/usr/share/zoneinfo
+
+ln -sf $PTEST_DIR/src $GOROOT/src
+mkdir -p $GOROOT/pkg/include
+cp $PTEST_DIR/pkg/include/* $GOROOT/pkg/include/
+cp $PTEST_DIR/VERSION $GOROOT/VERSION
+
+cd $GOROOT
+
+SKIP_PKGS="debug/dwarf debug/elf debug/pe debug/plan9obj go/types internal/xcoff net/http runtime testing time"
+
+SKIP_REGEX=$(echo "$SKIP_PKGS" | sed 's/ /|/g')
+
+for pkg in $(go list std); do
+ if echo "$pkg" | grep -qE "^($SKIP_REGEX)$"; then
+ echo "SKIP: $pkg"
+ continue
+ fi
+
+ if go test -short "$pkg" >/dev/null 2>&1; then
+ echo "PASS: $pkg"
+ else
+ echo "FAIL: $pkg"
+ fi
+done
diff --git a/meta/recipes-devtools/go/go_1.26.0.bb b/meta/recipes-devtools/go/go_1.26.0.bb
index 46f5fbc6be..35a14b8e8b 100644
--- a/meta/recipes-devtools/go/go_1.26.0.bb
+++ b/meta/recipes-devtools/go/go_1.26.0.bb
@@ -1,7 +1,7 @@
require go-${PV}.inc
require go-target.inc
-inherit linuxloader
+inherit linuxloader ptest
CGO_LDFLAGS:append = " -no-pie"
@@ -16,3 +16,28 @@ python() {
d.appendVar('INSANE_SKIP:%s' % d.getVar('PN'), " textrel")
}
+do_install_ptest() {
+ install -d ${D}${PTEST_PATH}/src
+ install -d ${D}${PTEST_PATH}/pkg/include
+
+ cp ${S}/pkg/include/* ${D}${PTEST_PATH}/pkg/include/
+ echo "go${PV}" > ${D}${PTEST_PATH}/VERSION
+
+ cd ${S}/src
+ find . -type d -exec install -d ${D}${PTEST_PATH}/src/{} \;
+ find . -type f \
+ ! -path "*/testdata/*.elf*" \
+ ! -path "*/testdata/*-x86-64*" \
+ ! -path "*/testdata/*.obj" \
+ ! -path "*/testdata/*.syso" \
+ ! -path "*/testdata/*.so" \
+ ! -path "*/testdata/*.so_" \
+ ! -path "*/testdata/*-exec" \
+ ! -path "*/testdata/test32*" \
+ ! -path "*/testdata/test64*" \
+ ! -path "*/race/*.syso" \
+ ! -path "*/boring/syso/*.syso" \
+ -exec install -m 0644 {} ${D}${PTEST_PATH}/src/{} \;
+}
+
+RDEPENDS:${PN}-ptest += "bash tzdata git packagegroup-core-buildessential"
--
2.43.0
next prev parent reply other threads:[~2026-04-13 22:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-05 11:02 [OE-core][PATCH v1] go: add ptest support Pratik Farkase
2026-03-06 10:23 ` Mathieu Dubois-Briand
2026-03-06 17:24 ` [OE-core][PATCH v2] " Pratik Farkase
2026-03-06 18:55 ` Jose Quaresma
2026-03-08 16:09 ` Mathieu Dubois-Briand
2026-03-08 16:58 ` Pratik Farkase
2026-03-09 13:43 ` Mathieu Dubois-Briand
2026-03-18 14:03 ` [OE-core][PATCH v3] " Pratik Farkase
2026-03-19 6:57 ` Mathieu Dubois-Briand
2026-04-13 12:04 ` Pratik Farkase
2026-04-13 12:27 ` Marko, Peter
2026-04-13 22:37 ` Pratik Farkase
2026-04-14 10:10 ` Jose Quaresma
2026-04-14 10:32 ` Pratik Farkase
2026-04-13 12:02 ` [OE-core][PATCH v4] " Pratik Farkase
2026-04-13 22:29 ` Pratik Farkase [this message]
2026-04-14 10:31 ` [OE-core][PATCH v6] " Pratik Farkase
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=20260413222943.26238-1-pratik.farkase@est.tech \
--to=pratik.farkase@est.tech \
--cc=openembedded-core@lists.openembedded.org \
--cc=pratik.farkase@ericsson.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox