From patchwork Mon Jan 24 18:15:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liliana Marie Prikler X-Patchwork-Id: 36788 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 8BF6A27BBEA; Mon, 24 Jan 2022 18:37:47 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 24B1C27BBE9 for ; Mon, 24 Jan 2022 18:37:47 +0000 (GMT) Received: from localhost ([::1]:52952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nC4Dq-0007tW-4N for patchwork@mira.cbaines.net; Mon, 24 Jan 2022 13:37:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nC3uk-0005IN-FQ for guix-patches@gnu.org; Mon, 24 Jan 2022 13:18:07 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:52865) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nC3uk-0000QB-57 for guix-patches@gnu.org; Mon, 24 Jan 2022 13:18:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nC3uk-0003jy-2M for guix-patches@gnu.org; Mon, 24 Jan 2022 13:18:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53510] [PATCH] tests: Assert that cyclic graphs can be produced. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 24 Jan 2022 18:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 53510 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53510@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.164304824913707 (code B ref -1); Mon, 24 Jan 2022 18:18:01 +0000 Received: (at submit) by debbugs.gnu.org; 24 Jan 2022 18:17:29 +0000 Received: from localhost ([127.0.0.1]:45768 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nC3uD-0003Ym-AC for submit@debbugs.gnu.org; Mon, 24 Jan 2022 13:17:29 -0500 Received: from lists.gnu.org ([209.51.188.17]:41488) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nC3uB-0003XS-PC for submit@debbugs.gnu.org; Mon, 24 Jan 2022 13:17:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nC3uB-0004cL-J7 for guix-patches@gnu.org; Mon, 24 Jan 2022 13:17:27 -0500 Received: from [2a00:1450:4864:20::444] (port=41892 helo=mail-wr1-x444.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nC3uA-0000Ja-2H for guix-patches@gnu.org; Mon, 24 Jan 2022 13:17:27 -0500 Received: by mail-wr1-x444.google.com with SMTP id r22so7576848wra.8 for ; Mon, 24 Jan 2022 10:17:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:date:subject:to:content-transfer-encoding:message-id :mime-version; bh=RhZQyjvX95vK9zDm04cIsVRkadxdIZsjlYve6RJ0AHY=; b=Lvbez/sAxq010xwbx6HZhOkTbND4pJBycZ/bxZxcFG/2elpBxFGYPOvRGQLACV3fps EOQfPXb3D/nUNCo9wSqiShSZGApnMho0tHnWMEaJkVpPwUcjbaJ3uq1yVXDLPdsC7RB5 Tp13nzBZeleBqWadU9SRYyr+7keWujw6jcpnWMXihYcB5X3BEpWfhChMk69xgqLjwv3b YJjgWOEyju7Nm7lqbHBqy3hFkYqLwkPmGzJf8kT0CDAqFlX4kV9ET8Bz8kvhAOnfZEpS 3bd2X/HS5+rqsMz1lW5IdE24WDPMEhiIvzwTqoQq9jNC7nRafHVurvMkF74+M3LX4gAk FViA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:date:subject:to:content-transfer-encoding :message-id:mime-version; bh=RhZQyjvX95vK9zDm04cIsVRkadxdIZsjlYve6RJ0AHY=; b=ehyWpkvWgjefJc32wiwSc2JaHaSqFL+0KMIo/KZ0s9EIyhqcqsbsPsexbgCw+T4JqV +wbS8pBGhCG14GsfxN/AQHDJuYhJ+1ddSKtCjR4opcdLnrI0HIcR9F1Se1NumU2UVBdy ZAhDWaepiFKwko7nBwl1uZG2E5l0hAAFCqxU7rASa3/f0Z/45D8NOBXTJmp3iV6KCu60 9HQkc955EtBkyByw/LLQfmEKLiwFVa1xwnO/xwoj/npEX2iuiShrweOm7dTp07c6+M04 tT5fRv3BPktKV7Dy3TYqapBcEq9jlvqYy7nG3RRCrAZV5MPXEnXx47aINlZPJOWGJziy Oh6Q== X-Gm-Message-State: AOAM533tQUyVuO38E+GVyPPsrJ799p3lsSjddJ1+90SZIy0ikYj/mtKe /duGpUVuo/u9/iBJoc8iUsrFRxRC5Io= X-Google-Smtp-Source: ABdhPJzi5q1OrQ//IkJAWwj6REfXVgpiSUJ4V07qMjUWkvEZxB3YeYi0+lBl0xH3K8MXNtiBYWubnw== X-Received: by 2002:a5d:6486:: with SMTP id o6mr15033467wri.609.1643048244283; Mon, 24 Jan 2022 10:17:24 -0800 (PST) Received: from nijino.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id 16sm54031wmj.12.2022.01.24.10.17.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jan 2022 10:17:23 -0800 (PST) From: Liliana Marie Prikler Date: Mon, 24 Jan 2022 19:15:44 +0100 Message-ID: <9649435159ca9f35c55ae66e577f520da50f5f8d.camel@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::444 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::444; envelope-from=liliana.prikler@gmail.com; helo=mail-wr1-x444.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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/graph.scm ("package DAG, oops it was a cycle"): New test. --- tests/graph.scm | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/graph.scm b/tests/graph.scm index fadac265f9..baa08a6be2 100644 --- a/tests/graph.scm +++ b/tests/graph.scm @@ -36,6 +36,7 @@ (define-module (test-graph) #:use-module (gnu packages libunistring) #:use-module (gnu packages bootstrap) #:use-module (ice-9 match) + #:use-module (ice-9 sandbox) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) @@ -113,6 +114,33 @@ (define (edge->tuple source target) (list p4 p4) (list p2 p3)))))))) +(test-assert "package DAG, oops it was a cycle" + (let-values (((backend nodes+edges) (make-recording-backend))) + (letrec ((p1 (dummy-package "p1" (inputs `(("p3" ,p3))))) + (p2 (dummy-package "p2" (inputs `(("p1" ,p1))))) + (p3 (dummy-package "p3" (inputs `(("p2" ,p2) ("p1", p1)))))) + (call-with-time-limit + 600 ;; If ever this test should fail, we still want it to terminate + (lambda () + (run-with-store %store + (export-graph (list p3) 'port + #:node-type %package-node-type + #:backend backend))) + (lambda () + (run-with-store %store + (export-graph + (list (dummy-package "timeout-reached")) + 'port + #:node-type %package-node-type + #:backend backend)))) + ;; We should see nothing more than these 3 packages. + (let-values (((nodes edges) (nodes+edges))) + (and (equal? nodes (map package->tuple (list p3 p2 p1))) + (equal? edges + (map edge->tuple + (list p3 p3 p2 p1) + (list p2 p1 p1 p3)))))))) + (test-assert "reverse package DAG" (let-values (((backend nodes+edges) (make-recording-backend))) (run-with-store %store