1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-08 18:11:02 +01:00

Improve regression testing for uncachable source paths

These now throw an error by default in the test suite.
This commit is contained in:
Eelco Dolstra 2025-06-16 18:25:55 +02:00
parent a175c67def
commit 3a4e6cadeb
7 changed files with 19 additions and 12 deletions

View file

@ -55,9 +55,13 @@ std::pair<StorePath, Hash> fetchToStore2(
}
debug("source path '%s' not in store", path);
}
} else
} else {
static auto barf = getEnv("_NIX_TEST_BARF_ON_UNCACHEABLE").value_or("") == "1";
if (barf)
throw Error("source path '%s' is uncacheable (filter=%d)", path, (bool) filter);
// FIXME: could still provide in-memory caching keyed on `SourcePath`.
debug("source path '%s' is uncacheable (%d, %d)", path, (bool) filter, (bool) fingerprint);
debug("source path '%s' is uncacheable", path);
}
Activity act(*logger, lvlChatty, actUnknown,
fmt(mode == FetchMode::DryRun ? "hashing '%s'" : "copying '%s' to the store", path));