#!/bin/sh
# GNU Guix --- Functional package management for GNU
-# Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
#
# This file is part of GNU Guix.
#
# `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
+
if [ -x "@abs_top_builddir@/guix-daemon" ]
then
NIX_SETUID_HELPER="@abs_top_builddir@/nix-setuid-helper" # normally unused
# Currently, in Nix builds, we're at ~106 chars...
NIX_STATE_DIR="@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 "$NIX_STATE_DIR/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.
NIX_CONF_DIR="@GUIX_TEST_ROOT@/etc"
if [ ! -d "$NIX_CONF_DIR" ]
# 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 &
+ "@abs_top_builddir@/guix-daemon" --disable-chroot \
+ --substitute-urls="$GUIX_BINARY_SUBSTITUTE_URL" &
daemon_pid=$!
trap "kill $daemon_pid ; rm -rf $NIX_STATE_DIR" EXIT
LC_MESSAGES=C
export LC_MESSAGES
-# Ignore user modules.
-unset GUIX_PACKAGE_PATH
+# Ignore user settings.
+unset GUIX_PACKAGE_PATH GUIX_BUILD_OPTIONS
storedir="@storedir@"
prefix="@prefix@"