diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-10-19 10:48:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-19 10:48:26 +0200 |
commit | 4bc70b82169e7a56dcad962ae5e001d97c1ef40e (patch) | |
tree | 86c3510b0ad2ce85bb822ce133e1ab009a2e8d53 /tests | |
parent | a324e9a5c84a144b824303064220463977c63c73 (diff) | |
parent | e136d57f26155a9f54dfb0ca00212b2016932104 (diff) |
Merge pull request #7187 from NixOS/path-from-hash-part
Add command 'nix store path-from-hash-part'
Diffstat (limited to 'tests')
-rw-r--r-- | tests/local.mk | 3 | ||||
-rw-r--r-- | tests/path-from-hash-part.sh | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/tests/local.mk b/tests/local.mk index 5e48ceae1..340817ec3 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -109,7 +109,8 @@ nix_tests = \ store-ping.sh \ fetchClosure.sh \ completions.sh \ - impure-derivations.sh + impure-derivations.sh \ + path-from-hash-part.sh ifeq ($(HAVE_LIBCPUID), 1) nix_tests += compute-levels.sh diff --git a/tests/path-from-hash-part.sh b/tests/path-from-hash-part.sh new file mode 100644 index 000000000..bdd104434 --- /dev/null +++ b/tests/path-from-hash-part.sh @@ -0,0 +1,10 @@ +source common.sh + +path=$(nix build --no-link --print-out-paths -f simple.nix) + +hash_part=$(basename $path) +hash_part=${hash_part:0:32} + +path2=$(nix store path-from-hash-part $hash_part) + +[[ $path = $path2 ]] |