From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id UErPDkLvAGKEBAAAgWs5BA (envelope-from ) for ; Mon, 07 Feb 2022 11:06:58 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id +G0VDELvAGLWtwAA9RJhRA (envelope-from ) for ; Mon, 07 Feb 2022 11:06:58 +0100 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 A9531B79F for ; Mon, 7 Feb 2022 11:06:57 +0100 (CET) Received: from localhost ([::1]:49084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nH0vA-0001EC-Nt for larch@yhetil.org; Mon, 07 Feb 2022 05:06:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nH0ig-00018m-0R for guix-patches@gnu.org; Mon, 07 Feb 2022 04:54:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:47149) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nH0if-000281-N4 for guix-patches@gnu.org; Mon, 07 Feb 2022 04:54:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nH0if-00049h-Mo for guix-patches@gnu.org; Mon, 07 Feb 2022 04:54:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53389] [PATCH 0/9] Replace some mocking with with-http-server*, avoid hardcoding ports, Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 07 Feb 2022 09:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53389 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxime Devos Cc: 53389@debbugs.gnu.org Received: via spool by 53389-submit@debbugs.gnu.org id=B53389.164422763915965 (code B ref 53389); Mon, 07 Feb 2022 09:54:01 +0000 Received: (at 53389) by debbugs.gnu.org; 7 Feb 2022 09:53:59 +0000 Received: from localhost ([127.0.0.1]:41046 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nH0ic-00049R-Rq for submit@debbugs.gnu.org; Mon, 07 Feb 2022 04:53:59 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:55960) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nH0ia-00049D-Ul for 53389@debbugs.gnu.org; Mon, 07 Feb 2022 04:53:57 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 64C7A2C1; Mon, 7 Feb 2022 10:53:50 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6Qh9hEwflKRz; Mon, 7 Feb 2022 10:53:49 +0100 (CET) Received: from ribbon (91-160-117-201.subs.proxad.net [91.160.117.201]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 359DB1A0; Mon, 7 Feb 2022 10:53:49 +0100 (CET) From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <6b1c1d98514b2547907a81a04c1241d9b865d6fa.camel@telenet.be> <20220120130849.292178-1-maximedevos@telenet.be> <87lez7zpgf.fsf_-_@gnu.org> <687d96c300852e684422de877cd87769daae7ccd.camel@telenet.be> Date: Mon, 07 Feb 2022 10:53:48 +0100 In-Reply-To: <687d96c300852e684422de877cd87769daae7ccd.camel@telenet.be> (Maxime Devos's message of "Sat, 22 Jan 2022 19:55:30 +0100") Message-ID: <87r18fdmtv.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spamd-Bar: / X-Rspamd-Server: hera X-Rspamd-Queue-Id: 64C7A2C1 X-Spamd-Result: default: False [-0.10 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain,text/x-patch]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+,3:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] 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" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1644228417; 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: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; bh=kM+Jkj9oWSKwmBdOvdLU5B205rh6Cah6zCaZ58jIei8=; b=QMYo8ex0OsIpAr+FBvG+7VYxxU03sBtdRahQafRvSoTl7SIHfhmiqYt5VRFRQy6c3SkVjK 0sPNDPksIkTEirNyCeBFw2mWz+9W2lPwVDK8bAYDIstRLhmp/AUH/3b1yLMwMKU0Ysl4E+ NI4MIiXI4iwkln5AixPjzX3aj+TLfLlyb7PzZWtAAsbrKjJXDNJsFbvje5i43cqDoqcV7q wSc1Gm/WxmWtI/6MZSQvpS+vrYFklr8Y7kQ93NSzdleWun1CBQx4B5arl8ZF+XgekcxUJ0 IXEfMHuChAMkjqQg+fxVM7u1GeOWI/C4RV/3I3Pj8XER2WsJWfInLeLb3h3sHQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1644228417; a=rsa-sha256; cv=none; b=sH7uZPiwqRGFrKY0EExoiPyXYZLixaHnytaALtK/0ygCGoCw4uZruGPCVVs8vOB1rncWiE 8kTJpPS8VJ4gbWl6RhSScPReTUe7y2IHObCPNOSM4cIO9oPL+kLyp5cE3euFZCtTJ7Tk7C pVByd0kSIPRgidrLFNY1qNzex8M8NlFPA/FqTBpO9Yhx/hqPkvlJRp4SIanAC6oy8BLSrB NBxysatYUoDvwSnmqaTc3hEe2Ik6KuZ7F0i8ONZe1UvzEBXhXSQOLSZxSIGRWbi4sUD0v6 oxXpvJwIkX4o5rtHAL5YgPqaTy6fGSxbmbbvWq7Ke+8aDY46lzzJVh0ykexZAw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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" X-Migadu-Spam-Score: -3.13 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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" X-Migadu-Queue-Id: A9531B79F X-Spam-Score: -3.13 X-Migadu-Scanner: scn1.migadu.com X-TUID: YheiJD25/gf5 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Maxime Devos skribis: > Ludovic Court=C3=A8s schreef op za 22-01-2022 om 17:48 [+0100]: >> > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (unless keep-lingering? >> > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; exit the se= rver thread >> > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (system-async-= mark (lambda () (throw 'quit)) server)) >>=20 >> When do we need =E2=80=98keep-lingering?=E2=80=99? > > In tests/challenge.scm (call-mismatch-test), due to how the store monad > work, the thunk technically returns (*) before we are done with the > querying the server. Perhaps this can be resolved with sufficient > monadology, but I don't quite see how. > > (*) a monadic value. How about fixing it locally like this: --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/tests/challenge.scm b/tests/challenge.scm index fdd5fd238e..0b44ed7d21 100644 --- a/tests/challenge.scm +++ b/tests/challenge.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright =C2=A9 2015, 2017, 2019, 2020 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2015, 2017, 2019, 2020, 2022 Ludovic Court=C3=A8s ;;; ;;; This file is part of GNU Guix. ;;; @@ -57,6 +57,17 @@ (define-syntax with-derivation-narinfo* (lambda () body ...) hash)))) =20 +(define-syntax-rule (with-http-server* arguments body ...) + ;; Like 'with-http-server' but for use in a monadic context. + (let ((port (%http-server-port))) + (lambda (store) + (values (parameterize ((%http-server-port port)) + (call-with-http-server arguments + (lambda () + (run-with-store store + body ...)))) + store)))) + (test-begin "challenge") =20 @@ -198,11 +209,11 @@ (define (call-mismatch-test proc) (lambda (port) (write-file out2 port))))) (parameterize ((%http-server-port 9000)) - (with-http-server `((200 ,(make-narinfo item size1 hash1)) - (200 ,nar1)) + (with-http-server* `((200 ,(make-narinfo item size1 hash1)) + (200 ,nar1)) (parameterize ((%http-server-port 9001)) - (with-http-server `((200 ,(make-narinfo item size2 hash2)) - (200 ,nar2)) + (with-http-server* `((200 ,(make-narinfo item size2 hash2)) + (200 ,nar2)) (mlet* %store-monad ((urls -> (list (%local-url 9000) (%local-url 9001))) (reports (compare-contents (list item) @@ -238,4 +249,5 @@ (define (call-mismatch-test proc) =20 ;;; Local Variables: ;;; eval: (put 'with-derivation-narinfo* 'scheme-indent-function 2) +;;; eval: (put 'with-http-server* 'scheme-indent-function 1) ;;; End: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable That way we don=E2=80=99t need to keep the lingering variant in (guix tests http). WDYT? Ludo=E2=80=99. --=-=-=--