forked from lix-project/lix
Fix test failures
This commit is contained in:
parent
7d14f5c331
commit
21ef1670b3
|
@ -691,7 +691,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
|
||||||
string name = dirent->d_name;
|
string name = dirent->d_name;
|
||||||
if (name == "." || name == "..") continue;
|
if (name == "." || name == "..") continue;
|
||||||
Path path = settings.nixStore + "/" + name;
|
Path path = settings.nixStore + "/" + name;
|
||||||
if (isValidPath(path))
|
if (isStorePath(path) && isValidPath(path))
|
||||||
entries.push_back(path);
|
entries.push_back(path);
|
||||||
else
|
else
|
||||||
tryToDelete(state, path);
|
tryToDelete(state, path);
|
||||||
|
|
|
@ -17,6 +17,7 @@ bool isInStore(const Path & path)
|
||||||
bool isStorePath(const Path & path)
|
bool isStorePath(const Path & path)
|
||||||
{
|
{
|
||||||
return isInStore(path)
|
return isInStore(path)
|
||||||
|
&& path.size() >= settings.nixStore.size() + 1 + storePathHashLen
|
||||||
&& path.find('/', settings.nixStore.size() + 1) == Path::npos;
|
&& path.find('/', settings.nixStore.size() + 1) == Path::npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ clearStore
|
||||||
|
|
||||||
max=500
|
max=500
|
||||||
|
|
||||||
reference=$NIX_STORE_DIR/abcdef
|
reference=$NIX_STORE_DIR/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||||
touch $reference
|
touch $reference
|
||||||
(echo $reference && echo && echo 0) | nix-store --register-validity
|
(echo $reference && echo && echo 0) | nix-store --register-validity
|
||||||
|
|
||||||
|
@ -12,9 +12,9 @@ echo "making registration..."
|
||||||
|
|
||||||
set +x
|
set +x
|
||||||
for ((n = 0; n < $max; n++)); do
|
for ((n = 0; n < $max; n++)); do
|
||||||
storePath=$NIX_STORE_DIR/$n
|
storePath=$NIX_STORE_DIR/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-$n
|
||||||
echo -n > $storePath
|
echo -n > $storePath
|
||||||
ref2=$NIX_STORE_DIR/$((n+1))
|
ref2=$NIX_STORE_DIR/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-$((n+1))
|
||||||
if test $((n+1)) = $max; then
|
if test $((n+1)) = $max; then
|
||||||
ref2=$reference
|
ref2=$reference
|
||||||
fi
|
fi
|
||||||
|
@ -30,7 +30,7 @@ echo "collecting garbage..."
|
||||||
ln -sfn $reference "$NIX_STATE_DIR"/gcroots/ref
|
ln -sfn $reference "$NIX_STATE_DIR"/gcroots/ref
|
||||||
nix-store --gc
|
nix-store --gc
|
||||||
|
|
||||||
if [ -n "$(type -p sqlite3)" -a "$(sqlite3 ./test-tmp/db/db.sqlite 'select count(*) from Refs')" -ne 0 ]; then
|
if [ -n "$(type -p sqlite3)" -a "$(sqlite3 $NIX_DB_DIR/db.sqlite 'select count(*) from Refs')" -ne 0 ]; then
|
||||||
echo "referrers not cleaned up"
|
echo "referrers not cleaned up"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue