aboutsummaryrefslogtreecommitdiff
path: root/build-aux/test-env.in
blob: 59ab58cc9417cab2abd00151f1c4032f312a3297 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#!/bin/sh

# GNU Guix --- Functional package management for GNU
# Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
#
# 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 <http://www.gnu.org/licenses/>.

# Usage: ./test-env COMMAND ARG...
#
# Run the daemon in the build directory, and run COMMAND within
# `pre-inst-env'.  This is used to run unit tests with the just-built
# daemon, unless `--disable-daemon' was passed at configure time.


# Make sure 'cd' behaves deterministically and doesn't write anything to
# stdout.
unset CDPATH

case "$1" in
    --quiet-stderr)
	# Silence the daemon's output, which is often useless, as well as that
	# of Bash (such as "Terminated" messages when 'guix-daemon' is
	# killed.)
	exec 2> /dev/null
	shift
	;;
esac

if [ -x "@abs_top_builddir@/guix-daemon" ]
then
    NIX_STORE_DIR="@GUIX_TEST_ROOT@/store"

    # Do that because store.scm calls `canonicalize-path' on it.
    mkdir -p "$NIX_STORE_DIR"

    # Canonicalize the store directory name in an attempt to avoid symlinks in
    # it or its parent directories.  See <http://bugs.gnu.org/17935>.
    NIX_STORE_DIR="`cd "@GUIX_TEST_ROOT@/store"; pwd -P`"

    GUIX_LOG_DIRECTORY="@GUIX_TEST_ROOT@/var/log/guix"
    GUIX_DATABASE_DIRECTORY="@GUIX_TEST_ROOT@/db"

    # Choose a PID-dependent name to allow for parallel builds.  Note
    # that the directory name must be chosen so that the socket's file
    # name is less than 108-char long (the size of `sun_path' in glibc).
    # Currently, in Nix builds, we're at ~106 chars...
    GUIX_STATE_DIRECTORY="@GUIX_TEST_ROOT@/var/$$"

    # We can't exit when we reach the limit, because perhaps the test doesn't
    # actually rely on the daemon, but at least warn.
    if test "`echo -n "$GUIX_STATE_DIRECTORY/daemon-socket/socket" | wc -c`" -ge 108
    then
	echo "warning: exceeding socket file name limit; test may fail!" >&2
    fi

    # The configuration directory, for import/export signing keys.
    GUIX_CONFIGURATION_DIRECTORY="@GUIX_TEST_ROOT@/etc"
    if [ ! -d "$GUIX_CONFIGURATION_DIRECTORY" ]
    then
	# Copy the keys so that the secret key has the right permissions (the
	# daemon errors out when this is not the case.)
	mkdir -p "$GUIX_CONFIGURATION_DIRECTORY"
	cp "@abs_top_srcdir@/tests/signing-key.sec"	\
	    "@abs_top_srcdir@/tests/signing-key.pub"	\
	    "$GUIX_CONFIGURATION_DIRECTORY"
	chmod 400 "$GUIX_CONFIGURATION_DIRECTORY/signing-key.sec"
    fi

    # A place to store data of the substituter.
    GUIX_BINARY_SUBSTITUTE_URL="file://$GUIX_STATE_DIRECTORY/substituter-data"
    rm -rf "$GUIX_STATE_DIRECTORY/substituter-data"
    mkdir -p "$GUIX_STATE_DIRECTORY/substituter-data"

    # For a number of tests, we want to allow unsigned narinfos, for
    # simplicity.
    GUIX_ALLOW_UNAUTHENTICATED_SUBSTITUTES=yes

    # Place for the substituter's cache.
    XDG_CACHE_HOME="$GUIX_STATE_DIRECTORY/cache-$$"

    # For the (guix import snix) tests.
    NIXPKGS="@NIXPKGS@"

    export NIX_IGNORE_SYMLINK_STORE NIX_STORE_DIR		\
	GUIX_LOG_DIRECTORY GUIX_STATE_DIRECTORY GUIX_DATABASE_DIRECTORY	\
	GUIX_BINARY_SUBSTITUTE_URL				\
        GUIX_ALLOW_UNAUTHENTICATED_SUBSTITUTES			\
        GUIX_CONFIGURATION_DIRECTORY XDG_CACHE_HOME NIXPKGS

    # Launch the daemon without chroot support because is may be
    # unavailable, for instance if we're not running as root.
    "@abs_top_builddir@/pre-inst-env"				\
	"@abs_top_builddir@/guix-daemon" --disable-chroot	\
	--substitute-urls="$GUIX_BINARY_SUBSTITUTE_URL" &

    daemon_pid=$!
    trap "kill $daemon_pid ; rm -rf $GUIX_STATE_DIRECTORY" EXIT

    # The test suite expects the 'guile-bootstrap' package to be available.
    # Normally the Guile bootstrap tarball is downloaded by a fixed-output
    # derivation but when network access is missing we allow users to drop
    # the tarball in 'gnu/packages/bootstrap/SYSTEM' and "intern" it here.
    bootstrap_directory="@abs_top_builddir@/gnu/packages/bootstrap/@guix_system@"
    if [ -d "$bootstrap_directory" ]
    then
	# Make sure 'guix-daemon' is listening before invoking 'guix
	# download'.
	"@abs_top_builddir@/pre-inst-env" "@GUILE@" -c \
	     '(use-modules (guix))
