Skip to content

Commit

Permalink
test: exhibit a bug when promoting directories
Browse files Browse the repository at this point in the history
  • Loading branch information
panglesd committed Dec 16, 2024
1 parent 3fc17ee commit b21f9e4
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/blackbox-tests/test-cases/promote/deep-subdir.t/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(rule
(deps
(source_tree deep))
(targets (dir deep_copied))
(mode promote)
(action
(run cp -r deep deep_copied)))
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(lang dune 3.0)

(using directory-targets 0.1)
43 changes: 43 additions & 0 deletions test/blackbox-tests/test-cases/promote/deep-subdir.t/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Tests for promoting directory targets
-------------------------------------

Let's create the directory structure we are going to promote (as a copy on
another dir):

$ mkdir -p deep/a/
$ touch deep/a/deep_file
$ touch deep/base_file

Let's try this:

$ dune build deep_copied

This one works. Now, let's add a layer between base_file and deep_file:

$ rm -rf deep
$ mkdir -p deep/a/b/
$ touch deep/a/b/deep_file
$ touch deep/base_file

$ dune build deep_copied
File "dune", lines 1-7, characters 0-121:
1 | (rule
2 | (deps
3 | (source_tree deep))
4 | (targets (dir deep_copied))
5 | (mode promote)
6 | (action
7 | (run cp -r deep deep_copied)))
Error: Cannot promote files to "deep_copied/a/b".
Reason: opendir(deep_copied/a/b): No such file or directory
-> required by _build/default/deep_copied
[1]

It does not work! Note that the `base_file` is required. For instance, move it
to `a/`, or remove it, and it works:

$ mv deep/base_file deep/a/
$ dune build deep_copied

$ rm deep/a/base_file
$ dune build deep_copied

0 comments on commit b21f9e4

Please sign in to comment.