From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id EKOMAcvvTmcuzwAA62LTzQ:P1 (envelope-from ) for ; Tue, 03 Dec 2024 11:47:23 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id EKOMAcvvTmcuzwAA62LTzQ (envelope-from ) for ; Tue, 03 Dec 2024 12:47:23 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=PBZKxgqW; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=H6qG3mgW; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1733226442; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=TMeaWdq4JXh2g0HEPjs29PDQ/satiNxdSpqy2Qkm43o=; b=XkLTksoUr/yhvwUnn5m2UC03F1gIIfTBCuYo97MUkKI6IbCTipHrMhJYbl36MpdcMVJZQj AVhQYvOhE38c08dWliO80Yp9/eImqqaznziEX2O82fMGvNT5tg6QkvyoYa87cSLBQOOCVI h6fbBvZe+84e0JDMlJ6ch0bofjxnINBMkpuIchRfRAfVntRCMBJ13Jn1DpNBdh2ow73A3A QZdsNdRFup1HbifENlpakyNEuTroWSqGdqpqoC6103isikz9coeLDCor0h3h97Bwo8l6nq Gql7j7sn3YwuBAR4nZUaVSQx4KfXbUHJ52P7+Wu2GF4ENKBakglRgpfg79qzYw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=PBZKxgqW; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=H6qG3mgW; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1733226442; a=rsa-sha256; cv=none; b=B5kSEkU6Dz7iPbvKsDZYIyaJtLYDrjvu6r1KnOhO2PShPrvsX9JoFtt7mrB+NKFzNjbR8E JGVtWXaHYzECnOD7nY2wJQPsTuCN2I8gVi4kQ014werOQXS1mSmKdJEOqfP3It5vVoGcOc TdRAWRPpt1yIHxRlbEyxqUh7fPZyvlE5Cljpmz39XuktQ9iYoSp97o4eE4iB8QJeaytiNN GEjLFD6er1tXpn81uHhohini/kiedJS2ErbKEsm22sOKOgfPCar7+BwU0BQX9hIZL9D91v SLgkClS3hH0LEER/kJdpTbJxiznvEuWjrm7UH8i3nu2VyJ8kvk9keRYcx25OGA== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 73EDE801C6 for ; Tue, 03 Dec 2024 12:47:22 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tIRMw-0001sp-A5; Tue, 03 Dec 2024 06:47:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tIRMt-0001s9-O6 for guix-patches@gnu.org; Tue, 03 Dec 2024 06:47:03 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tIRMs-0001xE-AP for guix-patches@gnu.org; Tue, 03 Dec 2024 06:47:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=TMeaWdq4JXh2g0HEPjs29PDQ/satiNxdSpqy2Qkm43o=; b=PBZKxgqW0BZ6BI3LOfBOWqKxDikC5vwKTDXhMSsH7OxqNbvekIBWfs5yvREwfdfxLiZIdZUQZ3PiOjnv2rPCaBfjmo5a9sl2tGc7v1fFxJCNqJErIAzrpnDvBfWE6rPwiEGGiPv90SzgJfekUOg7ncSPLSBzO38wgEQv0WFEzfF/xygyIrsyfeOemm+f+XLaQ6HvwBsXYenMo9fOaGGd64p72MBZD291ZXwRv8fDOPI7BrX0MjuszALxL4FBw+kiOEimXhwZChot9RB3EUUg/rJNfhI6EaGTcFWAYSOfXX8csnX2S25lIw66pYwCZD5kj97t4ZPlygKit3lYrEhdNw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tIRMs-0001VE-4p; Tue, 03 Dec 2024 06:47:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74668] [PATCH 2/2] build-system/go: Add test-subdirs option key. Resent-From: Sharlatan Hellseher Original-Sender: "Debbugs-submit" Resent-CC: cox.katherine.e+guix@gmail.com, sharlatanus@gmail.com, guix-patches@gnu.org Resent-Date: Tue, 03 Dec 2024 11:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74668 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74668@debbugs.gnu.org Cc: Sharlatan Hellseher , Katherine Cox-Buday , Sharlatan Hellseher X-Debbugs-Original-Xcc: Katherine Cox-Buday , Sharlatan Hellseher Received: via spool by 74668-submit@debbugs.gnu.org id=B74668.17332264075738 (code B ref 74668); Tue, 03 Dec 2024 11:47:02 +0000 Received: (at 74668) by debbugs.gnu.org; 3 Dec 2024 11:46:47 +0000 Received: from localhost ([127.0.0.1]:58477 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tIRMc-0001UT-JQ for submit@debbugs.gnu.org; Tue, 03 Dec 2024 06:46:47 -0500 Received: from mail-wm1-f44.google.com ([209.85.128.44]:50598) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tIRMa-0001Ty-KB for 74668@debbugs.gnu.org; Tue, 03 Dec 2024 06:46:45 -0500 Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4349e1467fbso47347135e9.1 for <74668@debbugs.gnu.org>; Tue, 03 Dec 2024 03:46:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733226339; x=1733831139; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TMeaWdq4JXh2g0HEPjs29PDQ/satiNxdSpqy2Qkm43o=; b=H6qG3mgWQY+kfONDKUE+qP4xFHorTm1BPRCaKnbt1AdIFD3b/c2CDrGmRv4+p137vI so+ZwK/XWRzKR5usAUjrhMv3I69hHZbOvzc27UTUEq+5IfVgK4h7lU1cBMVPkCUn0bwD mYNAyvKFoTh1RfBHr+HOZeZsqjfRw2JPKoNcOawdoCGoAjgdL+4u6qgWRMIF2wJB6ecm ECKly0gETJzxn0q92uHYGPSGLQjeEQgdCKrNVZDwY2GXEp7xfeSJhZPFOP1k06Df7sVt g1YxleLkSeHyKNkJK72YpryceHXkKK9fGbn7lRo+EPQOKbkhhMPJLdM9jRmVWlk+bIx4 0CFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733226339; x=1733831139; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TMeaWdq4JXh2g0HEPjs29PDQ/satiNxdSpqy2Qkm43o=; b=S3x57OPubCQYIUpi3+MCVLuhij9dH4O7czeZ7DGz8job8G5c2G8UzavzGqduLuHDLb xl5siXAJdcfr2UEBVrxk27+FRmyUGPksZi5z3oOg3nPaN31AOKeP86QaRyivvTyxg5N0 lkp1VZYMa8jreUuRSDtnz6r6E9MtwU9mAoKrcsLsBNXlQ+Vvz5eZYZyFccpC7geml+0e gV8qZ2s1x0Mo7obOxWOS9WvWSDZ3vxDFj+8CEN0FuHMaBjO6E4Ra91PkRb1Ft7fO+dj7 TXrmTCX1ZY/Hj8zMl65wBoliylviBsDSR4w/vodlZpOOPvbC6Peeo8fipqGkZC2VzljD ZGXA== X-Gm-Message-State: AOJu0YzxKLGcpxJmJB7OvZEpIUeqEeRdlUPyso6ei9p5DkCyKGmFcxat LXHtbKpMMm862y7gm0ZKwEfWucfVNM1datllBM5efqG1/uEPP9Fgqg+vxg9aP2Y= X-Gm-Gg: ASbGnctRyAljrX1C9S+g+QD8wPjfM3Zcio6rf9H9Vrvm8/JBUSLMlSYyGZSGUnbC+f1 wwSR2xWgUl1GFyOy+w7Lebj6lksoshJE5pTobzXd7+Bih2e9yRYYBAxAls8MbGag607BmyPHlGk y7MdaY8onPz8oAIrDWhjLissTXCCYaGGEPNwtgPR5HOpUR4q2wILlaUX45tqukGhYzVgP2ehajY lXnAnvlzxFjA2RM3hNEs7uIZMkUugbbv64xPbnszEOiP4+tsHjR89fOwxgDOw49egAY08BFtxDK LOP04CJ/uEQo2yfr5XjLDdoOsjTApygzaNqbB4NPHw== X-Google-Smtp-Source: AGHT+IEuEzKAVIEkd3mQksDsHdFbma7snhZ7iop/2w4B80GqxkBcA5NA5phB/qcdOIMa/Ph0xl2Whg== X-Received: by 2002:a05:600c:1ca2:b0:434:9cf0:d23d with SMTP id 5b1f17b1804b1-434d0a062a5mr16482565e9.25.1733226338605; Tue, 03 Dec 2024 03:45:38 -0800 (PST) Received: from guxtil.incerto.xyz (cpc100684-bagu15-2-0-cust967.1-3.cable.virginm.net. [86.8.111.200]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434b9a9679bsm152903575e9.13.2024.12.03.03.45.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 03:45:38 -0800 (PST) From: Sharlatan Hellseher Date: Tue, 3 Dec 2024 11:45:34 +0000 Message-ID: <3abe629c9ce6355ac9e163bcc9345e856d3f2434.1733224617.git.sharlatanus@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: 2.28 X-Spam-Score: 2.28 X-Migadu-Queue-Id: 73EDE801C6 X-TUID: XUiupoI6uEJu Golang projects may contain subdirectories with test files, which can't be reached by providing just IMPORT-PATH to the test runner. This change implements a TEST-SUBDIRS key parameter which is by default set to "import-path/..." to run all available tests in the project, and may be limited to particular subdirs list. * guix/build-system/go.scm (go-build, go-cross-build): Add "test-subdirs" key parameter. * guix/build/go-build-system.scm (check): Add "test-subdirs" key parameter and adjust test invokation accordingly. Change-Id: Ibc107deea060f0d71e6f4e1e37c81d3b7c9992f5 --- guix/build-system/go.scm | 4 ++++ guix/build/go-build-system.scm | 18 ++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm index 97581a14c6..66cb5e8b05 100644 --- a/guix/build-system/go.scm +++ b/guix/build-system/go.scm @@ -205,6 +205,7 @@ (define* (go-build name inputs (build-flags ''()) (tests? #t) (test-flags ''()) + (test-subdirs ''("...")) (parallel-build? #t) (parallel-tests? #t) (allow-go-reference? #f) @@ -239,6 +240,7 @@ (define* (go-build name inputs #:build-flags #$build-flags #:tests? #$tests? #:test-flags #$test-flags + #:test-subdirs #$test-subdirs #:parallel-build? #$parallel-build? #:parallel-tests? #$parallel-tests? #:allow-go-reference? #$allow-go-reference? @@ -264,6 +266,7 @@ (define* (go-cross-build name (build-flags ''()) (tests? #f) ; nothing can be done (test-flags ''()) + (test-subdirs ''("...")) (allow-go-reference? #f) (system (%current-system)) (goarch (first (go-target target))) @@ -316,6 +319,7 @@ (define* (go-cross-build name #:build-flags #$build-flags #:tests? #$tests? #:test-flags #$test-flags + #:test-subdirs #$test-subdirs #:make-dynamic-linker-cache? #f ;cross-compiling #:allow-go-reference? #$allow-go-reference? #:inputs %build-inputs)))) diff --git a/guix/build/go-build-system.scm b/guix/build/go-build-system.scm index a463189011..7d702d7f1f 100644 --- a/guix/build/go-build-system.scm +++ b/guix/build/go-build-system.scm @@ -98,6 +98,10 @@ (define-module (guix build go-build-system) ;; * Remove module packages, only offering the full Git repos? This is ;; more idiomatic, I think, because Go downloads Git repos, not modules. ;; What are the trade-offs? +;; * Figurie out how to passthrough --verbosity option to "build" and "check" +;; procedures. +;; * Implement test-backend option, which would be similar to pyproject's +;; one, allowing to provide custom test runner. ;; ;; [0] `go build`: ;; https://golang.org/cmd/go/#hdr-Compile_packages_and_dependencies @@ -325,13 +329,23 @@ (define* (build #:key "Here are the results of `go env`:\n")) (invoke "go" "env")))) -(define* (check #:key tests? import-path test-flags (parallel-tests? #t) +(define* (check #:key + tests? + import-path + test-flags + test-subdirs + (parallel-tests? #t) #:allow-other-keys) "Run the tests for the package named by IMPORT-PATH." (when tests? (let* ((njobs (if parallel-tests? (parallel-job-count) 1))) (setenv "GOMAXPROCS" (number->string njobs))) - (apply invoke "go" "test" `(,import-path ,@test-flags))) + (apply invoke "go" "test" + `(,@(map (lambda (dir) + (format #f "~a~:[/~;~]~a" + import-path (string-null? dir) dir)) + test-subdirs) + ,@test-flags))) #t) (define* (install #:key install-source? outputs import-path unpack-path #:allow-other-keys) -- 2.46.0