From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id c4ItESqPYWHk8gAAgWs5BA (envelope-from ) for ; Sat, 09 Oct 2021 14:46:34 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 8NBlCyqPYWGFXwAAB5/wlQ (envelope-from ) for ; Sat, 09 Oct 2021 12:46:34 +0000 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 D57EF1577D for ; Sat, 9 Oct 2021 14:46:33 +0200 (CEST) Received: from localhost ([::1]:49050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mZBkG-0007To-HB for larch@yhetil.org; Sat, 09 Oct 2021 08:46:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mZBjm-0007SL-UG for guix-patches@gnu.org; Sat, 09 Oct 2021 08:46:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:40907) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mZBjm-0002ul-M2 for guix-patches@gnu.org; Sat, 09 Oct 2021 08:46:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mZBjm-0006H0-Ik for guix-patches@gnu.org; Sat, 09 Oct 2021 08:46:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50967] [PATCH 00/12] Move (gnu home-services XYZ) to (gnu services XYZ) Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 09 Oct 2021 12:46:02 +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: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: zimoun , Xinglu Chen , 50967@debbugs.gnu.org, Andrew Tropin Received: via spool by 50967-submit@debbugs.gnu.org id=B50967.163378355924081 (code B ref 50967); Sat, 09 Oct 2021 12:46:02 +0000 Received: (at 50967) by debbugs.gnu.org; 9 Oct 2021 12:45:59 +0000 Received: from localhost ([127.0.0.1]:52446 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mZBjZ-0006G0-Ju for submit@debbugs.gnu.org; Sat, 09 Oct 2021 08:45:59 -0400 Received: from mail-lf1-f52.google.com ([209.85.167.52]:43732) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mZBjV-0006Fh-Oz for 50967@debbugs.gnu.org; Sat, 09 Oct 2021 08:45:49 -0400 Received: by mail-lf1-f52.google.com with SMTP id r19so48706673lfe.10 for <50967@debbugs.gnu.org>; Sat, 09 Oct 2021 05:45:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=mFd/QIOsvyuCcIuEptsC2njtf0IVwJ0GYeDKCl8Mf3M=; b=P9PPnygiIIwi49vbe8tJTL5Yn28BPSdTrLnNxUK2p7+vBpAJXPjo0xcrXNphRCdWD2 0YoiU3LsLonK8hapsXcyLiJmqrzH1HIKtGyZxjSY22hYuvwj+076VIYc8JfO1QHeS+4d M9s+8EkuPdW3RQnfaKxUEhF2U6FYVD6BlxKrHrSKXohQEf4necDBji8cT0Xmi1A2uo2u oyeadBzc2OFtEOtkkW7UkI6ZdKlJcEg1y1zBx9ooKWcvo2pvHcvy5t0454kmusPLUtSa vIaoDl++dufCzWmm1/UhBSP+4WzGItx9KT2q7y7OblwM1xKiPQD2+cZL13bMXqo12blT RcAg== 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:references:date:in-reply-to :message-id:user-agent:mime-version; bh=mFd/QIOsvyuCcIuEptsC2njtf0IVwJ0GYeDKCl8Mf3M=; b=2RrqE53fYk2XDQKKEByhfJfLDHE5V973RuGDvF9dzq6YpPym2X7gEvmEUEkJbyICz8 i5UD3J0wKAHpvagYcxPv7LLIvTL1cwzsjF0NIpHQheNjtOrkgp/DuTdVsv6+eleXrI/Y HmwvfWk6//8vDkQleEQ4HuO+5DGd8PrBlN6t8/obBucWO414d8/giHVd7UrKvoNld9g9 4Rmkkf0GcZG7GvvyBvYSfYmHVrMHiYLO0RvCMTzwAJ8opdrFmO5Dkrpmo2NLWP1aC2MQ zs74bMT2MBK42MqQsMCDdXhCt+MeyNTdHa9YamNK+WG6OZtPEzQw4BRpZr+x2c+eOlOj Pl1w== X-Gm-Message-State: AOAM531BJVQQi62yhRirIYYhOaviFt75qrPYkoyx/73+iw1yR0Ak33au urXHjHEZ4WdFVzfpIQ4tjO8= X-Google-Smtp-Source: ABdhPJw0nSgTTjqVbgdXYLBQicW4KfadQgJ3a3juTvYP7ClpIHZemtlrAVljDlzjS4+qYcEOLDqnvw== X-Received: by 2002:a05:6512:3d29:: with SMTP id d41mr3694843lfv.481.1633783539750; Sat, 09 Oct 2021 05:45:39 -0700 (PDT) Received: from guixsd ([88.201.161.72]) by smtp.gmail.com with ESMTPSA id s8sm203651lfd.149.2021.10.09.05.45.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Oct 2021 05:45:39 -0700 (PDT) From: Oleg Pykhalov References: <87h7dwq4cb.fsf_-_@gnu.org> <20211004231331.5269-1-go.wigust@gmail.com> <20211004231331.5269-3-go.wigust@gmail.com> <878rz54xmy.fsf@gmail.com> <87o87z2kge.fsf_-_@gnu.org> <87k0im74x5.fsf@gmail.com> Date: Sat, 09 Oct 2021 15:45:36 +0300 In-Reply-To: <87k0im74x5.fsf@gmail.com> (Oleg Pykhalov's message of "Sat, 09 Oct 2021 15:34:30 +0300") Message-ID: <87czoe74en.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1633783594; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=mFd/QIOsvyuCcIuEptsC2njtf0IVwJ0GYeDKCl8Mf3M=; b=aSTMkzwdKxSsd6hY33eW3vMeTBfqM2JOGki7YuiskcS2y+FNPmm/sy0VdPoNoMaYmui21R PjUCfR4Op/1SFrR+T1VQmHvkwjMzEiQbtW1WwNtolidd4mzXqZssQDOXl+1FUMXCmzNEAK edQBzIi05UqkJrUFXnBrvjruYUo4XMLreeEslhwwpw6ELJo6yHw+0rgnyihg15efJT5Io2 HdqV7/XLY9rhkqYQcTlY+X53smgVZzumHyjMc3C1rgqVHrGNrJFnfleE7sRU2QoD57LwzO YYDUU95sMLn1NA9Pl027Dgrxw6DsLan3CDUFsH24mbf9uIoc5bScX5ypkLyfRg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1633783594; a=rsa-sha256; cv=none; b=obJK6BvrNPh9xvYFed4J7Kefvgho9FmRLkvpuYlMv5fU7DmkdWL3uQPFbQQ/ZOiqNF48fe 27XflmmtSyPfMwUTI+B7NnZmfDDrfaxGjq7U6vc/bwE1laUzQ+gHFR6OXWDjxXeoC2YfN3 nQ83NQq2maVe+kczLWUUv5LAHLqyjLaxj8xr0Oky/3Nod2A89xjFAa+e3xUAPsSYBYx/eB 3rRTwKGyR5L/N11gpIEgH7q8R0z/MpL8VFgBa7sv5vIxCDAqvHkR2b9jYZ9wqKuw0Lm3DQ sBKMkelPQVNcKg9zCc8ANh8WpjtrrHVkf8RPjODS13KsRfZNfukobE10Zd1F3A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=P9PPnygi; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -1.91 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=P9PPnygi; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: D57EF1577D X-Spam-Score: -1.91 X-Migadu-Scanner: scn0.migadu.com X-TUID: Qlf2qyMne0c1 --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Oleg Pykhalov writes: [=E2=80=A6] > We probably should clean temporary $HOME directory with 'rm -rf' or > delete each file with 'rm' and then invoke 'rmdir' inside a Bash's > 'trap'. I fill worry about removing operations on $HOME directories. > > Alternative is not to remove $HOME by calling some command and just exit > from a namespace, which will remove $HOME mounted as tmpfs after exiting > a process running the guix-home.sh test. Actually, we could just point 'rm -rf' on '$test_directory'. :-) --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-tests-Add-guix-home.sh.patch Content-Transfer-Encoding: quoted-printable Content-Description: tests: Add guix-home.sh. From=206b0378643df42a963c74cb2a304a0bd369f041cf Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov Date: Sat, 9 Oct 2021 14:52:13 +0300 Subject: [PATCH] tests: Add guix-home.sh. * tests/guix-home.sh: New file. * Makefile.am (SH_TESTS): Add this. =2D-- Makefile.am | 1 + tests/guix-home.sh | 106 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 tests/guix-home.sh diff --git a/Makefile.am b/Makefile.am index bb0b5989d2..b341031ec9 100644 =2D-- a/Makefile.am +++ b/Makefile.am @@ -552,6 +552,7 @@ SH_TESTS =3D \ 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..2104edb41a =2D-- /dev/null +++ b/tests/guix-home.sh @@ -0,0 +1,106 @@ + +# GNU Guix --- Functional package management for GNU +# Copyright =C2=A9 2021 Andrew Tropin +# Copyright =C2=A9 2021 Oleg Pykhalov +# +# 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 the 'guix home' using the external store, if any. +# + +set -e + +guix home --version + +NIX_STORE_DIR=3D"$(guile -c '(use-modules (guix config))(display %storedir= )')" +localstatedir=3D"$(guile -c '(use-modules (guix config))(display %localsta= tedir)')" +GUIX_DAEMON_SOCKET=3D"$localstatedir/guix/daemon-socket/socket" +export NIX_STORE_DIR GUIX_DAEMON_SOCKET + +# Run tests only when a "real" daemon is available. +if ! guile -c '(use-modules (guix)) (exit (false-if-exception (open-connec= tion)))' +then + exit 77 +fi + +STORE_PARENT=3D"$(dirname "$NIX_STORE_DIR")" +export STORE_PARENT +if test "$STORE_PARENT" =3D "/"; then exit 77; fi + +test_directory=3D"$(mktemp -d)" +trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT + +( + cd "$test_directory" || exit 77 + + HOME=3D"$test_directory" + export HOME + + # + # Test 'guix home reconfigure'. + # + + cat > "home.scm" <<'EOF' +(use-modules (guix gexp) + (gnu home) + (gnu home-services) + (gnu services)) + +(home-environment + (services + (list + (simple-service 'test-config + home-files-service-type + (list `("config/test.conf" + ,(plain-file + "tmp-file.txt" + "the content of ~/.config/test.conf"))))))) +EOF + + guix home reconfigure "${test_directory}/home.scm" + test -d "${HOME}/.guix-home" + grep -q "the content of ~/.config/test.conf" "${HOME}/.config/test.con= f" + + # + # Test 'guix home describe'. + # + + configuration_file() + { + guix home describe \ + | grep 'configuration file:' \ + | cut -d : -f 2 \ + | xargs echo + } + test "$(cat "$(configuration_file)")" =3D=3D "$(cat home.scm)" + + canonical_file_name() + { + guix home describe \ + | grep 'canonical file name:' \ + | cut -d : -f 2 \ + | xargs echo + } + test "$(canonical_file_name)" =3D=3D "$(readlink "${HOME}/.guix-home")" + + # + # Test 'guix home search'. + # + + guix home search mcron | grep "^name: home-mcron" + guix home search job manager | grep "^name: home-mcron" +) =2D-=20 2.33.0 --=-=-= Content-Type: text/plain Oleg. --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmFhjvAUHGdvLndpZ3Vz dEBnbWFpbC5jb20ACgkQFn+OpQAa+pxhjRAAp8Ziczp2YkY9v3aT1zxhSWkJR3k9 p4lRboOXszQTU5ois0E8gof/dDE83Iy7ZD2/fl8KkHDmw/avzY21eaLwnYpLzh2s 0Ib0GJFdKqN9DLdjKIAOXuT0OocjqfLLwXeXbUL8llGJ0CCIoTOE5lnIzh3BvqvS ubBBiqTIUxHjR/GBWn0cAcce9oinTu93gHpLmLey/t+2oKLwWBxKQLYBDRgEAmfP n1XxWgNChnlj7QVyKwxKefjnPS0R2YLz5tY4jjQRrn9A8eHcyoZxhNDqA81uYdnZ heDFYdXfAOHBiq+hib3aXDQ6joK1IgOKTIomZd4mJBDV7YaZwIZ9srW34fF5Ryvd sSqMBHsuH5HwBMTMXlLd6GAgYYH2ODk4F1fwsBPZNQyLlUcOyWK6A2fAk204ddG4 6eMN1BhOna/NxwoESpGJi1IN1HslawYEU2TiB6Gu1VR1GBimBAiixR9f/RqeNpSy IS/rPTse1TF+wgtQwRMMaePx9h75q2ncBk+f75Oliyzt2DgwMYSqQwDn9BYnWgeQ y7zOkkBfnuasL+fDcn9KlMhaTB8hmJkvZwLAsMApcKWXdbmFv5TNwVPA0oqNxGW4 A/IcAIXlSr0RoSXXggpn04xyL7JDaPpNSSpKOFvijhOtvx6IUV7esJfMZGjMZudI UgJkS8yXizP2jvw= =R6Ys -----END PGP SIGNATURE----- --==-=-=--