From patchwork Fri May 31 21:22:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Vollmert X-Patchwork-Id: 14183 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 685DC17069; Fri, 31 May 2019 22:23:11 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id D1D6F17068 for ; Fri, 31 May 2019 22:23:10 +0100 (BST) Received: from localhost ([127.0.0.1]:49308 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hWozW-0002Xx-DN for patchwork@mira.cbaines.net; Fri, 31 May 2019 17:23:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hWozT-0002Xl-BD for guix-patches@gnu.org; Fri, 31 May 2019 17:23:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hWozR-0006pv-9t for guix-patches@gnu.org; Fri, 31 May 2019 17:23:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51154) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hWozO-0006nw-P8 for guix-patches@gnu.org; Fri, 31 May 2019 17:23:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hWozO-0008FV-L3 for guix-patches@gnu.org; Fri, 31 May 2019 17:23:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#35929] [PATCH 1/3] tests: hackage: Factor out package pattern. References: <20190527194556.59710-1-rob@vllmrt.net> In-Reply-To: <20190527194556.59710-1-rob@vllmrt.net> Resent-From: Robert Vollmert Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 31 May 2019 21:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35929 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 35929@debbugs.gnu.org Received: via spool by 35929-submit@debbugs.gnu.org id=B35929.155933777931676 (code B ref 35929); Fri, 31 May 2019 21:23:02 +0000 Received: (at 35929) by debbugs.gnu.org; 31 May 2019 21:22:59 +0000 Received: from localhost ([127.0.0.1]:36463 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hWozL-0008Ej-4Q for submit@debbugs.gnu.org; Fri, 31 May 2019 17:22:59 -0400 Received: from mx1.mailbox.org ([80.241.60.212]:27286) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hWozJ-0008EK-FB for 35929@debbugs.gnu.org; Fri, 31 May 2019 17:22:58 -0400 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id DA9EB4EE83; Fri, 31 May 2019 23:22:51 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id tfi1oV2PqEwB; Fri, 31 May 2019 23:22:46 +0200 (CEST) From: Robert Vollmert Date: Fri, 31 May 2019 23:22:41 +0200 Message-Id: <20190531212243.58302-1-rob@vllmrt.net> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robert Vollmert Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * tests/hackage.scm: Import result pattern matching via helper. --- tests/hackage.scm | 133 +++++++++++++++++++++++----------------------- 1 file changed, 66 insertions(+), 67 deletions(-) diff --git a/tests/hackage.scm b/tests/hackage.scm index 0efad0638d..41e3b2dcd3 100644 --- a/tests/hackage.scm +++ b/tests/hackage.scm @@ -155,93 +155,92 @@ library (test-begin "hackage") -(define* (eval-test-with-cabal test-cabal #:key (cabal-environment '())) +(define-syntax-rule (define-package-matcher name pattern) + (define* (name obj) + (match obj + (pattern #t) + (x (pk 'fail x #f))))) + +(define-package-matcher match-ghc-foo + ('package + ('name "ghc-foo") + ('version "1.0.0") + ('source + ('origin + ('method 'url-fetch) + ('uri ('string-append + "https://hackage.haskell.org/package/foo/foo-" + 'version + ".tar.gz")) + ('sha256 + ('base32 + (? string? hash))))) + ('build-system 'haskell-build-system) + ('inputs + ('quasiquote + (("ghc-http" ('unquote 'ghc-http)) + ("ghc-mtl" ('unquote 'ghc-mtl))))) + ('home-page "http://test.org") + ('synopsis (? string?)) + ('description (? string?)) + ('license 'bsd-3))) + +(define* (eval-test-with-cabal test-cabal matcher #:key (cabal-environment '())) (mock ((guix import hackage) hackage-fetch (lambda (name-version) (call-with-input-string test-cabal read-cabal))) - (match (hackage->guix-package "foo" #:cabal-environment cabal-environment) - (('package - ('name "ghc-foo") - ('version "1.0.0") - ('source - ('origin - ('method 'url-fetch) - ('uri ('string-append - "https://hackage.haskell.org/package/foo/foo-" - 'version - ".tar.gz")) - ('sha256 - ('base32 - (? string? hash))))) - ('build-system 'haskell-build-system) - ('inputs - ('quasiquote - (("ghc-http" ('unquote 'ghc-http)) - ("ghc-mtl" ('unquote 'ghc-mtl))))) - ('home-page "http://test.org") - ('synopsis (? string?)) - ('description (? string?)) - ('license 'bsd-3)) - #t) - (x - (pk 'fail x #f))))) + (matcher (hackage->guix-package "foo" #:cabal-environment cabal-environment)))) (test-assert "hackage->guix-package test 1" - (eval-test-with-cabal test-cabal-1)) + (eval-test-with-cabal test-cabal-1 match-ghc-foo)) (test-assert "hackage->guix-package test 2" - (eval-test-with-cabal test-cabal-2)) + (eval-test-with-cabal test-cabal-2 match-ghc-foo)) (test-assert "hackage->guix-package test 3" - (eval-test-with-cabal test-cabal-3 + (eval-test-with-cabal test-cabal-3 match-ghc-foo #:cabal-environment '(("impl" . "ghc-7.8")))) (test-assert "hackage->guix-package test 4" - (eval-test-with-cabal test-cabal-4 + (eval-test-with-cabal test-cabal-4 match-ghc-foo #:cabal-environment '(("impl" . "ghc-7.8")))) (test-assert "hackage->guix-package test 5" - (eval-test-with-cabal test-cabal-5 + (eval-test-with-cabal test-cabal-5 match-ghc-foo #:cabal-environment '(("impl" . "ghc-7.8")))) +(define-package-matcher match-ghc-foo-6 + ('package + ('name "ghc-foo") + ('version "1.0.0") + ('source + ('origin + ('method 'url-fetch) + ('uri ('string-append + "https://hackage.haskell.org/package/foo/foo-" + 'version + ".tar.gz")) + ('sha256 + ('base32 + (? string? hash))))) + ('build-system 'haskell-build-system) + ('inputs + ('quasiquote + (("ghc-b" ('unquote 'ghc-b)) + ("ghc-http" ('unquote 'ghc-http)) + ("ghc-mtl" ('unquote 'ghc-mtl))))) + ('native-inputs + ('quasiquote + (("ghc-haskell-gi" ('unquote 'ghc-haskell-gi))))) + ('home-page "http://test.org") + ('synopsis (? string?)) + ('description (? string?)) + ('license 'bsd-3))) + (test-assert "hackage->guix-package test 6" - (mock - ((guix import hackage) hackage-fetch - (lambda (name-version) - (call-with-input-string test-cabal-6 - read-cabal))) - (match (hackage->guix-package "foo") - (('package - ('name "ghc-foo") - ('version "1.0.0") - ('source - ('origin - ('method 'url-fetch) - ('uri ('string-append - "https://hackage.haskell.org/package/foo/foo-" - 'version - ".tar.gz")) - ('sha256 - ('base32 - (? string? hash))))) - ('build-system 'haskell-build-system) - ('inputs - ('quasiquote - (("ghc-b" ('unquote 'ghc-b)) - ("ghc-http" ('unquote 'ghc-http)) - ("ghc-mtl" ('unquote 'ghc-mtl))))) - ('native-inputs - ('quasiquote - (("ghc-haskell-gi" ('unquote 'ghc-haskell-gi))))) - ('home-page "http://test.org") - ('synopsis (? string?)) - ('description (? string?)) - ('license 'bsd-3)) - #t) - (x - (pk 'fail x #f))))) + (eval-test-with-cabal test-cabal-6 match-ghc-foo-6)) (test-assert "read-cabal test 1" (match (call-with-input-string test-read-cabal-1 read-cabal) From patchwork Fri May 31 21:22:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Vollmert X-Patchwork-Id: 14184 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 69B591706A; Fri, 31 May 2019 22:40:12 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 2DD0D17068 for ; Fri, 31 May 2019 22:40:12 +0100 (BST) Received: from localhost ([127.0.0.1]:49471 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hWpFz-0004s8-QU for patchwork@mira.cbaines.net; Fri, 31 May 2019 17:40:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35717) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hWpFS-0004Jp-Ve for guix-patches@gnu.org; Fri, 31 May 2019 17:39:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hWp0M-0007aO-N0 for guix-patches@gnu.org; Fri, 31 May 2019 17:24:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51161) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hWp0M-0007aC-Jh for guix-patches@gnu.org; Fri, 31 May 2019 17:24:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hWp0M-0008I7-FE for guix-patches@gnu.org; Fri, 31 May 2019 17:24:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#35929] [PATCH 2/3] tests: hackage: Don't mock hackage-fetch. Resent-From: Robert Vollmert Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 31 May 2019 21:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35929 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 35929@debbugs.gnu.org Received: via spool by 35929-submit@debbugs.gnu.org id=B35929.155933778531764 (code B ref 35929); Fri, 31 May 2019 21:24:02 +0000 Received: (at 35929) by debbugs.gnu.org; 31 May 2019 21:23:05 +0000 Received: from localhost ([127.0.0.1]:36471 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hWozQ-0008GB-L3 for submit@debbugs.gnu.org; Fri, 31 May 2019 17:23:04 -0400 Received: from mx2.mailbox.org ([80.241.60.215]:30258) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hWozN-0008ET-7O for 35929@debbugs.gnu.org; Fri, 31 May 2019 17:23:01 -0400 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 5E649A0AB0; Fri, 31 May 2019 23:22:55 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter05.heinlein-hosting.de (spamfilter05.heinlein-hosting.de [80.241.56.123]) (amavisd-new, port 10030) with ESMTP id Bgv9g8gEzOBM; Fri, 31 May 2019 23:22:48 +0200 (CEST) From: Robert Vollmert Date: Fri, 31 May 2019 23:22:42 +0200 Message-Id: <20190531212243.58302-2-rob@vllmrt.net> In-Reply-To: <20190531212243.58302-1-rob@vllmrt.net> References: <20190531212243.58302-1-rob@vllmrt.net> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robert Vollmert Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * tests/hackage.scm: Pass a string input port to tests instead of mocking hackage download. --- tests/hackage.scm | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/hackage.scm b/tests/hackage.scm index 41e3b2dcd3..1b4800164e 100644 --- a/tests/hackage.scm +++ b/tests/hackage.scm @@ -186,12 +186,8 @@ library ('license 'bsd-3))) (define* (eval-test-with-cabal test-cabal matcher #:key (cabal-environment '())) - (mock - ((guix import hackage) hackage-fetch - (lambda (name-version) - (call-with-input-string test-cabal - read-cabal))) - (matcher (hackage->guix-package "foo" #:cabal-environment cabal-environment)))) + (define port (open-input-string test-cabal)) + (matcher (hackage->guix-package "foo" #:port port #:cabal-environment cabal-environment))) (test-assert "hackage->guix-package test 1" (eval-test-with-cabal test-cabal-1 match-ghc-foo)) From patchwork Fri May 31 21:22:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Vollmert X-Patchwork-Id: 14182 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 17C701706A; Fri, 31 May 2019 22:23:11 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id BB86517065 for ; Fri, 31 May 2019 22:23:10 +0100 (BST) Received: from localhost ([127.0.0.1]:49306 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hWozW-0002Xw-B8 for patchwork@mira.cbaines.net; Fri, 31 May 2019 17:23:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33975) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hWozT-0002Xk-BM for guix-patches@gnu.org; Fri, 31 May 2019 17:23:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hWozR-0006pp-9p for guix-patches@gnu.org; Fri, 31 May 2019 17:23:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51153) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hWozO-0006nk-DZ for guix-patches@gnu.org; Fri, 31 May 2019 17:23:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hWozO-0008FO-6G for guix-patches@gnu.org; Fri, 31 May 2019 17:23:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#35929] [PATCH 3/3] tests: Indent hackage tests Resent-From: Robert Vollmert Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 31 May 2019 21:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35929 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 35929@debbugs.gnu.org Received: via spool by 35929-submit@debbugs.gnu.org id=B35929.155933777931668 (code B ref 35929); Fri, 31 May 2019 21:23:02 +0000 Received: (at 35929) by debbugs.gnu.org; 31 May 2019 21:22:59 +0000 Received: from localhost ([127.0.0.1]:36461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hWozK-0008Eh-Qy for submit@debbugs.gnu.org; Fri, 31 May 2019 17:22:59 -0400 Received: from mx1.mailbox.org ([80.241.60.212]:27190) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hWozI-0008EF-QA for 35929@debbugs.gnu.org; Fri, 31 May 2019 17:22:57 -0400 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 5114E50360; Fri, 31 May 2019 23:22:50 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter06.heinlein-hosting.de (spamfilter06.heinlein-hosting.de [80.241.56.125]) (amavisd-new, port 10030) with ESMTP id CfEif-vWgTrm; Fri, 31 May 2019 23:22:49 +0200 (CEST) From: Robert Vollmert Date: Fri, 31 May 2019 23:22:43 +0200 Message-Id: <20190531212243.58302-3-rob@vllmrt.net> In-Reply-To: <20190531212243.58302-1-rob@vllmrt.net> References: <20190531212243.58302-1-rob@vllmrt.net> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robert Vollmert Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * tests/hackage.scm: Reindent using etc/indent-code.el. --- tests/hackage.scm | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/hackage.scm b/tests/hackage.scm index 1b4800164e..e5f3d6caed 100644 --- a/tests/hackage.scm +++ b/tests/hackage.scm @@ -242,19 +242,19 @@ library (match (call-with-input-string test-read-cabal-1 read-cabal) ((("name" ("test-me")) ('section 'library - (('if ('flag "base4point8") - (("build-depends" ("base >= 4.8 && < 5"))) - (('if ('flag "base4") - (("build-depends" ("base >= 4 && < 4.8"))) - (('if ('flag "base3") - (("build-depends" ("base >= 3 && < 4"))) - (("build-depends" ("base < 3")))))))) - ('if ('or ('flag "base4point8") - ('and ('flag "base4") ('flag "base3"))) - (("build-depends" ("random"))) - ()) - ("build-depends" ("containers")) - ("exposed-modules" ("Test.QuickCheck.Exception"))))) + (('if ('flag "base4point8") + (("build-depends" ("base >= 4.8 && < 5"))) + (('if ('flag "base4") + (("build-depends" ("base >= 4 && < 4.8"))) + (('if ('flag "base3") + (("build-depends" ("base >= 3 && < 4"))) + (("build-depends" ("base < 3")))))))) + ('if ('or ('flag "base4point8") + ('and ('flag "base4") ('flag "base3"))) + (("build-depends" ("random"))) + ()) + ("build-depends" ("containers")) + ("exposed-modules" ("Test.QuickCheck.Exception"))))) #t) (x (pk 'fail x #f))))