From patchwork Mon Sep 14 19:12:35 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Marko X-Patchwork-Id: 98221 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB152C88E72 for ; Mon, 14 Sep 2026 19:14:02 +0000 (UTC) Received: from mta-65-228.siemens.flowmailer.net (mta-65-228.siemens.flowmailer.net [185.136.65.228]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.5602.1789413235007052573 for ; Mon, 14 Sep 2026 12:13:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=peter.marko@siemens.com header.s=fm1 header.b=Nloeo1md; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.228, mailfrom: fm-256628-202609141913530f394783fd0002074d-wwcv7g@rts-flowmailer.siemens.com) Received: by mta-65-228.siemens.flowmailer.net with ESMTPSA id 202609141913530f394783fd0002074d for ; Mon, 14 Sep 2026 21:13:53 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=peter.marko@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=0fbKSvMNHTyC6kzTJ9xbbZbrX3EsXBEf9Eq0W3XrgqQ=; b=Nloeo1mdO0aF+6lSlVfNJSasDy1MHGktofl5/XxuhqWYRAexUnzpN8VOIMDGZzHFZqp5hy gOP687Cm6w4lx0czT3MwqMYYc/UlXfxgRxAoJN5mWO/ZBCLUlDvl1kCg6AdVOJ5qy6674Rzv C+238RM0cWjMtgtnNqQ8DVaGAtxOAAbFSdPCmZe7h0cMpATZzOSXoRzo22aOeujPlrshxh+5 BD+gWZPkic/Mhq2RVrFPh7oqDr+NNcCkGg0KfWmqyV+H8yizM78eYKBU0/x5fpY5v5kHDq8t OZyfgTXltcw2lkRcnggam6inbirin/RzuC0+54mYfIzXLj0nFqJQUxvw==; From: Peter Marko To: yocto-patches@lists.yoctoproject.org Cc: peter.marko@siemens.com, jose.quaresma@foundries.io Subject: [meta-lts-mixins][wrynose/go][PATCH 06/11] go: ptest: fix GOROOT detection and improve cleanup/exit handling Date: Mon, 14 Sep 2026 21:12:35 +0200 Message-ID: <20260914191240.1066469-6-peter.marko@siemens.com> In-Reply-To: <20260914191240.1066469-1-peter.marko@siemens.com> References: <20260914191240.1066469-1-peter.marko@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-256628:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 14 Sep 2026 19:14:02 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/4833 From: Pratik Farkase Changes: - Derive GOROOT dynamically from PTEST_DIR instead of hardcoding /usr/lib/go, which breaks on distros using lib64. - Track and clean up VERSION and pkg/include files that were copied into GOROOT, preventing stale artifacts after ptest runs. - Track failures with RC variable and exit non-zero when tests fail, consistent with other ptest scripts. Signed-off-by: Pratik Farkase Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie (From OE-Core rev: a912153baed08d8d1d563341e29a2d596546bdb4) Signed-off-by: Peter Marko --- recipes-devtools/go/go/run-ptest | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/recipes-devtools/go/go/run-ptest b/recipes-devtools/go/go/run-ptest index b8a0805..5fc9367 100755 --- a/recipes-devtools/go/go/run-ptest +++ b/recipes-devtools/go/go/run-ptest @@ -2,7 +2,7 @@ # SPDX-License-Identifier: MIT PTEST_DIR=$(cd "$(dirname "$0")" && pwd) -GOROOT=/usr/lib/go +GOROOT=$(dirname "$PTEST_DIR") export GOROOT export PATH=$GOROOT/bin:$PATH @@ -16,11 +16,18 @@ if [ -d "$GOROOT/src" ] && [ ! -L "$GOROOT/src" ]; then fi ln -sf "$PTEST_DIR/src" "$GOROOT/src" -if [ -f "$PTEST_DIR/VERSION" ]; then +CLEANUP_VERSION=0 +if [ -f "$PTEST_DIR/VERSION" ] && [ ! -f "$GOROOT/VERSION" ]; then cp "$PTEST_DIR/VERSION" "$GOROOT/VERSION" + CLEANUP_VERSION=1 fi + +CLEANUP_INCLUDE=0 if ls "$PTEST_DIR/pkg/include/"* >/dev/null 2>&1; then - mkdir -p "$GOROOT/pkg/include" + if [ ! -d "$GOROOT/pkg/include" ]; then + mkdir -p "$GOROOT/pkg/include" + CLEANUP_INCLUDE=1 + fi cp "$PTEST_DIR/pkg/include/"* "$GOROOT/pkg/include/" fi @@ -38,6 +45,7 @@ SKIP_PKGS="debug/dwarf debug/elf debug/pe debug/plan9obj go/types internal/xcoff SKIP_REGEX=$(echo "$SKIP_PKGS" | sed 's/ /|/g') +RC=0 for pkg in $(go list std); do # Skip package and all its subpackages if echo "$pkg" | grep -qE "^($SKIP_REGEX)(/|$)"; then @@ -52,6 +60,7 @@ for pkg in $(go list std); do else echo "FAIL: $pkg" echo "$output" + RC=1 fi done @@ -60,4 +69,12 @@ rm -f "$GOROOT/src" if [ -d "$GOROOT/src.orig" ]; then mv "$GOROOT/src.orig" "$GOROOT/src" fi +if [ $CLEANUP_VERSION -eq 1 ]; then + rm -f "$GOROOT/VERSION" +fi +if [ $CLEANUP_INCLUDE -eq 1 ]; then + rm -rf "$GOROOT/pkg/include" +fi rm -rf "$GOCACHE" + +exit $RC