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 ms5.migadu.com with LMTPS id kC/qGZombGIJ+AAAbAwnHQ (envelope-from ) for ; Fri, 29 Apr 2022 19:55:38 +0200 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 gK0NGpombGK2oQAA9RJhRA (envelope-from ) for ; Fri, 29 Apr 2022 19:55:38 +0200 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 0014B28B78 for ; Fri, 29 Apr 2022 19:55:37 +0200 (CEST) Received: from localhost ([::1]:34938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nkUq8-0005dS-Rb for larch@yhetil.org; Fri, 29 Apr 2022 13:55:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nkUpq-0005X9-45 for gwl-devel@gnu.org; Fri, 29 Apr 2022 13:55:20 -0400 Received: from smtp.polymtl.ca ([132.207.4.11]:53948) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nkUpl-0004kq-0W for gwl-devel@gnu.org; Fri, 29 Apr 2022 13:55:16 -0400 Received: from laura.hitronhub.home (modemcable094.169-200-24.mc.videotron.ca [24.200.169.94]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 23THt2RO030970 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 29 Apr 2022 13:55:09 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 23THt2RO030970 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1651254910; bh=qs5VFK+2ZmuifRb/DAtUKShJHGP8oS7SuLC4fj49VRw=; h=From:To:Cc:Subject:Date:From; b=kQYli0ho87/csOO6GJG8G7zH9cblu/yHe2s3AgulP5oZ5Bp/h4x6prGp+xtfuANAB HZSb6C1KBx8RkDeYHXNXFE+sdwg1kOigpM9sod7oN/aoe79zkEtdNxfcFYuKiW7tBQ 4zBwPSZJ6G95nB5rhoUAT8C7NhvcmaMAGz/zSFJM= From: Olivier Dion To: gwl-devel@gnu.org Cc: Olivier Dion Subject: [PATCH] tests/examples: Add running of workflow examples Date: Fri, 29 Apr 2022 13:55:00 -0400 Message-Id: <20220429175500.17176-1-olivier.dion@polymtl.ca> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (modemcable094.169-200-24.mc.videotron.ca [24.200.169.94]) at Fri, 29 Apr 2022 17:55:02 +0000 Received-SPF: pass client-ip=132.207.4.11; envelope-from=olivier.dion@polymtl.ca; helo=smtp.polymtl.ca X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: gwl-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gwl-devel-bounces+larch=yhetil.org@gnu.org Sender: "gwl-devel" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1651254938; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=qs5VFK+2ZmuifRb/DAtUKShJHGP8oS7SuLC4fj49VRw=; b=An/QtNndufjuw5C3lXNv7vtPOT5JakRZJW77okntOhx7P0sPBxYc4WOLimRnjQ5aYgl8Qg mtImCTtOwj8JGvH89GMHIwZxFDZtsaoNFEQ+UoNxhe7VTWMpkRclRC1o6dv0BXd3ICdnfZ RCg5bzytfwRLUJS35bKSPf7i+ROZGQUTSBpef6kOq4CCPKvrbir58YFSn497UiO4Fd0Xsr z6eWpoc/4SpDExMhKyRfYVQYQpQRWg3s67iCATkt7d5HTsdCgykHsUGpyqm5Y+YN2i768V dMVR8iBmhz8h6Lu/ALD+rF76ANe7alwWREUmsiPX1N5djV4qetvuwFZlE+UAxg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651254938; a=rsa-sha256; cv=none; b=C7V3HnU2uqFzm/0ffcfIcSYwRZ3mNedH4rr7G06Iy0Q8UQeTwk6wtRYvrFpp0ND06BpSIo sFg8N7NtIqYAvVY4Ws4yCcBURlVTAdaWhL5dpN1t5e0naUYTJ+leJcPyMoZ23aorUgdY3r eYatbgzK58fhEX/8S0q1DjhKBSjTSeI6L0mXdnbr6+j6azFozGG/7MxcIgw6nxW51PFplT 7cIcnx2EUNJ8LGTFy0UmuG8Lu9BRGanz/Zl0tD8f77a0Rlu0V35BIWKq4CTYsDWsk17v2v KaJtCixEQBvzkxaroxIAE8lom7Mns7XzD8y26SO6dcJlmn/ADeSAcjypMfUfpg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=polymtl.ca header.s=default header.b=kQYli0ho; dmarc=pass (policy=quarantine) header.from=polymtl.ca; spf=pass (aspmx1.migadu.com: domain of "gwl-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="gwl-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.70 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=polymtl.ca header.s=default header.b=kQYli0ho; dmarc=pass (policy=quarantine) header.from=polymtl.ca; spf=pass (aspmx1.migadu.com: domain of "gwl-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="gwl-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 0014B28B78 X-Spam-Score: -3.70 X-Migadu-Scanner: scn1.migadu.com X-TUID: S8NTCPW1kzFV End to end testing of pre-defined scenarios are a good way to check for regression. Here we introduce testing of some examples available in the documentation. That way, we're sure that new users should be able to run them without problems. Each scenario is a different test and is run in a different temporary directory which get destroyed if the scenario succeeded. --- tests/examples.scm | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/tests/examples.scm b/tests/examples.scm index 6f7a64e..38dac3e 100644 --- a/tests/examples.scm +++ b/tests/examples.scm @@ -30,6 +30,8 @@ (lambda (port) (wisp-reader port (user-module-for-file "test.w")))) +(define top-srcdir (getenv "abs_top_srcdir")) + (test-equal "wisp syntax produces the expected S-expression" '(process haiku (outputs "haiku.txt") @@ -39,8 +41,43 @@ (with-output-to-file (unquote outputs) (lambda () (display "the library book\noverdue?\nslow falling snow")))))) - (call-with-input-file (string-append (getenv "abs_top_srcdir") + (call-with-input-file (string-append top-srcdir "/doc/examples/haiku.w") read-wisp)) +(define-syntax-rule (with-directory-excursion dir body body* ...) + (let ((old-dir (getcwd))) + (dynamic-wind + (lambda () (chdir dir)) + (lambda () body body* ...) + (lambda () (chdir old-dir))))) + +(with-directory-excursion + (string-append top-srcdir "/doc/examples") + + (define (process-success? status) + (= 0 (or (status:exit-val status) + (status:term-sig status)))) + + (define scenarios + (list "extended-example-workflow.w")) + + (for-each (lambda (example) + (test-assert example + (let* ((tmp-dir (mkdtemp + (format #f "gwl-example-~a.XXXXXX" example))) + (abs-example (canonicalize-path example)) + (success? + (with-directory-excursion tmp-dir + (process-success? + (system + (format #f "guix workflow run -fc ~a -l all" + abs-example)))))) + (if success? + (system* "rm" "-rf" tmp-dir) + (format (error-output-port) + "Example directory: ~a\n" tmp-dir)) + success?))) + scenarios)) + (test-end "examples") -- 2.35.1