go: ptest: improvements and multiple fixes in golang ptest
PATCH 1/1 go: ptest: improvements and multiple fixes in golang ptest
Summary of Changelog:
- run-ptest permanently modified the installed GOROOT by symlinking src/ and copying files without cleanup, corrupting the Go installation
- Sub-package skip regex used exact match (^pkg$) so subpackages like net/http/httptest and runtime/debug were not skipped and would fail
- Test output was completely suppressed (>/dev/null 2>&1), making failures impossible to diagnose
- go was missing from RDEPENDS, allowing ptest to be installed without the toolchain it needs
- bash was in RDEPENDS despite the script using #!/bin/sh with no bash-isms
- file://run-ptest was in the shared .inc, affecting go-cross and go-native which don't inherit ptest
- cp pkg/include/* would fail if the directory was empty
Fix by saving/restoring GOROOT/src, using (/|$) in the skip regex, printing output on failure, correcting RDEPENDS, moving run-ptest to the target .bb, and guarding the glob.
Tested on qemux86-64: all tests pass, 0 failures (~63 min).
--- meta/recipes-devtools/go/go-1.26.2.inc | 1 - meta/recipes-devtools/go/go/run-ptest | 51 +++++++++++++++++++++----- meta/recipes-devtools/go/go_1.26.2.bb | 8 +++- 3 files changed, 47 insertions(+), 13 deletions(-)
meta/recipes-devtools/go/go-1.26.2.inc +0 -1
@@ -16,6 +16,5 @@ 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] = "2e91ebb6947a96e9436fb2b3926a8802efe63a6d375dffec4f82aa9dbd6fd43b"
meta/recipes-devtools/go/go/run-ptest +41 -10
73 lines not on this page · raw message
meta/recipes-devtools/go/go_1.26.2.bb +6 -2
@@ -3,6 +3,8 @@ require go-target.inc inherit linuxloader ptest +SRC_URI += "file://run-ptest" + CGO_LDFLAGS:append = " -no-pie" export GO_LDSO = "${@get_linuxloader(d)}"
@@ -20,7 +22,9 @@ 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/ + if ls ${S}/pkg/include/* >/dev/null 2>&1; then + cp ${S}/pkg/include/* ${D}${PTEST_PATH}/pkg/include/ + fi echo "go${PV}" > ${D}${PTEST_PATH}/VERSION cd ${S}/src
@@ -40,4 +44,4 @@ do_install_ptest() { -exec install -m 0644 {} ${D}${PTEST_PATH}/src/{} \; } -RDEPENDS:${PN}-ptest += "bash tzdata git packagegroup-core-buildessential" +RDEPENDS:${PN}-ptest += "go tzdata git packagegroup-core-buildessential"
Signature · 1 line
2.34.1