Add a regression test for #4725

This commit is contained in:
regnat 2021-04-22 17:54:02 +02:00
parent d9864be4b7
commit b1711071d1

View file

@ -8,7 +8,8 @@ sed -i 's/experimental-features .*/& ca-derivations ca-references/' "$NIX_CONF_D
rm -rf $TEST_ROOT/binary_cache rm -rf $TEST_ROOT/binary_cache
export REMOTE_STORE=file://$TEST_ROOT/binary_cache export REMOTE_STORE_DIR=$TEST_ROOT/binary_cache
export REMOTE_STORE=file://$REMOTE_STORE_DIR
buildDrvs () { buildDrvs () {
nix build --file ./content-addressed.nix -L --no-link "$@" nix build --file ./content-addressed.nix -L --no-link "$@"
@ -22,3 +23,20 @@ buildDrvs --post-build-hook ../push-to-store.sh
clearStore clearStore
buildDrvs --substitute --substituters $REMOTE_STORE --no-require-sigs -j0 buildDrvs --substitute --substituters $REMOTE_STORE --no-require-sigs -j0
# Same thing, but
# 1. With non-ca derivations
# 2. Erasing the realisations on the remote store
#
# Even in that case, realising the derivations should still produce the right
# realisations on the local store
#
# Regression test for #4725
clearStore
nix build --file ../simple.nix -L --no-link --post-build-hook ../push-to-store.sh
clearStore
rm -r "$REMOTE_STORE_DIR/realisations"
nix build --file ../simple.nix -L --no-link --substitute --substituters "$REMOTE_STORE" --no-require-sigs -j0
if [[ $(sqlite3 "$NIX_STATE_DIR/db/db.sqlite" 'select count(*) from Realisations') -eq 0 ]]; then
echo "Realisations not rebuilt"
exit 1
fi