-
Notifications
You must be signed in to change notification settings - Fork 414
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: exhibit a bug when promoting directories
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))) |
3 changes: 3 additions & 0 deletions
3
test/blackbox-tests/test-cases/promote/deep-subdir.t/dune-project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
43
test/blackbox-tests/test-cases/promote/deep-subdir.t/run.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |