diff options
author | Vincent Ambo <mail@tazj.in> | 2020-07-18T23·27+0100 |
---|---|---|
committer | tazjin <mail@tazj.in> | 2020-07-19T00·49+0000 |
commit | a802b4b44d4c25fc759812771042553190e853e2 (patch) | |
tree | 85ed17d674479c8af60b37e41818b117bb08e2cc /third_party/nix/src/tests/dummy-store.hh | |
parent | 989537f972531ab321994e3691312617e343aee4 (diff) |
fix(3p/nix/tests): Fail DummyStore::addToStore on non-existent srcPath r/1389
Unfortunately, to guarantee correct behaviour of some evaluation (!) tests, addToStore needs to actually check whether passed in source files exist and fail appropriately. There is a chance that the dependency on this behaviour is actually a bug in the upstream test suite, but my attempts at finding out more about this from, say, the git history have so far been unsuccessful. Change-Id: I311999ea28fcedf5da13a4e627b1c1c8e4e59cbd Reviewed-on: https://cl.tvl.fyi/c/depot/+/1276 Reviewed-by: isomer <isomer@tvl.fyi> Reviewed-by: glittershark <grfn@gws.fyi> Tested-by: BuildkiteCI
Diffstat (limited to 'third_party/nix/src/tests/dummy-store.hh')
-rw-r--r-- | third_party/nix/src/tests/dummy-store.hh | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/third_party/nix/src/tests/dummy-store.hh b/third_party/nix/src/tests/dummy-store.hh index efa4390d28eb..d0f8bf14b60f 100644 --- a/third_party/nix/src/tests/dummy-store.hh +++ b/third_party/nix/src/tests/dummy-store.hh @@ -1,5 +1,6 @@ #pragma once +#include <filesystem> #include "libstore/store-api.hh" namespace nix::tests { @@ -20,7 +21,11 @@ class DummyStore final : public Store { bool recursive = true, HashType hashAlgo = htSHA256, PathFilter& filter = defaultPathFilter, RepairFlag repair = NoRepair) { - return "/nix/store/g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-x"; + if (srcPath == "/exists-for-tests") { + return "/nix/store/g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-x"; + } + + throw SysError("file does not exist"); } Path addTextToStore(const std::string& name, const std::string& s, |