From aa8f3f66fc4b034f6033dda1bd05977949d82f07 Mon Sep 17 00:00:00 2001 From: Ali Caglayan Date: Sat, 17 Oct 2026 22:25:09 +0200 Subject: [PATCH] test(sandbox): cover directory copy actions across sandbox modes Exercise a directory copy action with a generated directory dependency, without Melange or package management. Record the current behavior in symlink, copy, and hardlink sandbox modes before changing input traversal. Signed-off-by: Ali Caglayan --- .../test-cases/sandbox/copy-dir-deps.t | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 test/blackbox-tests/test-cases/sandbox/copy-dir-deps.t diff --git a/test/blackbox-tests/test-cases/sandbox/copy-dir-deps.t b/test/blackbox-tests/test-cases/sandbox/copy-dir-deps.t new file mode 100644 index 00000000000..65494e18976 --- /dev/null +++ b/test/blackbox-tests/test-cases/sandbox/copy-dir-deps.t @@ -0,0 +1,44 @@ +A copy action on a directory dependency should produce regular files in every +sandbox mode. This case has no overlapping dependencies. + + $ make_dune_project 3.25 + $ cat > dune <<'EOF' + > (rule + > (target (dir tree)) + > (action (system "mkdir tree && echo contents > tree/file"))) + > (rule + > (target (dir copied)) + > (deps tree (sandbox always)) + > (action (no-infer (copy tree copied)))) + > EOF + +First check that the directory dependency contains a regular file. + + $ dune build tree/file + $ dune_cmd stat kind _build/default/tree/file + regular file + +Symlink mode: the copy action follows the directory link and copies its files. + + $ dune build copied --sandbox symlink + $ cat _build/default/copied/file + contents + $ dune_cmd stat kind _build/default/copied/file + regular file + +Copy mode also produces a regular file with the expected contents. + + $ dune build copied --sandbox copy + $ cat _build/default/copied/file + contents + $ dune_cmd stat kind _build/default/copied/file + regular file + +Hardlink mode currently fails while populating the directory dependency, +before the copy action runs. + + $ dune build copied --sandbox hardlink 2>&1 | censor + Error: + link(_build/.sandbox/$DIGEST/default/tree): Operation not permitted + -> required by _build/default/copied + [1]