From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id gNllGHwyYmdVFwEA62LTzQ:P1 (envelope-from ) for ; Wed, 18 Dec 2024 02:25:00 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id gNllGHwyYmdVFwEA62LTzQ (envelope-from ) for ; Wed, 18 Dec 2024 03:25:00 +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=hTfpAO8V; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b="d/yAuQuf"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1734488700; 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=JaAm3+Yvi8vgVHf5Cpjs8yH3dA/f75UaTw9J2GBs+Nk=; b=GpS/E3H2nZ/RFOHJrANiUlthns3Y7SfavevXofLV3pinzF9G2uQ+tqNkEocA0vaUGLKX1J 6lS+0CCLG0jpArHQn/LKo2aFDtivNVuUUs72dgc2r6JfjDaKUZp7nvavY0/W7Ig54gwIlm I2QmO6XF3KIHaUzKs7wEJ84S4HtcCrjorkR22VsGmBMHakFxK8fGHhYlae2hbIJ2ZWLEta elpSQvrYsNMZajQ8fxURPUO2YrPOgqybNuukr55tzkIcwdKcrvTkNTcFW2pdh2qWm/BBSG YsjrXWnQbWBXtxGt9eoGBALq+pQk5KhnSr9kQTIx5/0GWFbrurXllBSt64f9XQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1734488700; a=rsa-sha256; cv=none; b=sdIzP4AJ9Xklq/7X26D5eCtvQ/EODPrE5H234/1TBbXZ9lGr1nJgyJhLqJ3gDPStC1U/tu h6E0s5P7LiB0tPY6Qp6qp5fqrDDyJArM1h3Tgo16yNQkQO2ZO6cBjMQKYYzqkVEz++/msi KJsUYlsN7b721T6uBWeqO2kQH6O12VJZT74z2fAnZZ8pRGzl7heNHFeSJjXmArOBsFJ76f /T1HHI+hN4lSjEcUdH0RsTXhaPvlRZj7zkQF9ttNykrrV4lDQ8Dvt4WIHJMIXS90WSL+4H TUAoOJMzkmwVjqE2K0y5Xta8HzdOVmQc4qh4X7aEsMC2RSj2UG1iqhLiFtLCoQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=hTfpAO8V; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b="d/yAuQuf"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); 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" 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 2ABA197E17 for ; Wed, 18 Dec 2024 03:25:00 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNjjX-0003xG-JS; Tue, 17 Dec 2024 21:24:20 -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 1tNjjQ-0003wc-Ce for guix-patches@gnu.org; Tue, 17 Dec 2024 21:24:13 -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 1tNjjP-0007Mk-Bc for guix-patches@gnu.org; Tue, 17 Dec 2024 21:24:12 -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=JaAm3+Yvi8vgVHf5Cpjs8yH3dA/f75UaTw9J2GBs+Nk=; b=hTfpAO8Vexvp2xEVMQyFpPxNjDIaehWshPCe+YyytKm2t2BfrkYWi33MrPMBg5O87TeZt0q6l/ey5wOtPe0ZgwZoqb3pogHoqekA7/dqIOAXvyvftWMp+5w3eHqriwzFZdViMIdCChvaKAQKlOCxavw+QuhHCaKH+2ejf5chFuTdXEmYVhXz76RGUhR2R4XBVwxAw6g8lXXPetqqFTSCQCNHzyHzzi5t0Y/Qs/g9CHAr0XqMzP7Lv/ojizxgqSpb7Q6yDYIhhOGEhaGZq2ERk2oI3DMIAcRY0r6KOyDDk9cFOF4jY+t9GSuRD9CP/tCbpxID6se5EaiUsPQ6SnuNXg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tNjjF-0004F5-Sh; Tue, 17 Dec 2024 21:24:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74668] [PATCH v2 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: Wed, 18 Dec 2024 02:24:01 +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.173448861716263 (code B ref 74668); Wed, 18 Dec 2024 02:24:01 +0000 Received: (at 74668) by debbugs.gnu.org; 18 Dec 2024 02:23:37 +0000 Received: from localhost ([127.0.0.1]:60954 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tNjir-0004EF-06 for submit@debbugs.gnu.org; Tue, 17 Dec 2024 21:23:37 -0500 Received: from mail-wr1-f49.google.com ([209.85.221.49]:45072) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tNjio-0004Dz-5f for 74668@debbugs.gnu.org; Tue, 17 Dec 2024 21:23:35 -0500 Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-385e1fcb0e1so3251027f8f.2 for <74668@debbugs.gnu.org>; Tue, 17 Dec 2024 18:23:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734488553; x=1735093353; 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=JaAm3+Yvi8vgVHf5Cpjs8yH3dA/f75UaTw9J2GBs+Nk=; b=d/yAuQufs9TEiOYjRfZh+BR/DNaXafhID/PdHQkQeqIJMBtk8UdgRO5aGFVh0XJSjz ckJqtjBAO+oTgInN+RSm0lkM0WT6mxRpvvK0rURY1JM4c3+Y8jC/eIbgFWnXPxtYm5PV V+CuJwz5VILF+YYV+msfDxVwNjYmwATtcJFNv8gEOIK0OgOh9kozDgiCOZiJP71uguWt rLy4cvP17SQ4mUdUq8zmuHy2yK1xKVKdqlT9FndCVC6VW0ixSr9rKu5hyAUyyiVoUL8w Emvr2C/H5+i/mT5dMXukspBIdZE3Adp0EJAmG4Gp37bwKcXnWbKMTHrSX/GVxI7TowdJ 0O+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734488553; x=1735093353; 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=JaAm3+Yvi8vgVHf5Cpjs8yH3dA/f75UaTw9J2GBs+Nk=; b=NWLe0h0shl0acB9qhJNLkJj4Ah+fvUHOh1k6oXJINn/G7Q7wp43OpB6gQrgR4CDSKN 9Hh+tk7krYC4enPDPgCrKkPrppCdoD+4Q31ICyJBfXP3Uv5DAPvLgBA3S8oIxpITySse V4oVLP7StJyQ0twIAkFMmm4P+vnabbl3r9HvAmAphW3ZdJu3lAhMcPkf0cCGrFKDjKxa GJwYg371BdqBR+124p9BAK9bne0SYV2HCMN08qNe1P9QngMMAWuqCvwXh17A0MY5MbJq Yu/gNmC/o8M1dalKxS7qLt3QfRUK83xOScyRtwCjxvVHSlIX51Ao+lHkWrMVUIamNQc9 bdwQ== X-Gm-Message-State: AOJu0Yxx9aaq3Yp3tnhz9eAhK93YT9oCM12+AzqjDA+otXTOs+HuCY8R BmcXNKM2Zmsx4Do6RYfYCrUzTH7BLB/Xi/j7uwrWRWOPFcLFUeMTZN23Z4NQ X-Gm-Gg: ASbGncs9askkA2lEazNrBONDrwo4nKQiJt6qVpTcIc/fvxGh2/d0oG6TfyYaEMwiPc8 5QQ0IyZ7y/eku9IZ0s4V9CEoFpItktXY1CV4Lm8phyOZJN18n4nn5kYAuGKC5LlegkAGQb1Gmg1 kAD8idKZb44/n8K+LxnqcxZG2tntVG3dHhKJdx3Vtd9XzLiRqW9qClzknP0Tj+4TCudQbkBozkf SodaoYKR6aFVA0+Y67iG4KfRmxg3oMwEU1YV3IwZ/HsX5bN6kdtc/DwVeiGHNBPmL8zHUOSEdo7 q4OwsJdfOzszm7KXLiEFe0Tzbb0rB0nDdYHony+EpGLXeJiU X-Google-Smtp-Source: AGHT+IE3GU7EFNiKBV6Pbr92Tx651mDf45w6wCiyTbXsOt3s9RhIDS4lD++L9Zm3D1KY3pi+aKA1gw== X-Received: by 2002:a05:6000:4a03:b0:385:ef39:6cd5 with SMTP id ffacd0b85a97d-388e4d2dd26mr965977f8f.1.1734488552911; Tue, 17 Dec 2024 18:22:32 -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 ffacd0b85a97d-388c801ac5asm12477424f8f.55.2024.12.17.18.22.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 18:22:32 -0800 (PST) From: Sharlatan Hellseher Date: Wed, 18 Dec 2024 02:22:27 +0000 Message-ID: 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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -1.86 X-Spam-Score: -1.86 X-Migadu-Queue-Id: 2ABA197E17 X-TUID: JXD3TXsyuZfC 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 9f9eea3069..a785118018 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 @@ -326,13 +330,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