From patchwork Tue Dec 15 09:57:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 25796 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9966827BC05; Tue, 15 Dec 2020 09:59:25 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 4735127BC04 for ; Tue, 15 Dec 2020 09:59:25 +0000 (GMT) Received: from localhost ([::1]:54358 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kp776-0000eI-GP for patchwork@mira.cbaines.net; Tue, 15 Dec 2020 04:59:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kp75o-0007ih-Aj for guix-patches@gnu.org; Tue, 15 Dec 2020 04:58:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:44135) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kp75o-0004YV-27 for guix-patches@gnu.org; Tue, 15 Dec 2020 04:58:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kp75n-0007Bm-W3 for guix-patches@gnu.org; Tue, 15 Dec 2020 04:58:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#45253] [PATCH 5/6] tests: Make sure substituted items are deduplicated. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 15 Dec 2020 09:58:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45253 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 45253@debbugs.gnu.org Received: via spool by 45253-submit@debbugs.gnu.org id=B45253.160802626927577 (code B ref 45253); Tue, 15 Dec 2020 09:58:03 +0000 Received: (at 45253) by debbugs.gnu.org; 15 Dec 2020 09:57:49 +0000 Received: from localhost ([127.0.0.1]:55675 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kp75Z-0007Ae-0W for submit@debbugs.gnu.org; Tue, 15 Dec 2020 04:57:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42670) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kp75W-00079b-Dv for 45253@debbugs.gnu.org; Tue, 15 Dec 2020 04:57:46 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:48640) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kp75R-0004RM-27; Tue, 15 Dec 2020 04:57:41 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=44330 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kp75Q-0001j8-9t; Tue, 15 Dec 2020 04:57:40 -0500 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Tue, 15 Dec 2020 10:57:29 +0100 Message-Id: <20201215095730.10954-5-ludo@gnu.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201215095730.10954-1-ludo@gnu.org> References: <20201215095730.10954-1-ludo@gnu.org> MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * tests/store.scm ("substitute, deduplication"): New test. --- tests/store.scm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/store.scm b/tests/store.scm index 4dc125bcb9..c9a08ac690 100644 --- a/tests/store.scm +++ b/tests/store.scm @@ -718,6 +718,30 @@ (canonical-file? o) (equal? c (call-with-input-file o get-string-all))))))) +(test-assert "substitute, deduplication" + (with-store s + (let* ((c (random-text)) ; contents of the output + (g (package-derivation s %bootstrap-guile)) + (d1 (build-expression->derivation s "substitute-me" + `(begin ,c (exit 1)) + #:guile-for-build g)) + (d2 (build-expression->derivation s "build-me" + `(call-with-output-file %output + (lambda (p) + (display ,c p))) + #:guile-for-build g)) + (o1 (derivation->output-path d1)) + (o2 (derivation->output-path d2))) + (with-derivation-substitute d1 c + (set-build-options s #:use-substitutes? #t + #:substitute-urls (%test-substitute-urls)) + (and (has-substitutes? s o1) + (build-derivations s (list d2)) ;build + (build-derivations s (list d1)) ;substitute + (canonical-file? o1) + (equal? c (call-with-input-file o1 get-string-all)) + (= (stat:ino (stat o1)) (stat:ino (stat o2)))))))) + (test-assert "substitute + build-things with output path" (with-store s (let* ((c (random-text)) ;contents of the output