Skip to content

Commit c34c226

Browse files
committed
Add test
1 parent e15854e commit c34c226

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/functional/chroot-store.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,28 @@
22

33
source common.sh
44

5+
# Regression test for #11503.
6+
mkdir -p "$TEST_ROOT/directory"
7+
cat > "$TEST_ROOT/directory/default.nix" <<EOF
8+
let
9+
root = ./.;
10+
filter = path: type:
11+
let
12+
rootStr = builtins.toString ./.;
13+
in
14+
if builtins.substring 0 (builtins.stringLength rootStr) (builtins.toString path) == rootStr then true
15+
else builtins.throw "root path\n\${rootStr}\nnot prefix of path\n\${builtins.toString path}";
16+
in
17+
builtins.filterSource filter root
18+
EOF
19+
20+
result="$(nix-store --add-fixed --recursive sha256 $TEST_ROOT/directory)"
21+
nix-instantiate --eval "$result"
22+
nix-instantiate --eval "$result" --store "$TEST_ROOT/2nd-store"
23+
nix-store --add-fixed --recursive sha256 "$TEST_ROOT/directory" --store "$TEST_ROOT/2nd-store"
24+
nix-instantiate --eval "$result" --store "$TEST_ROOT/2nd-store"
25+
26+
# Misc tests.
527
echo example > "$TEST_ROOT"/example.txt
628
mkdir -p "$TEST_ROOT/x"
729

0 commit comments

Comments
 (0)