From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id WOC8Msr8qGXzhwAAqHPOHw:P1 (envelope-from ) for ; Thu, 18 Jan 2024 11:26:19 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id WOC8Msr8qGXzhwAAqHPOHw (envelope-from ) for ; Thu, 18 Jan 2024 11:26:18 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=mHGiFPuN; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1705573578; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=QYOhyR+XTVkCO2OFd3g4Coz/tG1peh9A0irG7OpnQTs=; b=OPmJSTbWUFVOFGIIK9geG8OGZOTezjfF2Rf1cZ63V9CtVzZIC2tK8qyYo7RyxSeqNSl8qa 9pCNU2iehzKXcZsFuiht8NjiDEMYf3C0vBeMwg36E1jFEyaOnG+pqIegtF+hPoaBqr8GJn Bi2vDT2XPy6arYiOPWEO4J+k1ux8hljJtpltv9FehlgW5G4HsfRC9AbbqBt0c1z+d6ej5d IrCqPTs5PUlA+nfFp6MPZPBHJCSZsPJhmYbqc9YVcMUWDSizB5xqeKsQCiUq0OPFD1Aekr zhkoep/tMPBnMaqVPAED+3McjgIOuSEvQB7fCcSM2+llmryrXqhkk6DD0Uzy+A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1705573578; a=rsa-sha256; cv=none; b=t+KW2QubU+dFs9jksNKMQ9UkZKrE4KSiARSYPhyfO4NJQYU79rRLl4+uXBE1HwUf90ho61 /4PCDY8kohXcHf/NK6ls1HMr7IkvO3onpz3fZv89wR87Iv7+ymiUIw6mY2at/tQwvRi+GN XiZkVV6BM0Df86AJ5tzOqdsZHX5deeijfbJpnoT9yyAkfO0fcj1mPTDitoL/IUqkzk1xi/ PDKd7EkXsS3Jez6CMzbcRD7moFlb5naauE/W62BHVUmPqMit1/5iyYCLQvPNwcYFJnDAvY FDFDrUYw1lvRTW8XjGtdsEOAu2Eup3LXdH49+NgAYaDp4CTF/yjg5TzxmcAJSQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=mHGiFPuN; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-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 81D516E700 for ; Thu, 18 Jan 2024 11:26:18 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQPaP-00077x-SZ; Thu, 18 Jan 2024 05:25:25 -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 1rQPaN-00077Z-SU for guix-devel@gnu.org; Thu, 18 Jan 2024 05:25:23 -0500 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rQPaL-0002Jp-5h for guix-devel@gnu.org; Thu, 18 Jan 2024 05:25:23 -0500 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2cca5d81826so155626331fa.2 for ; Thu, 18 Jan 2024 02:25:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705573519; x=1706178319; darn=gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=QYOhyR+XTVkCO2OFd3g4Coz/tG1peh9A0irG7OpnQTs=; b=mHGiFPuNod4m3p3G4CHL6eRVg0GCYCG/AmsasFaAmqSumg0ERIxBrfQYhdVHRqIK1Q XjmZ2c3VN61jW50LNTJ0/WugKwLTscMUNkd9QwU0A6i0zyE6UT4+7hl+4PdyEHJ5Dms1 m0B/sLKtAaBwXCM804SW1jy/QJ1FIuXwK6ENPxrE8uIobsV3GnC0ZrKZb4S8gFtWsntf zdmzQHAOU5TP0lYl49FbwBubJpims+M8E6tPvyaoFc8uhRmK9aSieRPqtmFX554SK7/p 0yAP2ck9bQ+zy96Xxfu1I7gGVuc8AjDk1m6EpSxjDgwucKuKdySoybI92jjAI/KGLtn3 iW9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705573519; x=1706178319; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QYOhyR+XTVkCO2OFd3g4Coz/tG1peh9A0irG7OpnQTs=; b=peIN/XSlrZdzwoeCDNXGMLBt2vnyO02ckdlQeacvlEpeU9iZ4PDSSpwaoq+lnP6Fmv iCJtXRkRP2qs7t9VlobFx/QV1VCel0YObnKEW/r8s9/UCKFYkQa/roqWDdH3B+BTIGKq 8cScxebMz0Alfjmxr3nNFi5vo6HOMJteO+9YvGnFTzFPtBh3Jw2dSTmOvYk0KtHIA4ee 4+gCCfClxWGo4rnB9ITV7rySaw2OFtO+TkeNWTAX8vCFdVhLfOryMz8WaiVdFRZlE8bQ rw85IssqUO2yLrvoN8YVOzwxJ77MNvqVOOFhMNJHuMMmQ6KX1iY1cjmJzJr78x/3f7TU cp5g== X-Gm-Message-State: AOJu0YyAqFzxmhoM+f7mmTHo/8mH2C/fyPudMRRAhQgkI4KsRk6Vjqm3 rzyYWyLQoCKL3kjPehwvGheXX4NvPq+VWnCrJJHnOHdfQYQeQaeK5TWLy5A25bNM+97cSLdT6lL cKn0VNb8YyNUgRow+0BOkqQsIx0T+VdKFpuE7nQ== X-Google-Smtp-Source: AGHT+IE2F12E/hXzJ36/rxsddfXRdFrgXP0TQEUs1ZzWbtLUbeCe4S98er3dWJKWnWmjw7pYOyyXAtgTgbOVGX30bFE= X-Received: by 2002:a2e:a58b:0:b0:2cd:13bf:78d7 with SMTP id m11-20020a2ea58b000000b002cd13bf78d7mr570140ljp.10.1705573518658; Thu, 18 Jan 2024 02:25:18 -0800 (PST) MIME-Version: 1.0 References: <65b75d58-e27b-4d02-80be-d87b86bf0342@troyfigiel.com> <87r0igt0r9.fsf@gmail.com> In-Reply-To: <87r0igt0r9.fsf@gmail.com> From: Sharlatan Hellseher Date: Thu, 18 Jan 2024 10:25:07 +0000 Message-ID: Subject: Re: Golang check phase skipping some tests? To: Simon Tournier Cc: Troy Figiel , guix-devel@gnu.org, Katherine Cox-Buday Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::236; envelope-from=sharlatanus@gmail.com; helo=mail-lj1-x236.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-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: -7.50 X-Spam-Score: -7.50 X-Migadu-Queue-Id: 81D516E700 X-TUID: YIJx98I8uqZ7 Hi, I can't say that I'm an expert in Golang :-), but I've got some experience = in building and deploying Glang daily for some time. First things first the default behaviour of `go test ./...` is like this: --8<---------------cut here---------------start------------->8--- find * -type f -name *_test.go | --8<---------------cut here---------------start------------->8--- Internally Golang tries to find any files with _test.go suffix in provided module's location and evaluate defined tests in them. If the directory of the module= does not have test files it's just ignored. Now in actions. If we investigate which test files we have for `go-github-com-stretchr-test= ify` we'll see that for the current version packed in Guix there are some: --8<---------------cut here---------------start------------->8--- guix describe Generation 503 Jan 16 2024 13:15:09 (current) guix 8520f00 repository URL: https://git.savannah.gnu.org/git/guix.git branch: master commit: 8520f00d6989ff5ab22755a97dfcfd0375f6b5ca guix time-machine --commit=3D8520f00d6989ff5ab22755a97dfcfd0375f6b5ca -- \ shell findutils -- \ find $(guix build go-github-com-stretchr-testify --no-substitutes) -type f -name "*_test.go" /gnu/store/jpizwxbhr93wmday0raz0vk0ny5s5jiv-go-github-com-stretchr-testify-= 1.7.0/src/github.com/stretchr/testify/suite/suite_test.go /gnu/store/jpizwxbhr93wmday0raz0vk0ny5s5jiv-go-github-com-stretchr-testify-= 1.7.0/src/github.com/stretchr/testify/suite/stats_test.go /gnu/store/jpizwxbhr93wmday0raz0vk0ny5s5jiv-go-github-com-stretchr-testify-= 1.7.0/src/github.com/stretchr/testify/mock/mock_test.go /gnu/store/jpizwxbhr93wmday0raz0vk0ny5s5jiv-go-github-com-stretchr-testify-= 1.7.0/src/github.com/stretchr/testify/package_test.go /gnu/store/jpizwxbhr93wmday0raz0vk0ny5s5jiv-go-github-com-stretchr-testify-= 1.7.0/src/github.com/stretchr/testify/require/requirements_test.go /gnu/store/jpizwxbhr93wmday0raz0vk0ny5s5jiv-go-github-com-stretchr-testify-= 1.7.0/src/github.com/stretchr/testify/require/forward_requirements_test.go /gnu/store/jpizwxbhr93wmday0raz0vk0ny5s5jiv-go-github-com-stretchr-testify-= 1.7.0/src/github.com/stretchr/testify/assert/http_assertions_test.go /gnu/store/jpizwxbhr93wmday0raz0vk0ny5s5jiv-go-github-com-stretchr-testify-= 1.7.0/src/github.com/stretchr/testify/assert/forward_assertions_test.go /gnu/store/jpizwxbhr93wmday0raz0vk0ny5s5jiv-go-github-com-stretchr-testify-= 1.7.0/src/github.com/stretchr/testify/assert/assertion_order_test.go /gnu/store/jpizwxbhr93wmday0raz0vk0ny5s5jiv-go-github-com-stretchr-testify-= 1.7.0/src/github.com/stretchr/testify/assert/assertion_compare_test.go /gnu/store/jpizwxbhr93wmday0raz0vk0ny5s5jiv-go-github-com-stretchr-testify-= 1.7.0/src/github.com/stretchr/testify/assert/assertions_test.go --8<---------------cut here---------------start------------->8--- Checking current implementation of the go-build-system.scm I realized that = it only runs test available in `import-path` and does not scan any farther lik= e the `./...` option does. In our case it is just one file, rest are ignored. > /gnu/store/jpizwxbhr93wmday0raz0vk0ny5s5jiv-go-github-com-stretchr-testif= y-1.7.0/src/github.com/stretchr/testify/package_test.go > guix/guix/build/go-build-system.scm --8<---------------cut here---------------start------------->8--- ;; Can this also install commands??? (define* (check #:key tests? import-path #:allow-other-keys) "Run the tests for the package named by IMPORT-PATH." (when tests? (invoke "go" "test" import-path)) #t) --8<---------------cut here---------------start------------->8--- With small adjustment of the invok line, I could manage to trigger all test= s to be run, but it brings other issue of some not packed modules required for t= he check phase. --8<---------------cut here---------------start------------->8--- @@ -275,7 +275,7 @@ (define* (build #:key import-path build-flags #:allow-other-keys) (define* (check #:key tests? import-path #:allow-other-keys) "Run the tests for the package named by IMPORT-PATH." (when tests? - (invoke "go" "test" import-path)) + (invoke "go" "test" (string-append import-path "/..."))) #t) (define* (install #:key install-source? outputs import-path unpack-path #:allow-other-keys) --8<---------------cut here---------------start------------->8--- As a quick ad-hoc to run all tests for some new package you may add a custo= m check phase with the snippet you provided. I'm currently in review and split some packages from (gnu packages golang) = into (gnu packages golang-crypto) to simplify the maintenance. I try to play wit= h that option and see which packages are missed to satisfy passing all tests. Thanks, Oleg On Wed, 17 Jan 2024 at 20:25, Simon Tournier wro= te: > > Hi, > > CC: > $ ./etc/teams.scm list-members go > Katherine Cox-Buday > Sharlatan Hellseher > > > On Sun, 14 Jan 2024 at 22:12, Troy Figiel wrote: > > > --8<---------------cut here---------------start------------->8--- > > (define* (check #:key tests? import-path #:allow-other-keys) > > "Run the tests for the package named by IMPORT-PATH." > > (when tests? > > (invoke "go" "test" (string-append import-path "/..."))) > > #t) > > --8<---------------cut here---------------end--------------->8--- > > > > For example, if the -v flag is added (which might be a better default?) > > to the check phase of go-github-stretchr-testify, it can be seen that > > only `TestImports' runs, none of the tests in assert, http, etc. > > However, the source code in these subdirectories is still recursively > > copied to out during the install phase. > > > > Is this desired behaviour? I assumed it isn't, because it looks like we > > are skipping a lot of tests during the check phase. However, I might > > also simply be overlooking something here as I am new to packaging > > Golang with Guix. > > From your description, it seems a good idea. What do Go =E2=80=9Cexperts= =E2=80=9C > think? > > Cheers, > simon --=20 VCS: https://github.incerto.xyz/; https://git.sr.ht/~hellseher/ GPG: 9847 81DE 689C 21C2 6418 0867 76D7 27BF F62C D2B5 =E2=80=A6 =D0=BD=D0=B0=D1=88 =D1=80=D0=B0=D0=B7=D1=83=D0=BC - =D0=BF=D1=80= =D0=B5=D0=B2=D0=BE=D1=81=D1=85=D0=BE=D0=B4=D0=BD=D0=B0=D1=8F =D0=BE=D0=B1= =D1=8A=D1=8F=D1=81=D0=BD=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=B0=D1=8F = =D0=BC=D0=B0=D1=88=D0=B8=D0=BD=D0=B0 =D0=BA=D0=BE=D1=82=D0=BE=D1=80=D0=B0= =D1=8F =D1=81=D0=BF=D0=BE=D1=81=D0=BE=D0=B1=D0=BD=D0=B0 =D0=BD=D0=B0=D0=B9=D1=82=D0=B8 =D1=81=D0=BC=D1=8B=D1=81=D0=BB =D0=BF=D0=BE= =D1=87=D1=82=D0=B8 =D0=B2 =D1=87=D0=B5=D0=BC =D1=83=D0=B3=D0=BE=D0=B4=D0=BD= =D0=BE, =D0=B8=D1=81=D1=82=D0=BE=D0=BB=D0=BA=D0=BE=D0=B2=D0=B0=D1=82=D1=8C = =D0=BB=D1=8E=D0=B1=D0=BE=D0=B9 =D1=84=D0=B5=D0=BD=D0=BE=D0=BC=D0=B5=D0=BD, = =D0=BD=D0=BE =D1=81=D0=BE=D0=B2=D0=B5=D1=80=D1=88=D0=B5=D0=BD=D0=BD=D0=BE =D0=BD=D0=B5 = =D0=B2 =D1=81=D0=BE=D1=81=D1=82=D0=BE=D1=8F=D0=BD=D0=B8=D0=B8 =D0=BF=D1=80= =D0=B8=D0=BD=D1=8F=D1=82=D1=8C =D0=BC=D1=8B=D1=81=D0=BB=D1=8C =D0=BE =D0=BD= =D0=B5=D0=BF=D1=80=D0=B5=D0=B4=D1=81=D0=BA=D0=B0=D0=B7=D1=83=D0=B5=D0=BC=D0= =BE=D1=81=D1=82=D0=B8.