From patchwork Sat Oct 2 16:38:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Oleg Pykhalov X-Patchwork-Id: 33570 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 2F07627BBE1; Sat, 2 Oct 2021 17:40:19 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,T_DKIM_INVALID,URIBL_BLOCKED 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 1B14127BBE3 for ; Sat, 2 Oct 2021 17:40:18 +0100 (BST) Received: from localhost ([::1]:46122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWi3c-000275-UR for patchwork@mira.cbaines.net; Sat, 02 Oct 2021 12:40:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37288) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWi3O-00026F-AZ for guix-patches@gnu.org; Sat, 02 Oct 2021 12:40:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48896) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWi3O-0002vx-2Q for guix-patches@gnu.org; Sat, 02 Oct 2021 12:40:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mWi3N-0008JT-TH for guix-patches@gnu.org; Sat, 02 Oct 2021 12:40:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50967] [PATCH 01/14] tests: Add tests for guix home cli. References: <20211002134352.5735-1-go.wigust@gmail.com> In-Reply-To: <20211002134352.5735-1-go.wigust@gmail.com> Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 02 Oct 2021 16:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50967 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50967@debbugs.gnu.org Cc: Oleg Pykhalov , Andrew Tropin Received: via spool by 50967-submit@debbugs.gnu.org id=B50967.163319274731789 (code B ref 50967); Sat, 02 Oct 2021 16:40:01 +0000 Received: (at 50967) by debbugs.gnu.org; 2 Oct 2021 16:39:07 +0000 Received: from localhost ([127.0.0.1]:60406 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mWi2L-0008FI-Pj for submit@debbugs.gnu.org; Sat, 02 Oct 2021 12:39:06 -0400 Received: from mail-lf1-f53.google.com ([209.85.167.53]:34343) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mWi2J-0008Eg-O0 for 50967@debbugs.gnu.org; Sat, 02 Oct 2021 12:38:56 -0400 Received: by mail-lf1-f53.google.com with SMTP id g41so51433442lfv.1 for <50967@debbugs.gnu.org>; Sat, 02 Oct 2021 09:38:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UkdCoo77p/t5vQjaQv+R/Tz/mjqWKuFuIBNUJn+AnCU=; b=FeRdMgBbqUxQOV5Y9FiLAvnOMrsSlcsbUfY98apaK7GtVtIy/5VLIOshyk7yiIjWKc OWaFjr68D4bL7JX/YAfnz84JU0Goo3xfFJ1bFZtZ+TqbszQmJYYw8ru5DeoPkOSQrryn dEXlAjOuOcEkxwX8Jg4itEf9S6p7mStHoQh0tB4uS94PflViA+wKqz0M2PD4tXCSDn1E 4nxSzxJGOx4BJS2LDFLCnlskdUUDWJFf7xWfItPqmXb/Nx8PSrqNTWbYvkHI0W2VRbA/ 4FdsEDXCmltE00yJC4MyblvS5MP2FO721ZhgL9Pvdhv9/IU+k+1TN4oWZqHk58C0Tpqi vWZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UkdCoo77p/t5vQjaQv+R/Tz/mjqWKuFuIBNUJn+AnCU=; b=BblOBYtKrHTze4CXbzqM319bctIsgk6DE/uRAkarvIfH0yUzeizWJ8gPNXSHpRLwaq PARcD/evf2FH8zBWTcTV9/gSE4DeWUDg1B392nFYyBx/71pxDJ2An3BJxQlobykib1Cv fb2xoAlcq9xmOtL+8s7bMOmAZR+MJzYiLpCD9lDO1/qWf7I00BUoo0xcWzJ5acFl6cv3 6Qr65hTDKQ6wYRe9rZ0V0GwcbeZ0Y25jKjt/kXaTa0AS2e/Eoi0Xf5f/ZfReeg09GZcn 6Hf7Jrsq/Vsbk18jWeeIN3pUUokG+7OLfUUex348U3KmV13K8/uB0EQEkm0SdLZFculR 8H+Q== X-Gm-Message-State: AOAM533GyV7tbgd9+TBuxt9vMKVnGI4QYTMZ4BL323rGUVEa1hh2Lo6J XKASs8Pr5sHe3ExpqCQ0dCtorSQPgso= X-Google-Smtp-Source: ABdhPJyOM2UsL5hMcdoBe7fJWWmR2k6Vyy1dpxp5OTpAobB8x4C7p1W0qrdoC2NjJnYSmAiFmyG/6A== X-Received: by 2002:a2e:7311:: with SMTP id o17mr4460034ljc.267.1633192729735; Sat, 02 Oct 2021 09:38:49 -0700 (PDT) Received: from localhost.localdomain ([88.201.161.72]) by smtp.gmail.com with ESMTPSA id h11sm1081487lfc.297.2021.10.02.09.38.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 09:38:49 -0700 (PDT) From: Oleg Pykhalov Date: Sat, 2 Oct 2021 19:38:21 +0300 Message-Id: <20211002163834.29583-1-go.wigust@gmail.com> X-Mailer: git-send-email 2.33.0 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 From: Andrew Tropin * tests/guix-home.sh: New file. * Makefile.am (SH_TESTS): Add tests/guix-home.sh. Signed-off-by: Oleg Pykhalov --- Makefile.am | 1 + tests/guix-home.sh | 99 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 tests/guix-home.sh diff --git a/Makefile.am b/Makefile.am index b66789fa0b..5bf2567dc8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -546,6 +546,7 @@ SH_TESTS = \ tests/guix-package-aliases.sh \ tests/guix-package-net.sh \ tests/guix-system.sh \ + tests/guix-home.sh \ tests/guix-archive.sh \ tests/guix-authenticate.sh \ tests/guix-environment.sh \ diff --git a/tests/guix-home.sh b/tests/guix-home.sh new file mode 100644 index 0000000000..cb015c907f --- /dev/null +++ b/tests/guix-home.sh @@ -0,0 +1,99 @@ +# GNU Guix --- Functional package management for GNU +# Copyright © 2021 Andrew Tropin +# +# This file is part of GNU Guix. +# +# GNU Guix is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or (at +# your option) any later version. +# +# GNU Guix is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Guix. If not, see . + +# +# Test 'guix home' cli. +# + +set -e + +guix home --version + +tmpfile="t-guix-home-$$" +errorfile="t-guix-home-error-$$" + +# Note: This directory is chosen outside $builddir so that relative file name +# canonicalization doesn't mess up with 'current-source-directory', used by +# 'local-file' ('load' forces 'relative' for +# %FILE-PORT-NAME-CANONICALIZATION.) +tmpdir="${TMPDIR:-/tmp}/t-guix-home-$$" +mkdir "$tmpdir" + +trap 'rm -f "$tmpfile" "$errorfile" "$tmpdir"/*; rmdir "$tmpdir"' EXIT + +# Reporting of syntax errors. + +cat > "$tmpfile"< "$errorfile" +then + # This must not succeed. + exit 1 +else + grep "$tmpfile:3:4: error: (packages): invalid field specifier" "$errorfile" +fi + + +cat > "$tmpfile"< "$errorfile" +then + # This must not succeed. + exit 1 +else + # Guile 3.0.6 gets line/column numbers for 'read-error' wrong + # (zero-indexed): . + grep "$tmpfile:4:1: missing closing paren" "$errorfile" || \ + grep "$tmpfile:3:0: missing closing paren" "$errorfile" +fi + +# Reporting of duplicate system service declaration. + +cat > "$tmpfile" < "$errorfile" +then + # This must not succeed. + exit 1 +else + grep "guix home: error: more than one target service of type 'home-shepherd'" "$errorfile" +fi + +# Searching. + +guix home search mcron | grep "^name: home-mcron" +guix home search job manager | grep "^name: home-mcron"