1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 14:21:48 +02:00

tests/functional: Enable more tests in NixOS VM

This commit is contained in:
Robert Hensing 2024-06-16 17:56:50 +02:00
parent f0abe4d8f0
commit 648302b833
38 changed files with 71 additions and 104 deletions

View file

@ -82,11 +82,25 @@ clearProfiles() {
rm -rf "$profiles"
}
# Clear the store, but do not fail if we're in an environment where we can't.
# This allows the test to run in a NixOS test environment, where we use the system store.
# See doc/manual/src/contributing/testing.md / Running functional tests on NixOS.
clearStoreIfPossible() {
if isTestOnNixOS; then
echo "clearStoreIfPossible: Not clearing store, because we're on NixOS. Moving on."
else
doClearStore
fi
}
clearStore() {
if isTestOnNixOS; then
die "clearStore: not supported when testing on NixOS. Is it really needed? If so add conditionals; e.g. if ! isTestOnNixOS; then ..."
die "clearStore: not supported when testing on NixOS. If not essential, call clearStoreIfPossible. If really needed, add conditionals; e.g. if ! isTestOnNixOS; then ..."
fi
doClearStore
}
doClearStore() {
echo "clearing store..."
chmod -R +w "$NIX_STORE_DIR"
rm -rf "$NIX_STORE_DIR"