(let loop ((i 10))
  (catch #t
    (lambda () (open-connection))
    (lambda (key . args)
      (if (zero? i)
          (apply throw key args)
          (begin (usleep 500000) (loop (- i 1)))))))'

	for file in "$bootstrap_directory"/guile-*
	do
	    [ -f "$file" ] &&					\
	    "@abs_top_builddir@/pre-inst-env"			\
		guix download "file://$file" > /dev/null
	done
    fi
fi

# Avoid issues that could stem from l10n, such as language/encoding
# mismatches.
unset LANGUAGE
LC_MESSAGES=C
export LC_MESSAGES

# Disable grafts by default because they can cause things to be built
# regardless of '--dry-run'.
GUIX_BUILD_OPTIONS="--no-grafts"
export GUIX_BUILD_OPTIONS

# Ignore user settings.
unset GUIX_PACKAGE_PATH

storedir="@storedir@"
prefix="@prefix@"
datarootdir="@datarootdir@"
datadir="@datadir@"
localstatedir="@localstatedir@"
export storedir prefix datarootdir datadir localstatedir

"@abs_top_builddir@/pre-inst-env" "$@"
exit $?
t/Makefile.am?id=81a4e76d9e840aa501de1237a807aa140a465b54'>maint: Cater for running `make dist' from a worktree....* Makefile.am (gen-ChangeLog): Check for existance of `.git', rather than it being a directory. (gen-AUTHORS): Likewise. Change-Id: I1b7f8cc147084c1804deb7be9d36e5eeda2599cb Janneke Nieuwenhuizen 2024-03-27Merge branch 'master' into emacs-teamLiliana Marie Prikler 2024-03-22gnu: Add linux-libre 6.8....* gnu/packages/linux.scm (linux-libre-6.8-version, linux-libre-6.8-gnu-revision, deblob-scripts-6.8, linux-libre-6.8-pristine-source, linux-libre-6.8-source, linux-libre-headers-6.8, linux-libre-6.8): New variables. * gnu/packages/aux-files/linux-libre/6.8-arm.conf, gnu/packages/aux-files/linux-libre/6.8-arm64.conf, gnu/packages/aux-files/linux-libre/6.8-i686.conf, gnu/packages/aux-files/linux-libre/6.8-x86.conf: New files. * Makefile.am (AUX_FILES): Add them. Signed-off-by: Leo Famulari <leo@famulari.name> Change-Id: I338eb725e0b991c67e4d98bd1ef0c441d3d8f0c6 Wilko Meyer 2024-03-02Merge branch 'master' into emacs-teamLiliana Marie Prikler 2024-02-24gnu: emacs: Check integrity of native-compiled files....In the previous commit, we've added a patch that potentially messes with how built-in (especially preloaded) Lisp libraries are loaded. Thus, we might want to assert that these files still load fine, as reported when querying the builtin documentation of functions provided by them. * gnu/packages/aux-files/emacs/comp-integrity.el: New file. * gnu/Makefile.am (dist_noinst_DATA): Register it here. * gnu/packages/emacs.scm (emacs-no-x)[#:phases]: Add ‘validate-comp-integrity’. Liliana Marie Prikler 2024-01-22gnu: Remove linux-libre 4.14....* gnu/packages/linux.scm (linux-libre-4.14-version, linux-libre-4.14-gnu-revision, deblob-scripts-4.14, linux-libre-4.14-pristine-source, linux-libre-4.14-source, linux-libre-headers-4.14, linux-libre-4.14, linux-libre-arm-generic-4.14, linux-libre-arm-omap2plus-4.14): Remove variables. * gnu/packages/aux-files/linux-libre/4.14-arm.conf, gnu/packages/aux-files/linux-libre/4.14-i686.conf, gnu/packages/aux-files/linux-libre/4.14-x86_64.conf: Delete files. * Makefile.am (AUX_FILES): Remove aforementioned .conf files. * gnu/tests/base.scm (%test-linux-libre-4.14): Remove variable. Change-Id: I40393b5f46b989848d569c929f1d9c986736553e Wilko Meyer 2024-01-22guix: Add ork1-elf platform....* doc/guix.texi: Document or1k-elf platform. * guix/platforms/or1k.scm (or1k-elf): New variable. * Makefile.am (MODULES): Add guix/platforms/or1k.scm. Change-Id: I3f71a0fa97f1ebd2bbdbf6cd00a93b477a123648 Jean-Pierre De Jesus DIAZ 2024-01-17gnu: Add linux-libre 6.7....* gnu/packages/linux.scm (linux-libre-6.7-version, linux-libre-6.7-gnu-revision, deblob-scripts-6.7, linux-libre-6.7-pristine-source, linux-libre-6.7-source, linux-libre-headers-6.7, linux-libre-6.7): New variables. * gnu/packages/aux-files/linux-libre/6.7-arm.conf, gnu/packages/aux-files/linux-libre/6.7-arm64.conf, gnu/packages/aux-files/linux-libre/6.7-i686.conf, gnu/packages/aux-files/linux-libre/6.7-x86.conf: New files. * Makefile.am (AUX_FILES): Add them. * Makefile.am: Update my copyright header. Change-Id: I88b633933875f64bd2859774419e077d8f36d75b Signed-off-by: Leo Famulari <leo@famulari.name> Wilko Meyer 2023-12-18build-system: Add ‘composer-build-system’....* guix/build-system/composer.scm: New file. * guix/build/composer-build-system.scm: New file. * gnu/packages/aux-files/findclass.php: New file. * Makefile.am: Add them. * doc/guix.texi (Build Systems): Document it. Co-authored-by: Julien Lepiller <julien@lepiller.eu> Signed-off-by: Ludovic Courtès <ludo@gnu.org> Change-Id: Ie6a05b42ff04d3ad774a0a20278a77e4820bb8f6 Nicolas Graves 2023-12-18guix: import: Add composer importer....* guix/import/composer.scm: New file. * guix/scripts/import/composer.scm: New file. * guix/tests/composer.scm: New file. * Makefile.am: Add them. * guix/scripts/import.scm: Add composer importer. * doc/guix.texi (Invoking guix import): Mention it. Change-Id: I44a89b8cc80ef5b4a3cd15e8fbba4a18c1cea0b1 Co-authored-by: Julien Lepiller <julien@lepiller.eu> Co-authored-by: Ludovic Courtès <ludo@gnu.org> Nicolas Graves 2023-12-18Makefile.am: Sort build-system modules alphabetically....* Makefile.am (MODULES): Sort guix/build-system modules alphabetically. Change-Id: I7625f87bda9fa714e6b4b29b6cf055948a859e91 Efraim Flashner 2023-12-18gnu: Register new files....* gnu/local.mk (GNU_SYSTEM_MODULES): Register gnu/packages/elixir-xyz.scm. * Makefile.am (MODULES): Register guix/build-system/mix.scm, guix/build/mix-build-system.scm. Change-Id: I69c8fbaa6b16d658d5f6a43d1d39d680dd28ffe9 Efraim Flashner 2023-07-23gnu: Remove linux-libre 6.5....This kernel series is no longer supported upstream. * gnu/packages/linux.scm (linux-libre-6.5-version, linux-libre-6.5-gnu-revision, deblob-scripts-6.5, linux-libre-6.5-pristine-source, linux-libre-6.5-source, linux-libre-headers-6.5, linux-libre-6.5): Remove variables. * gnu/packages/aux-files/linux-libre/6.5-arm.conf, gnu/packages/aux-files/linux-libre/6.5-arm64.conf, gnu/packages/aux-files/linux-libre/6.5-i686.conf, gnu/packages/aux-files/linux-libre/6.5-x86_64.conf: Delete files. * Makefile.am (AUX_FILES): Remove them. Change-Id: I142c28a82ab4afbdc62f5bfcd69382a4d2a0ea8c Leo Famulari 2023-12-11guix: Add avr platform....* Makefile.am (MODULES): Add avr platform module. * doc/guix.texi: Add documentation for avr platform. * guix/platforms/avr.scm (avr): New variable. Change-Id: I0f425eac61a71390b618e093f5a034ad4205a6f4 Signed-off-by: Efraim Flashner <efraim@flashner.co.il> Jean-Pierre De Jesus DIAZ 2023-07-23gnu: Add linux-libre 6.6.1....* gnu/packages/linux.scm (linux-libre-6.6-version, linux-libre-6.6-gnu-revision, deblob-scripts-6.6, linux-libre-6.6-pristine-source, linux-libre-6.5-source, linux-libre-headers-6.6, linux-libre-6.6): New variables. * gnu/packages/aux-files/linux-libre/6.6-arm.conf, gnu/packages/aux-files/linux-libre/6.6-arm64.conf, gnu/packages/aux-files/linux-libre/6.6-i686.conf, gnu/packages/aux-files/linux-libre/6.6-x86_64.conf: New files. * Makefile.am (AUX_FILES): Add them. Change-Id: I37b2b98b8a2ec745137e92380f34e69082c5e662 Signed-off-by: Leo Famulari <leo@famulari.name> Wilko Meyer 2023-11-08build-system: Add vim-build-system....* guix/build-system/vim.scm, * guix/build/vim-build-system.scm: New modules. * Makefile.am (MODULES): Register new files. * doc/guix.texi: Document it. Co-authored-by: Efraim Flashner <efraim@flashner.co.il> Signed-off-by: Efraim Flashner <efraim@flashner.co.il> Jonathan Scoresby 2023-10-23build: Fix it....* Makefile.am (.git/config): Add missing "\". Change-Id: I0d1435ef33d9e6f2246631fa0eb8cbb617ea8fb5 Clément Lassieur 2023-10-22build: Avoid git config 'include' duplicates....* Makefile.am (.git/config): Invoke git config --replace-all with a value-pattern instead of --add. Change-Id: Id6e19b15d3772105128eb9b48d0f4e039ae3d988 Reported-by: Liliana Marie Prikler <liliana.prikler@gmail.com> Maxim Cournoyer 2023-10-22build: Add a commit-msg hook that embeds Change-Id in commit messages....Partially implements <https://issues.guix.gnu.org/66027>. This will make it possible to track a merged commit back to its original posting on the mailing list, and open the door to new opportunities such as closing fully merged series automatically. * Makefile.am (COMMIT_MSG_MAGIC): New variable. (.git/hooks/commit-msg): New target. * etc/git/commit-msg: New file. * doc/contributing.texi (Configuring Git): Document Change-Id. Series-changes: 3 - Clarify documentation text, as suggested by Simon Change-Id: Ia92fa958eae600fdd4e180bad494c85db8bb4dd6 Reviewed-by: Simon Tournier <zimon.toutoune@gmail.com> Maxim Cournoyer 2023-07-23gnu: Remove linux-libre 6.4....* gnu/packages/linux.scm (linux-libre-6.4-version, linux-libre-6.4-gnu-revision, deblob-scripts-6.4, linux-libre-6.4-pristine-source, linux-libre-6.4-source, linux-libre-headers-6.4, linux-libre-6.4): Remove variables. * gnu/packages/aux-files/linux-libre/6.4-arm.conf, gnu/packages/aux-files/linux-libre/6.4-arm64.conf, gnu/packages/aux-files/linux-libre/6.4-i686.conf, gnu/packages/aux-files/linux-libre/6.4-x86_64.conf: Delete files. * Makefile.am (AUX_FILES): Remove them. Leo Famulari 2023-10-21build-system: Add zig-build-system....* guix/build-system/zig.scm: New file. * guix/build/zig-build-system.scm: New file. * Makefile.am: Add them. * doc/guix.texi: Document it. * etc/snippets/yas/scheme-mode/guix-package (build-system): Add zig-build-system. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Ekaitz Zarraga 2023-07-23gnu: Add linux-libre 6.5....* gnu/packages/linux.scm (linux-libre-6.5-version, linux-libre-6.5-gnu-revision, deblob-scripts-6.5, linux-libre-6.5-pristine-source, linux-libre-6.5-source, linux-libre-headers-6.5, linux-libre-6.5): New variables. * gnu/packages/aux-files/linux-libre/6.5-arm.conf, gnu/packages/aux-files/linux-libre/6.5-arm64.conf, gnu/packages/aux-files/linux-libre/6.5-i686.conf, gnu/packages/aux-files/linux-libre/6.5-x86_64.conf: New files. * Makefile.am (AUX_FILES): Add them. Leo Famulari 2023-09-18maint: Support `guix shell' in Guix's git archive with manifest.scm....* manifest.scm: New file. * Makefile.am (EXTRA_DIST): Add it. * doc/contributing.texi (Building from Git): Mention using it. Janneke Nieuwenhuizen