1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 02:21:16 +02:00

* Really fix the substitute mechanism, i.e., ensure the closure

invariant by registering references through the manifest.
* Added a test for nix-pull.
This commit is contained in:
Eelco Dolstra 2005-01-25 17:08:52 +00:00
parent c6290e42bc
commit 066da4ab85
16 changed files with 255 additions and 89 deletions

View file

@ -8,7 +8,16 @@ TESTS_ENVIRONMENT = TEST_ROOT=$(TEST_ROOT) \
NIX_LOG_DIR=$(TEST_ROOT)/log \
NIX_STATE_DIR=$(TEST_ROOT)/state \
NIX_DB_DIR=$(TEST_ROOT)/db \
NIX_BIN_DIR=$(TEST_ROOT)/bin \
NIX_LIBEXEC_DIR=$(TEST_ROOT)/bin \
NIX_LOCALSTATE_DIR=$(TEST_ROOT)/state \
REAL_BIN_DIR=$(bindir) \
REAL_LIBEXEC_DIR=$(libexecdir) \
REAL_LOCALSTATE_DIR=$(localstatedir) \
REAL_DATA_DIR=$(datadir) \
REAL_STORE_DIR=$(storedir) \
NIX_BUILD_HOOK= \
PERL=$(perl) \
TOP=$(shell pwd)/.. \
SHARED=$(extra1) \
aterm_bin=$(aterm_bin) \
@ -22,9 +31,14 @@ build-hook.sh: build-hook.nix
substitutes.sh: substitutes.nix
substitutes2.sh: substitutes2.nix
fallback.sh: fallback.nix
nix-push.sh: dependencies.nix
nix-pull.sh: dependencies.nix
TESTS = init.sh hash.sh lang.sh simple.sh dependencies.sh locking.sh parallel.sh \
build-hook.sh substitutes.sh substitutes2.sh fallback.sh verify.sh
#TESTS = init.sh hash.sh lang.sh simple.sh dependencies.sh locking.sh parallel.sh \
# build-hook.sh substitutes.sh substitutes2.sh fallback.sh nix-push.sh verify.sh \
# nix-pull.sh
TESTS = init.sh nix-push.sh nix-pull.sh
XFAIL_TESTS =

View file

@ -13,6 +13,36 @@ mkdir "$NIX_LOG_DIR"
mkdir "$NIX_STATE_DIR"
mkdir "$NIX_DB_DIR"
mkdir $NIX_BIN_DIR
ln -s $TOP/src/nix-store/nix-store $NIX_BIN_DIR/
ln -s $TOP/src/nix-instantiate/nix-instantiate $NIX_BIN_DIR/
ln -s $TOP/src/nix-hash/nix-hash $NIX_BIN_DIR/
ln -s $TOP/scripts/nix-prefetch-url $NIX_BIN_DIR/
mkdir $NIX_BIN_DIR/nix
ln -s $TOP/scripts/download-using-manifests.pl $NIX_BIN_DIR/nix/
ln -s $TOP/scripts/readmanifest.pm $NIX_BIN_DIR/nix/
mkdir -p "$NIX_LOCALSTATE_DIR"/nix/manifests
mkdir -p "$NIX_LOCALSTATE_DIR"/log/nix
mkdir $NIX_DATA_DIR/nix
cp -prd $TOP/corepkgs $NIX_DATA_DIR/nix/
# Bah, script has the prefix hard-coded.
for i in $NIX_DATA_DIR/nix/corepkgs/nar/nar.sh \
$NIX_BIN_DIR/nix/download-using-manifests.pl \
$NIX_BIN_DIR/nix-prefetch-url \
; do
echo "$REAL_BIN_DIR"
sed < $i > $i.tmp \
-e "s^$REAL_BIN_DIR^$NIX_BIN_DIR^" \
-e "s^$REAL_LIBEXEC_DIR^$NIX_LIBEXEC_DIR^" \
-e "s^$REAL_LOCALSTATE_DIR^$NIX_LOCALSTATE_DIR^" \
-e "s^$REAL_DATA_DIR^$NIX_DATA_DIR^" \
-e "s^$REAL_STORE_DIR^$NIX_STORE_DIR^"
mv $i.tmp $i
chmod +x $i
done
# Initialise the database.
$TOP/src/nix-store/nix-store --init

33
tests/nix-pull.sh Normal file
View file

@ -0,0 +1,33 @@
clearStore () {
echo "clearing store..."
chmod -R +w "$NIX_STORE_DIR"
rm -rf "$NIX_STORE_DIR"
mkdir "$NIX_STORE_DIR"
rm -rf "$NIX_DB_DIR"
mkdir "$NIX_DB_DIR"
$TOP/src/nix-store/nix-store --init
}
pullCache () {
echo "pulling cache..."
$PERL -w -I$TOP/scripts $TOP/scripts/nix-pull file://$TEST_ROOT/manifest
}
clearStore
pullCache
drvPath=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix)
outPath=$($TOP/src/nix-store/nix-store -q $drvPath)
echo "building $outPath using substitutes..."
$TOP/src/nix-store/nix-store -r $outPath
cat $outPath/input-2/bar
clearStore
pullCache
echo "building $drvPath using substitutes..."
$TOP/src/nix-store/nix-store -r $drvPath
cat $outPath/input-2/bar

9
tests/nix-push.sh Normal file
View file

@ -0,0 +1,9 @@
drvPath=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix)
outPath=$($TOP/src/nix-store/nix-store -r $drvPath)
echo "pushing $drvPath"
mkdir $TEST_ROOT/cache
$PERL -w -I$TOP/scripts $TOP/scripts/nix-push \
--copy $TEST_ROOT/cache $TEST_ROOT/manifest $drvPath