── test
├── dune
├── test_program.ml
└── foo_files
├── foo_a
└── foo_b
How can test_program
find the files under folder foo_files
when run using dune test
?
I can see that when the program is run, the current working directory is _build/default/test
and the foo_files
folder is not copied there.
dune 3.15.3
Basically, dune
will only copy to _build/default
the things that are flagged as dependencies of the targets it is supposed to build. In your case, the dune
file of test
might look like:
; tells dune that some rules might depend on foo_files' content
; see https://dune.readthedocs.io/en/stable/reference/dune/data_only_dirs.html
(data_only_dirs foo_files)
(test
(name test_program)
(deps (source_tree foo_files))
; other fields if needed
)