From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 09 08:45:59 2021 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 To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#50967] [PATCH 00/12] Move (gnu home-services XYZ) to (gnu services XYZ) 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-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50967 Cc: zimoun , Xinglu Chen , 50967@debbugs.gnu.org, Andrew Tropin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --==-=-= 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----- --==-=-=--